Forgot password help
Posted: Tue Apr 26, 2005 2:22 pm
I made a forgot password script in this code its suppose to send out the username and password if the username and email address is matched up well it matches them up but when it sends i get an error and when it goes to there inbox it say from Nobody and subject is Password and user in the email it shows....
username:
password:
but there isnt anything in there
here is the error
how can i make it where the it comes from my email address and in the email it would be like
username:
password:
but there isnt anything in there
here is the error
line 14Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/haunted/public_html/The_Bored_Game/forgotpassword.php on line 14
$query = mysql_query($sql);
how can i make it where the it comes from my email address and in the email it would be like
here is the script...Here is your username and password if you didnt request it dont worry your username and password only goes to your email box..
username: username
password: password
you requested the email from http://blah.com
Code: Select all
<?php
if($go == "1")
{
mysql_connect("localhost","haunted_smackie","*******");
mysql_select_db(haunted_BoringGame);
$sql = @mysql_query("SELECT * FROM dbUsers WHERE username='$name' && email='$email' ");
if(!$sql)
{
echo "The user name and email do not match.";
exit;
}
$query = mysql_query($sql);
$fPass = mysql_fetch_array($query);
mail($email, "Your Password", "User Name: ". $fPass[username] ."\nPassword: ". $fPass[password]);
echo "Your Password has been sent to ". $email .".";
}
?>
<form action="<?= $PHP_SELF ?>" method="post">
Name: <input type="text" name="name" size="24" border="0"><br>
E-mail: <input type="text" name="email" size="24" border="0"><br>
<input type="hidden" name="go" value="1" border="0"><input type="submit" name="submitButtonName" border="0">
</form>