sondmk header
Librarys และการใช้งาน

MagicZoom

//How to Use "MagicZoom" 
download: https://drive.google.com/open?id=1C3mPtMtSkXf6txOeuS2XAtkNjaKg5-Gg
Example.
-----------------------------------------------------------------------------
<link rel='stylesheet' href='magiczoom.css'>
<script src='magiczoom.js'></script>
<script src='magiczoom-custom.js'></script>

<a class='MagicZoom' title='Title-Name' href='a.jpg' >
   <img alt='Alt-Name' class='img-fluid mx-auto d-block' src='a.jpg' >
</a>      	
      

PHP Convert Number to Thai Bath

//How to Use "php-convert-number-to-thaibath" 
download: https://drive.google.com/open?id=10I1wWXFHU6vujSSRsN9TxNB-VRULptCw
Example.
-----------------------------------------------------------------------------
<?php
include 'php-convert-number-to-thaibath.php';
$x = '9123568543241.25'; 
echo  number_format($x,2)."=>".convert($x);
?>
      

Page Pagination

//How to Use "pagination Page"
download: https://drive.google.com/open?id=1Qc4Xwfi0nj36kNbZ2dmB-fVia7ckrgTT
Example.
-----------------------------------------------------------------------------
<?php
include 'pagination.php';
$sql = "SELECT * FROM tbName";
$per_page = 5; //Default 10
$qry = page_query($linkDB,$sql,$per_page);

echo "<table>";
while($rs=mysqli_fetch_array($qry))
{
echo "<tr><td>{$rs['fildName']}</td></tr>";
}
echo "</table>";
page_prevnext_text("<" , ">");
page_first_last_text("<<" , ">>");
page_link_border("solid" , "1px" , "gray");
page_link_bg_color("lightblue" , "pink");
page_link_font("14px" , false , false , false , false);
page_echo_pagenums(6 , true , true); 			//page_size,prev_next,first_last
?>
      

PHPMailer

//How to Use "PHPMailer"
download: https://drive.google.com/open?id=1VWUaUDJj0oxk7fAzxMGr5nCuIN11P7Sb
credit: https://www.itoffside.com/how-to-use-phpmailer-gmail-smtp/
Example.
-----------------------------------------------------------------------------
<?php
if($_POST)
{
  date_default_timezone_set('Asia/Bangkok');
  include 'PHPMailer-5.2.9s/PHPMailerAutoload.php';
  
  $send_name    = $_POST['name'];       //send name
  $send_mail    = $_POST['email'];      //send mail
  $recive_name  = "target_name";        //recive name
  $recive_mail  = "target_email";       //recive mail
  $subject      = $_POST['subject'];    //subject
  $body         = $_POST['body'];       //content
    
  //multifile-attechment
  if(isset($_FILES['file']))
  {
    foreach($_FILES['file']['tmp_name'] as $key => $val)
    {
      $newFile  = md5($_FILES['file']['name'][$key].rand(11111,99999)).'.'.end(explode('.', $_FILES['file']["name"][$key]));
      move_uploaded_file($_FILES["file"]["tmp_name"][$key],"uploads/".$newFile);
      echo "<br>".$newFile;
    }
    echo "<hr>";
  }

  //Create a new PHPMailer instance
  $mail = new PHPMailer;
  //Tell PHPMailer to use SMTP
  //$mail->isSMTP();
  //Enable SMTP debugging
  // 0 = off (for production use)
  // 1 = client messages
  // 2 = client and server messages
  //$mail->SMTPDebug = 0;
  //Ask for HTML-friendly debug output
  //$mail->Debugoutput = 'html';
  //Set the hostname of the mail server
  //$mail->Host = "smtp.gmail.com";
  $mail->Host = "mail.domainname.com";
  //Set the SMTP port number - likely to be 25, 465 or 587
  $mail->Port = 587;
  //Set the encryption system to use - ssl (deprecated) or tls
  $mail->SMTPSecure = 'tls';
  //Whether to use SMTP authentication
  //$mail->SMTPAuth = true;
  $mail->SMTPAuth = false;
  //Username to use for SMTP authentication
  //$mail->Username = "username";
  //Password to use for SMTP authentication
  //$mail->Password = "password";
  //Set who the message is to be sent from
  $mail->setFrom($send_mail, $send_name);         //เมล์ผู้ส่ง
  //Set who the message is to be sent to
  $mail->addAddress($recive_mail, $recive_name);  //เมล์ผู้รับ
  //Set the subject line
  $mail->Subject = $subject;                      //หัวข้อส่ง
  //Read an HTML message body from an external file, convert referenced images to embedded,
  //convert HTML into a basic plain-text alternative body
  //$mail->msgHTML(file_get_contents('content.html'), dirname(__FILE__));
  $mail->msgHTML($body);                          //รายละเอียด
  
  //upload file-multipart attechment
  $fileDir = opendir("uploads");
  while(($file=readdir($fileDir)) !== false)
  {
    $mail->AddAttachment("uploads/".$file);
  }

  //send the message, check for errors
  if (!$mail->send()) {
      echo "Mailer Error: " . $mail->ErrorInfo;
  } else {
      echo "Message sent!";
  }

  //Remove file attech when sended.
  $fileDir = opendir("uploads");
  while(($file=readdir($fileDir)) !== false)
  {
    unlink("uploads/".$file);
  }
  
  echo "<br>finish.";
}
?>
      


Framework

Library


เครื่องมือพัฒนาเว็บ



การออกแบบและพัฒนาเว็บไซต์


Download SourceCode



copyAllright © 2016 soundmk.com