-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpassword_reminder.php
58 lines (42 loc) · 1.64 KB
/
password_reminder.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
<?php
define('INCLUDE_PATH', 'include/');
require(INCLUDE_PATH.'vitals.inc.php');
if (isset($_POST['cancel'])) {
header('Location: index.php');
exit;
} else if ($_POST['email'] || $_GET['processed']) {
$sql = "SELECT login, password FROM members WHERE email='".addslashes($_POST['email'])."'";
$result = mysql_query($sql, $db);
if ($row = @mysql_fetch_assoc($result)) {
$body = "The following are your login details for the Signlink forum website:"."\n\n";
$body .= "Login: ". $row['login']."\n";
$body .= "Password: ". $row['password']."\n";
//send email
require(INCLUDE_PATH . 'phpmailer/class.phpmailer.php');
$mail = new PHPMailer();
$mail->From = '[email protected]';
$mail->AddAddress($_POST['email']);
$mail->Subject = "Signlink Password Reminder";
$mail->Body = $body;
if(!$mail->Send()) {
$_SESSION['errors'][] = "Sending error.";
} else {
$_SESSION['feedback'][] = "Your login details have been emailed.";
unset($mail);
require(INCLUDE_PATH.'header.inc.php');
require(INCLUDE_PATH.'footer.inc.php');
exit;
}
} else {
$_SESSION['errors'][] = "Email not found.";
}
}
require(INCLUDE_PATH.'header.inc.php');
?>
<h3>Password Reminder</h3>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>?processed=1" method="post">
<p>Enter your email address, and your login details will be mailed to you.</p>
Email address: <input type="text" name="email" style="width:20em;" /><br /><br />
<input type="submit" name="submit" value="Submit" /> | <input type="submit" name="cancel" value="Cancel" />
</form>
<?php require(INCLUDE_PATH.'footer.inc.php'); ?>