-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathforgot.php
More file actions
executable file
·51 lines (46 loc) · 1.59 KB
/
Copy pathforgot.php
File metadata and controls
executable file
·51 lines (46 loc) · 1.59 KB
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
<?php
include 'dbc.php';
if ($_POST['Submit']=='Send')
{
$host = $_SERVER['HTTP_HOST'];
$rs_search = mysql_query("select user_email from users where user_email='$_POST[email]'");
$user_count = mysql_num_rows($rs_search);
if ($user_count != 0)
{
$newpwd = rand(1000,9999);
$host = $_SERVER['HTTP_HOST'];
$newmd5pwd = md5($newpwd);
mysql_query("UPDATE users set user_pwd='$newmd5pwd' where user_email='$_POST[email]'");
$message =
"You have requested new login details from $host. Here are the login details...\n\n
User Name: $_POST[email] \n
Password: $newpwd \n
____________________________________________
*** LOGIN ***** \n
To Login: http://$host/login.php \n\n
_____________________________________________
Thank you. This is an automated response. PLEASE DO NOT REPLY.
";
mail($_POST['email'], "New Login Details", $message,
"From: \"Auto-Response\" <robot@$host>\r\n" .
"X-Mailer: PHP/" . phpversion());
die("Thank you. New Login details has been sent to your email address");
} else die("Account with given email does not exist");
}
?>
<link href="css/styles.css" rel="stylesheet" type="text/css">
<h3>Forgot Password</h3>
<p>Please enter your email address and the new password will be sent.</p>
<table width="50%" border="0" cellpadding="1" cellspacing="0">
<tr>
<td>
<form name="form1" method="post" action="">
<p><br>
<strong>Email:</strong>
<input name="email" type="text" id="email">
<input type="submit" name="Submit" value="Send">
</p>
</form></td>
</tr>
</table>
<p> </p>