-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathforgot_password_submit.php
42 lines (39 loc) · 1.16 KB
/
forgot_password_submit.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
<?php
require('connection.inc.php');
require('function.inc.php');
$email = get_safe_value($con, $_POST['email']);
$res = mysqli_query($con, "select * from users where email='$email'");
$check_user = mysqli_num_rows($res);
if ($check_user > 0) {
$row = mysqli_fetch_assoc($res);
$pwd = $row['password'];
$html = "Your password is <strong>$pwd</strong>";
include('smtp/PHPMailerAutoload.php');
$mail = new PHPMailer(true);
$mail->isSMTP();
$mail->Host = "smtp.gmail.com";
$mail->Port = 587;
// $mail->SMTPDebug = 2;
$mail->SMTPSecure = "tls";
$mail->SMTPAuth = true;
$mail->Username = SMTP_EMAIL;
$mail->Password = SMTP_PASSWORD;
$mail->SetFrom(SMTP_EMAIL);
$mail->addAddress($email);
$mail->IsHTML(true);
$mail->Subject = "Your Password";
$mail->Body = $html;
$mail->SMTPOptions = array('ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => false
));
if ($mail->send()) {
echo "Please check your email id for password";
} else {
// echo "Error occur";
}
} else {
echo "Email id not register with us";
die();
}