/ Published in: PHP
Expand |
Embed | Plain Text
$alert = ""; { $db->query("SELECT username, password FROM users WHERE email = '$email'"); $alert = "<div class='alert'>We're sorry, but we could not find a user with that email address.</div>"; else { $alert = "<div class='alert'>Your username and password have been emailed to you.</div>"; $username = $row['username']; $password = $row['password']; $msg = "Your login information is:\n\n"; $msg .= "Username: $username\n"; $msg .= "Password: $password\n"; } }
Comments
Subscribe to comments
You need to login to post a comment.

password stored as clear text?
You can encrypt them when registering user and reverse the process when recovering pass.
Excuse me if I'm wrong, but an encryption is good as long as it cannot be decrypted. The usual "Forgot Password Logic" in my opinion is: 1.) User forgots password, requests a new password 2.) User fills a form requesting the e-mail address 3.) The script sends out an e-mail a.) (Optional) The script sends out an e-mail with a link, telling that you have requested a new password and you must click a link in it b.) User receives a new, randomized password. (And the script updates the pass in the database)
Never store passwords in plain text format in your database, it is not secure!