yoddabyte Posted July 10, 2015 Share Posted July 10, 2015 I'm looking to send the reset password information back to users, but for some reason it's not working. Am I missing something? /*RESET*/ if($hidden == "reset+63-"){ $MemberCheck = mysql_query("SELECT * FROM members WHERE email = '$email'"); if(mysql_num_rows($MemberCheck)==1) { $thisView = mysql_fetch_array($MemberCheck); $MemberCode = $thisView['code']; $code = md5(uniqid(rand())); $updateMember = mysql_query("UPDATE members SET pass = 'reset' WHERE email = '$email'"); $insertReset = mysql_query("INSERT INTO members_reset(`idMember`,`code`)VALUES('$MemberCode', '$code')"); $to = "$email"; $subject = "Password Reset"; $message = "Click or Copy the link below to reset your Password:<br/>http://entangledencounters.com/confirmation.php?reset=$code\r\n"; $headers = 'From: hello@entangledencounters.com' . "\r\n" . 'Reply-To: hello@entangledencounters.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); if(mail($to, $subject, $message, $headers)) { echo '<script>';echo 'location.href="http://entangledencounters.com/splash.php?error=3&request=3";';echo '</script>'; }else{echo '<script>';echo 'location.href="http://entangledencounters.com/splash.php?error=4&request=2";';echo '</script>';} }else{echo '<script>';echo 'location.href="http://entangledencounters.com/splash.php?error=4&request=2";';echo '</script>';} } /*RESET*/ Quote Link to comment Share on other sites More sharing options...
CroNiX Posted July 10, 2015 Share Posted July 10, 2015 What does "not working" mean? It's not updated in the db? The email never gets sent? They don't receive the email? Quote Link to comment Share on other sites More sharing options...
yoddabyte Posted July 10, 2015 Author Share Posted July 10, 2015 not receiving the email, is my guess Quote Link to comment Share on other sites More sharing options...
yoddabyte Posted July 10, 2015 Author Share Posted July 10, 2015 I really need to switch it over to SMTP but that's a whole new issue. Quote Link to comment Share on other sites More sharing options...
QuickOldCar Posted July 10, 2015 Share Posted July 10, 2015 You need to check the $_GET['reset'] value against the saved random code you have in database. A form so they can input the new password. Proper checks on users email and the user, data from the form updates password. You need some better logic in this, more if/else statements and less queries depending the immediate action are doing.. 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.