unistake Posted October 19, 2010 Share Posted October 19, 2010 Hi all, I am trying to make a 'forgot password' script. The passwords in the database are md5 encrypted. Is there a way to reverse this md5 password and send the forgotten password in its orginal for to the user through email? Thanks. <?PHP include("cxn.php"); $sql = "SELECT password FROM Members WHERE email='$_POST[email]'"; $result = mysqli_query($cxn,$sql) or die ("Couldn't execute query"); $num = mysqli_num_rows($result); if ($num >0) // Email Address Found { $password = md5($_POST['password']); // Trying to take the md5 off the password here. $to = "$_POST[email]"; $subj = "Password for website.co.uk"; $mess = "Your password for www.website.co.uk is: \n $_POST['password'] \n Please login with your email address and this password. Thank you."; $mailsend = mail($to,$subj,$mess,$headers); $update= "An email containing your password has been sent to". $_POST['email']."."; include("signin-redirect.php"); } else // Email Address Not Found { $registrationerror = "The email address '$_POST[email]' is already registered!"; include("signin-redirect.php"); } ?> Quote Link to comment Share on other sites More sharing options...
trq Posted October 19, 2010 Share Posted October 19, 2010 Is there a way to reverse this md5 password and send the forgotten password in its orginal for to the user through email? No. You will need to reset the users password to something new and send them that. Quote Link to comment Share on other sites More sharing options...
unistake Posted October 19, 2010 Author Share Posted October 19, 2010 ok thanks, Didn't think it would be possible as there would be no point of the md5! Thanks 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.