%PDF- %PDF-
Direktori : /home/riacommer/public_html/api/ |
Current File : /home/riacommer/public_html/api/forgot.php |
<?php include_once("../admin/api/db.php"); if(isset($_POST["login_uid"])){ $uid = $_POST["login_uid"]; $sql = "SELECT * FROM sa_customer WHERE emailuid='$uid'"; $mysql_result = mysql_query($sql, $connection); $num_rows = mysql_num_rows($mysql_result); if($num_rows>=1){ while($row = mysql_fetch_array($mysql_result)){ $guid = generateGUID(); $sqlReset = "UPDATE sa_customer SET pwd='$guid' WHERE emailuid='$uid'"; mysql_query($sqlReset); //send email reset password $email='noreply@gasworld.com.my'; require("../class.phpmailer.php"); $mail = new PHPMailer(); $mail->IsSMTP(); // set mailer to use SMTP $mail->Host = "mail.gasworld.com.my:2525"; // specify main and backup server $mail->SMTPAuth = true; // turn on SMTP authentication $mail->Username = "noreply@gasworld.com.my"; // SMTP username $mail->Password = ")tt0w}J~97"; // SMTP password $mail->From = $email; $mail->FromName = 'noreply'; $mail->WordWrap = 100; // set word wrap to 50 characters $mail->IsHTML(true); // set email format to HTML $to = $uid; $body=''; $from = "From: ".$email; $subject = 'Forgot Password'; $headers = "Content-Type: text/html; charset=utf-8\n"; $body .= "Dear Customer,<br /><br />"; $body .= "<strong>Reset Password</strong>"; $body .= "<p>Kindly click the link below to reset your password:</p>"; $body .= "<a href='http://www.gasworld.com.my/reset.php?gid=".$guid."'>Reset Password</a><br />"; $body .= "<br /><br /><p>Best Regards,<br />Gasworld Administrator</p>"; $mail->AddAddress($to, $to); $mail->Subject = $subject; $mail->Body = $body; if($mail->Send()){ //$response = " Your enquiry has been posted to sales@gasworld.com.my successfully.<br /> Thank you."; } else { //$isError=true; //$response = " Your enquiry has been fail to post.<br /> Please try again or direct email your enquiry to sales@gasworld.com.my.<br />Thank you."; } header("Location: http://".$_SERVER['HTTP_HOST'] . str_replace("/api", "", dirname($_SERVER['PHP_SELF']))."/forgot.php?f=1", true); } } else { //invalid account header("Location: http://".$_SERVER['HTTP_HOST'] . str_replace("/api", "", dirname($_SERVER['PHP_SELF']))."/forgot.php?f=2", true); } } else { header("Location: http://" .$_SERVER['HTTP_HOST'] . str_replace("/api", "", dirname($_SERVER['PHP_SELF'])) ."/400.php"); } ?>