unistake Posted January 6, 2016 Share Posted January 6, 2016 Hi guys, I am trying to create a simple PHP script to send a new password to my users using the script below. I believe it was working however seemed to stop after a few tests. Any ideas why? Thanks $rand_password_md5 = md5($rand_password); $sql = "UPDATE Users SET password = '$rand_password_md5' WHERE username = '$code' AND Base = '$base'"; $result = mysqli_query($cxn,$sql) or die ("Can not change your password in our database."); // the email reply // use wordwrap() if lines are longer than 70 characters $msg = wordwrap($msg,70); // send email $to = $row['Femail']; $subject = "website.com | Password reset requested."; $txt = "Hi ".$row['Ffname'].", Please go back to www.website.com and login with your username ".$row['username']." and new password ".$rand_password.". You can then change your password by going to 'Settings' > 'Personal Settings'.!"; $headers = "From: noreply@website.com" . "\r\n" . "CC: info@website.com"; mail($to,$subject,$txt,$headers); Quote Link to comment Share on other sites More sharing options...
benanamen Posted January 6, 2016 Share Posted January 6, 2016 (edited) Md5 is insecure. Dont use it for passwords period. There are several threads on this forum that will give you details about what you should be using. Edited January 6, 2016 by benanamen 1 Quote Link to comment Share on other sites More sharing options...
Solution ginerjm Posted January 6, 2016 Solution Share Posted January 6, 2016 What doesn't work? The mail never arrives or never gets sent? Do you get a response from your script? Is error checking turned on? Quote Link to comment Share on other sites More sharing options...
unistake Posted January 6, 2016 Author Share Posted January 6, 2016 the page loads fine beyond the form however i never get an email either to the receiver or cc. Ill check the md5 threads now 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.