stuart7398 Posted April 16, 2008 Share Posted April 16, 2008 Hi I have a login system. I need to add a 'forgot password' option. The user will either enter a username or email address and set up a new password. Where do I start with this? Thanks for your time. Stuart. Quote Link to comment Share on other sites More sharing options...
Cep Posted April 16, 2008 Share Posted April 16, 2008 You could help everyone by posting your script, otherwise we can only offer suggestions like, 1. querying the database to find a record matching the username and email 2. send an email to verify the password change which contains a GET link 3. upon verification from GET link, create a random password 4. find the record again and update it with new random password 5. email the random password Quote Link to comment Share on other sites More sharing options...
zenag Posted April 16, 2008 Share Posted April 16, 2008 <? $con=mysql_connect("localhost","root",""); mysql_select_db("dbname",$con); if($_POST["submit"]=='submit') { $name=$_POST["forgetpass"]; $sql=mysql_query("select name from tablename where email like '$name' or username like '$name'"); while($res=mysql_fetch_array($sql)) { echo $res["name"]; } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> </head> <body> <form action="" method="post"> <input type="text" name="forgetpass" value="" /> <input type="submit" name="submit" value="submit" /> </form> </body> </html> Quote Link to comment Share on other sites More sharing options...
rameshfaj Posted April 16, 2008 Share Posted April 16, 2008 Allow the user to enter the userid/username and after clicking some buttons then do: -verify the user entered id or name -if correct mail the randomly generated new passoword to the email address(stored in db during registration) else generate some error message. Quote Link to comment Share on other sites More sharing options...
unidox Posted April 16, 2008 Share Posted April 16, 2008 What you want to do is, have a form where the person needs to enter a username/email. AFter process the form and generate a 8 digit password. Send an email with a new password, and update the mysql database with the new password. Easy as that 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.