hi. i just found a send password script here. this is the script.
$db_host = '';
$db_user = '';
$db_pass = '';
$db_name = '';
$db_table = 'mytable';
$conn = mysql_connect($db_host,$db_user,$db_pass);
mysql_select_db($db_name,$conn);
mt_srand((double)microtime() * 1000000);
$charlist = "qwertyuiopasdfghjklzxcvbnm1234567890";
$newpass = '';
$max = strlen($charlist) - 1;
for ($i = 0; $i < 10; $i++) {
$randnum = mt_rand(0, $max);
$newpass .= $charlist{$randnum};
}
$newpass2= md5($newpass);
$email=$_POST["email"]; // this value is from a form wherein they input their email add
$sql = "SELECT * FROM mytable where email = '$email'";
$result = mysql_query($query);
if(mysql_num_rows($result) == 0) {
echo "Your email address is not in the database.";
}
else {
$sql2 = "UPDATE mytable SET
password='$newpass2'
WHERE email='$email'";
if ($result2 = mysql_query($sql2)) {
$femail= "myemail@myemail.net";
$temail= $email;
$message="Hi there, as requested please find your new password below:\n\nPassword: $newpass\n\nPlease login and change your pass immediately";
if(mail($temail,":: Password Reminder ::",$message,"From: $femail\n")) {
echo "We have sent an email including your new pass to $email";
} else {
echo "Sorry, there was a problem sending your reminder. Please try again letter or contact an admin.";
}
}
}
?>
the problem is i always get:
Your email address is not in the database.
though i'm sure that the email add exists! thanks.