-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathrecover.php
45 lines (42 loc) · 1.26 KB
/
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
<?php
include "core/init.php";
logged_in_redirect();
include "includes/overall/header.php";
?>
<h1>Recover</h1>
<?php
if (isset($_GET['success']) === true && empty($_GET['success']) === true) {
?>
<p>Thanks, we've emailed you.</p>
<?php
} else {
$mode_allowed = array('username', 'password');
if (isset($_GET['mode']) === true && in_array($_GET['mode'], $mode_allowed) === true) {
// echo $_GET['mode'];
if (isset($_POST['email']) === true && empty($_POST['email']) === false) {
if (email_exists($_POST['email']) === true) {
// echo 'ok';
recover($_GET['mode'], $_POST['email']);
header('Location: recover.php?success');
exit();
} else {
echo '<p>Oops, we couldnt\'t find that email address!</p>';
}
}
?>
<form action="" method="post">
<ul>
<li>
Please enter your email address:<br>
<input type="text" name="email">
</li>
<li><input type="submit" value="Recover"></li>
</ul>
</form>
<?php
} else {
header('Location: index.php');
}
}
?>
<?php include "includes/overall/footer.php"; ?>