-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsend_pwd.php
57 lines (46 loc) · 1.53 KB
/
send_pwd.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
require_once('private/conn.php');
?>
<?php
if(isset($_POST['submit_email']) && $_POST['email'])
{
$email=$_POST['email'];
$pass='select `Password` from `minister_info` where `Email_ID`=\''.$email.'\';';
$charset="ABCDEFGHIJKLMNOPQRSTUVWXYZqwertyuioplkjhgfdsazxcvbnm1023654789";
$gpassword=substr(str_shuffle($charset),0,5);
//echo $gpassword;
require_once('/opt/lampp/htdocs/msp/private/phpmailer/PHPMailerAutoload.php');
$mail = new PHPMailer();
$mail->CharSet = "utf-8";
$mail->IsSMTP();
// enable SMTP authentication
$mail->SMTPAuth = true;
// GMAIL username
$mail->Username = "l4batch20@gmail.com";
// GMAIL password
$mail->Password = "l4@batch";
$mail->SMTPSecure = "ssl";
// sets GMAIL as the SMTP server
$mail->Host = "smtp.gmail.com";
// set the SMTP port for the GMAIL server
$mail->Port = "465";
$mail->From='l4batch20@gmail.com';
$mail->FromName='Kajal';
$mail->AddAddress($email);
$mail->Subject = 'Reset Password';
$mail->IsHTML(true);
$mail->Body = 'Your new password is : '.$gpassword.'';
echo 'End';
if($mail->Send())
{
echo " Check Your Email";
$gpassword=md5($gpassword);
$db->query('update `minister_info` set `Password`=\''.$gpassword.'\' where `Email_ID`=\''.$email.'\';');
echo "<script>alert('check your mail');window.document.location.href = 'login.php';</script>";
}
else
{
echo "Mail Error - >".$mail->ErrorInfo;
}
}
?>