Mini Shell

Direktori : /home/rizant5/www/development/
Upload File :
Current File : //home/rizant5/www/development/forgot-email.php

<?php
$verify_url="http://" . $_SERVER['SERVER_NAME'] ."/verify-student.php";
require_once("config.php");
require_once('phpmailer/class.phpmailer.php');
require_once('phpmailer/class.smtp.php');
$stu_email=$_POST['stu_email'];
$data=$conn->prepare("select * from student_reg where stu_email='$stu_email'");
$data->execute();$num=$data->rowcount();
if($num>0){
$length = 10;
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$charactersLength = strlen($characters);
$randomString = '';
for ($i = 0; $i < $length; $i++) {
     $randomString .= $characters[rand(0, $charactersLength - 1)];
}

$conn->exec("update student_reg SET stu_password='".md5($randomString)."' where stu_email='$stu_email'");
$stu_id=$conn->lastInsertId();
//Send Mail
$message ="Dear Valued Subscriber,<br/><br/>

We have received your request to assist you with your forgotten password. Accordingly, the system generated temporary password to login to our account is: <b>$randomString</b> <br/><br/>

You may kindly login to your account using this password, and change password to your choice from your account upon login.<br/><br/>

To keep your account secure, please don't forward this email to anyone.<br/><br/>

Please click here to login:$verify_url <br/><br/>

We really appreciate your association with Lanka Virtual Academy and assure you of our best service and attention at all times.<br/><br/>

<b>The Administrator</b><br/>
Lanka Virtual Academy";
		$mail	= new PHPMailer; // call the class 
		//$mail->IsSMTP();
		$mail->SMTPDebug  = 0; 
		$mail->SMTPSecure = "tls";	 
		$mail->Host = "smtp.gmail.com"; //Hostname of the mail server
		$mail->Port = 587; //Port of the SMTP like to be 25, 80, 465 or 587
		$mail->SMTPAuth = true; //Whether to use SMTP authentication
		$mail->Username = "praveen.patel.9595"; //Username for SMTP authentication any valid email created in your domain
		$mail->Password = "bgxbpqumcefjrbqi"; //Password for SMTP authentication
		$mail->AddReplyTo("support@lankavirtualacademy.com", "Lanka Virtual Academy"); //reply-to address
		$mail->SetFrom("support@lankavirtualacademy.com","Lanka Virtual Academy"); //From address of the mail
		// put your while loop here like below,
		$mail->Subject = "Forgot Password"; //Subject od your mail
		$mail->AddAddress($stu_email,"$stu_name"); //To address who will receive this email
		$mail->MsgHTML($message);
		$send = $mail->Send(); //Send the mails
		
ob_start();
		header("location:verify-student.php?msg=checkmail");
}
else{
header("location:forgot-password.php?msg=error");
}

?>

Zerion Mini Shell 1.0