function checkmail() { var amount = parseInt("<?=$amount?>"); alert(amount); if(amount > 5001){ Mail(); } return; }
<?php SESSION_START(); require_once('config.php'); require_once('class/class.upload.php') ; if(isset($_GET["po_code"])) { $strPOC = $_GET["po_code"]; } $result = " SELECT * FROM pocollect WHERE po_code = '".$strPOC."' "; $query = mysqli_query($conn,$result) or die($conn->error.'<br>'.$result); $fetch = mysqli_fetch_array($query,MYSQLI_ASSOC); $PO = $fetch['po_code']; $subt = $fetch['po_subt']; $tax = $fetch['po_tax']; $amount = $fetch['po_ttamount']; $word = $fetch['po_amountword']; ?> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="jquery-ui.js"></script> <link rel="stylesheet" type="text/css" href="jquery-ui.css"> <title>Purchase order</title> </head> <body> <form action="" name="form1" method="post"> <div align="center"><table width="90%" border="0" > <tr> <td><div align="right">Sub total : <?php echo $subt; ?> </div></td> </tr> <tr> <td><div align="right"> Value added TAX 7% : <?php echo $tax; ?></td> </tr> <tr> <td><div align="right">Total amount THB : <?php echo $amount; ?></td> </tr> <tr> <td><div align="right"><?php echo $word; ?> bath</div></td> </tr> </table> <br></br> <div align="center"> <input type="submit" name="MM_insert" onClick="MM_popupMsg('Approve success'),checkmail()" value="Approve" /> <input type="submit" name="M_insert" onClick="MM_popupMsg('Reject success'),Mail2()" value="Reject" /> </p></div> </form> <script> <?php if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "Approve")) { if($amount > 5001){ $sql = " UPDATE pocollect SET po_status = '2' WHERE po_code = '".$PO."' "; mysqli_query($conn,$sql) or die($conn->error.'<br>'.$sql); } else{ $sql = " UPDATE pocollect SET po_status = '20' WHERE po_code = '".$PO."' "; mysqli_query($conn,$sql) or die($conn->error.'<br>'.$sql); } } ?> </script> <script> function checkmail() { var amount = parseInt("<?= $amount ?>"); if(amount > 5000){ Mail(); } return; } </script> <script> function Mail() //email form <?php if (isset($_POST['MM_insert'])){ require_once("/PHPMailer/src/PHPMailer.php"); require_once("/PHPMailer/src/SMTP.php"); $mail = new PHPMailer\PHPMailer\PHPMailer(); $mail->IsHTML(true); $mail->SMTPDebug =2; $mail->IsSMTP(); $mail->SMTPSecure = false; $mail->SMTPAutoTLS = false; $mail->SMTPAuth = true; // enable SMTP authentication $mail->SMTPSecure = ""; // sets the prefix to the servier $mail->Host = "xxxx.co.th"; $mail->Port = 25; // set the SMTP port for the GMAIL server $mail->Username = "[email protected]"; $mail->Password = "tcpn7897"; $mail->From = "[email protected]";// "[email protected]"; $mail->FromName = "From System"; // set from Name $mail->Subject = "Approve"; $mail->Body = "Approve http://192.168.101.113:85/test/PO_TABLE_2.php " ; $email = "[email protected]" ; $mail->AddAddress("$email"); // to Address $mail->send(); } ?> </script> <script> function Mail2() //email form <?php if (isset($_POST['M_insert'])){ require_once("/PHPMailer/src/PHPMailer.php"); require_once("/PHPMailer/src/SMTP.php"); $mail = new PHPMailer\PHPMailer\PHPMailer(); $mail->IsHTML(true); $mail->SMTPDebug =2; $mail->IsSMTP(); $mail->SMTPSecure = false; $mail->SMTPAutoTLS = false; $mail->SMTPAuth = true; // enable SMTP authentication $mail->SMTPSecure = ""; // sets the prefix to the servier $mail->Host = "xxxx.co.th"; $mail->Port = 25; // set the SMTP port for the GMAIL server $mail->Username = "[email protected]"; $mail->Password = "tcpn7897"; $mail->From = "[email protected]";// "[email protected]"; $mail->FromName = "From System"; // set from Name $mail->Subject = "Reject"; $mail->Body = " Your order have been rejected " ; $email = "[email protected]" ; $mail->AddAddress("$email"); // to Address $mail->send(); } ?> </script> <script type="text/javascript"> function MM_popupMsg(msg) { //v1.0 alert(msg); window.close(); } </script> </body> </html>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง