chriscloyd Posted April 13, 2007 Share Posted April 13, 2007 Hey this is my changepassword script on the site http://www.chaoslegionclan.net/cegl/index.php?page=forgotpassword no matter what i do it does not work it returns as an error saying there is no account and im 100% sure that the username and email address im entering are correct lol <?php session_start(); include("config.php"); $email = $_POST['email']; $username = $_POST['username']; //check email $check_email = mysql_query("SELECT * FROM users WHERE username = '$username'"); if ($check_email_address) { $check_email_nums = mysql_num_rows($check_email_address); if ($check_email_nums > 0) { $check_email = mysql_fetch_array($check_email_address); if ($check_email['user_email'] == $email) { $characters = 10; $possible = '23456789bcdfghjkmnpqrstvwxyz'; $code = ''; $i = 0; while ($i < $characters) { $code .= substr($possible, mt_rand(0, strlen($possible)-1), 1); $i++; } $newpass = $code; $password = md5($code); mysql_query("UPDATE users SET user_password = '$newpass' WHERE username = '$username'") or die(mysql_error()); $newpass = generatepassword_forgotpassword(; $encryptedpw = md5($newpass); $to = $email; $subject = "VAL@VALeague.net - New Password"; $message = "You requested a new password Your new password is: $newpass If you need any further help just ask. VAL-Support Staff"; $from = "VAL@VALeague.net"; $headers1 = "MIME-Version: 1.0\r\n"; $headers1 .= "Content-type: text/html; charset=iso-8859-1\r\n"; $headers1 .= "To: ".$to."\r\n"; $headers1 .= "From: ".$from."\r\n"; $headers1 .= "Reply-To: ".$from."\r\n"; mail($to, $subject, $message, $headers); header("Location: ../index.php?page=newpass"); } } else { $reasons = '-There is no account with that username.'; header("Location: ../index.php?page=forgotpassword&error=$reasons"); } } else { $reasons = '-There is no account with that username.'; header("Location: ../index.php?page=forgotpassword&error=$reasons"); } ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.