this script works --- except that it doesn't really send the email to the users. and that's the part that i need help with. thanks!
<?
if ($useremail) {
MYSQL_CONNECT("localhost","username","password")
or die("Unable to connect to MySQL <br />".mysql_error());
@mysql_select_db("vintagestars")
or die("Sorry we cannot connect you to the vintagestars database <br />".mysql_error());
$db = "vintagestars";
$query_checkemail = "SELECT * FROM authorize WHERE useremail = '$useremail'";
$result_checkemail = mysql_query($query_checkemail);
if (!$result_checkemail) {
echo("Error performing query: " . mysql_error());
exit;
}
$recordcount_checkemail = mysql_num_rows($result_checkemail);
if ($recordcount_checkemail) {
while($row_checkemail = mysql_fetch_array($result_checkemail)) {
$username = $row_checkemail["username"];
$password = $row_checkemail["password"];
$mail_to = trim($useremail);
$mail_headers = "From: vintagestars.com\r\nReply-to: [email]you@yourhost.com[/email]";
$mail_subject = "Your login details for vintagestars.com";
$mail_body .= "Username = $username\n";
$mail_body .= "Password = $password\n\n";
$mail_body .= "Don't forget that they are case sensitive!\n\n";
$mail_body .= "Thank You,\n\n";
$mail_body .= "vintagestars.com staff\n\n";
mail($mail_to, $mail_subject, $mail_body, $mail_headers);
$message = "<center><p><font face=\"verdana\">Your password has been sent to $useremail.</p></center>";
print "$message";
?>
<div align="center"><a href="javascript:window.close();">
<font size="2" face="Verdana, Arial, Helvetica, sans-serif">Close</font></a><?
}
} else {
$message = "<center><p><font face=\"verdana\" color=\"#FF0000\"><b>NOT FOUND</b></font><br><br>
<font face=\"verdana\">Your e-mail address, <b>$useremail</b>, is not in our database.
This means you are not a member of vintagestars.com.<br><br>
<a href=\"forgotpw.php\">Go Back</a></font></p></center>";
print "$message";
}
} else {
$message = "<center><p><font face=\"verdana\" color=\"#FF0000\"> <b>You didn't enter your e-mail
address!</b></font><br><br><font face=\"verdana\"><a href=\"forgotpw01.php\">Go Back</a></font></p></center>";
print "$message";
}
?>