-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathresend.php
38 lines (32 loc) · 1.18 KB
/
resend.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
<?php
session_start();
//Tell PHP to log errors
ini_set('log_errors', 'On');
//Tell PHP to not display errors
ini_set('display_errors', 'Off');
//Set error_reporting to E_ALL
ini_set('error_reporting', E_ALL );
include '_dbConnect.php';
$otp = mt_rand(111111,999999);
$_SESSION["otp"] = $otp;
$email = $_GET['email'];
$sql = "update resetpassword set otp='$otp' where email='$email'";
$result = mysqli_query($conn, $sql);
if($result)
{
$to = $email;
$subject = "OTP verification by Galerie d'antiquités®";
$txt = "Hi $name, looks like you have locked yourself out!\n\nNo issues, the OTP to verify your account is $otp.\nHave a great day! \n\nGalerie d'antiquités®";
$headers = "From: [email protected]". "\r\n" .
"CC: [email protected]";
$mailsent = mail($to,$subject,$txt,$headers);
if($mailsent)
{
$_SESSION["mailsent"] = true;
header("Location:OTP.php");
}
}
else {
$_SESSION["forgot"] = true;
header("Location:index.php");
}