-
Notifications
You must be signed in to change notification settings - Fork 4
/
confirm-recover.php
59 lines (59 loc) · 2.21 KB
/
confirm-recover.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
include_once 'core/init.php';
?>
<html>
<head>
<!-- <link rel='stylesheet' href='includes/css/style.css'/>-->
<style>
body {
padding: 10px;
}
</style>
</head>
<body>
<div id='container'>
<?php
if (isset($_GET['success']) === true && empty($_GET['success']) === true) {
?>
<h3>Thanks, please check your email to confirm your request for a password.</h3>
<?php } else {
if (isset($_POST['email']) === true && empty($_POST['email']) === false) {
if ($users->email_exists($_POST['email']) === true) {
$email = htmlentities($_POST['email']);
$generated_string = $users->confirm_recover($email);
if (!empty($generated_string)) {
$message = "Hello " . $username . "Please click this link to generate a new password: http://192.168.61.128/portal/recover.php?email=" . $email . "&generated_string=" . $generated_string . ". We will generate a new password for you and send it back to your email address. ";
$mail->addAddress($email);
$mail->Subject = 'Password';
$mail->Body = $message;
if ($mail->send()) {
header('Location: confirm-recover.php?success');
exit();
} else {
echo 'Password Recovery email could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
}
//mail($email, 'Recover Password', $message);
}
} else {
echo 'Sorry, that email doesn\'t exist.';
}
} ?>
<h2>Recover Username / Password</h2>
<p>Enter your email below so we can confirm your request.</p>
<hr/>
<form action="" method='post'>
<ul class='listnone'>
<li>
<input type="text" required name='email'/>
</li>
<li> </li>
<li>
<button type="submit" class='submit'>Recover</button>
</li>
</ul>
</form>
<?php
} ?>
</div>
</body>