-
Notifications
You must be signed in to change notification settings - Fork 1
/
forgotPasswordProcess.php
59 lines (46 loc) · 1.75 KB
/
forgotPasswordProcess.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
57
58
59
<?php
require "connection.php";
require "SMTP.php";
require "PHPMailer.php";
require "Exception.php";
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
if (isset($_GET["e"])) {
$email = $_GET["e"];
if (empty($email)) {
echo ("Please Enter Your email !!!");
} else {
$rs = Database::search("SELECT * FROM `users` WHERE `email` ='" . $email . "'");
$n = $rs->num_rows;
if ($n == 1) {
$code = uniqid();
Database::iud("UPDATE `users` SET `verification_code`='" . $code . "' WHERE `email`='" . $email . "'");
$mail = new PHPMailer(true);
try {
//Server settings
$mail->isSMTP();
$mail->Host = 'smtp.gmail.com';
$mail->SMTPAuth = true;
$mail->Username = 'igamesinfos@gmail.com';
$mail->Password = 'cwjv xedp ajir oysq';
$mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS;
$mail->Port = 465;
//Recipients
$mail->setFrom('igamesinfos@gmail.com', 'Reset Password');
$mail->addReplyTo('igamesinfos@gmail.com', 'Reset Password');
$mail->addAddress($email);
//Content
$mail->isHTML(true);
$mail->Subject = 'InfinityGames Forgot Password Verification Code';
$mail->Body = '<h1 style="color:green">Your Verification Code is : ' . $code . '</h1>';
$mail->send();
echo ("success");
} catch (Exception $e) {
echo ("Verification code sending failed: {$mail->ErrorInfo}");
}
} else {
echo ("Invalid Email address");
}
}
}
?>