0.8.1a
[gfh.git] / forgotpass.php
blobc730c67ece508b50817e129e7608f6a4468e2f2a
1 <?php include "config.php";
2 if (!$submit)
4 echo '<form method=post action=forgotpass.php>
5 Your Email: <input type=text name=email><br>
6 <br><input type=submit name=submit value="Resend your Password">
7 </form>';
9 if ($submit)
11 if (!$email)
13 echo 'You must enter an email address.<br><br>
14 <form method=post action=forgotpass.php>
15 Your Email: <input type=text name=email><br>
16 <br><input type=submit name=submit value="Resend your Password">
17 </form>';
18 exit;
20 $sql = "SELECT * FROM users WHERE email='$email'";
21 $result = mysql_query($sql);
22 if (mysql_num_rows($result) == 0)
24 echo "This email address has not been found in the database.";
25 exit;
27 $myrow = mysql_fetch_array($result);
28 $datedate = date("n/j/y g:i:s A");
29 $mailsubject = "Your forgotten password for GameFAQs Hell.";
30 $mailbody = "Your Username: ".$myrow["username"]."\nYour Password: ".$myrow["userpass"]."\n\nThis request was made at ".$datedate." from the IP ".$REMOTE_ADDR;
31 if (mail($email, $mailsubject, $mailbody))
32 echo "Your password has been sent to the email address you provided.";
33 else
34 echo "Failed to resend your password.";