session_start();
include 'dbconnect.php';
$submit = $_POST['submit'];
if ($submit == 'Reset'){
$email = $_POST['email'];
$captcha = $_POST['captcha'];
if ($captcha != $_SESSION['captcha'] ){
echo 'Your captcha is off!';
//header("Location: http://davidrtello.com ");
}
$pass =makepass();
$encpass = md5(md5(md5($pass)));
$ins = $dbh->prepare("update users set credentials = ? where email = ? ");
$ins->execute(array($encpass,$email));
$content = 'your new password is '.$pass."\n";
mail($email,'New password at mm214',$content);
echo 'Password changed! Check '.$email.'
';
}
?>
Enter your email to reset your password!