Can anybody help me with mail?
This is the code:
<?php
if ($_REQUEST['email'] != null){
$email = "
[email protected]";
$subject = "New Password";
$dbhost = "127.0.0.1";
$dbname = "nova";
$dbuser = "root";
$dbpass = "blabla";
mysql_connect($dbhost, $dbuser, $dbpass) or error("Could not connect: " . mysql_error());
mysql_select_db($dbname) or error(mysql_error());
$marriedto2 = mysql_query(sprintf("SELECT * FROM users WHERE username = '" . $_REQUEST['name'] . "'"));
$arrInfo = mysql_fetch_assoc($marriedto2);
$to = $arrInfo['email'];
if ($to == $sender)
{
$password = md5("blabla");
mysql_query("UPDATE users SET password = '" . $password . "' WHERE username = '" . $_REQUEST['name'] . "'");
$message = " It seems you have forgoten your password, here's a new one, login to the manager and change it to a new one (make sure you remember it), by using this password: <br> bla bla";
$username = $_REQUEST['name'] ;
if (mail($to, $subject, $message, "From:" . $email)){
echo 'Your new password has been sent to your mail.';
}
else if (!mail($to, $subject, $message, "From:" . $email)){
echo'Please try again...';
}
}
}
else
//if "email" is not filled out, display the form
{
?>
<form action="
<?php
echo $_SERVER['PHP_SELF'];
?>" method="post">
<table border="0">
<tr><td>Email:</td><td>
<input type="text" name="email" placeholder="Email that you registered with..." maxlength="50">
</td></tr>
<tr><td>Name:</td><td>
<input type="text" name="name" placeholder="Username..." maxlength="10">
</td></tr>
<tr><th colspan=2><input type="submit" name="submit"
value="Submit" style="height: 25px; width: 100px"></th></tr></table>
</form>
<p> Make sure that you know it will take about 5 minutes for you to receive the mail, it will also appear in your junk.</p>
<?php
}
?>
Can anybody help? The form shows but when I click submit, it shows me a blank page.Help?