Jump to content

php forgot password email


gongpex

Recommended Posts

Hello everyone,

 

If user forgot their password , they usually asked to give their email and then their password sent from web service into their email automatically,

 

Q : Can somebody give me tutorial about this?

 

please help

 

Thanks

Link to comment
Share on other sites

As you think through this you will see there is an advantage to having at least some sort of secondary id or "security question" from users. If someone breaks into their e-mail account the hacker will be stopped from changing their password by the security question.

 

You never e-mail a password and you never store a raw password in a database.

Link to comment
Share on other sites

It is easy u may just say<?phpinclude("db.php");/*Just fetch a new password for the person*/$rand=rand(0,100);$email='user@mail.com';$data=mysql_query("UPDATE user SET password='$rand' WHERE email='$email');mail($email,"Your Forgotten Password","Your forgotten password for e.g www.nextnaija.com is $rand Keep it safe","From: admin@nextnaija.com");?>Dats all enhance it with your forms you should be able it is just a hint

Link to comment
Share on other sites

This makes it really easy for vandals to just change anybody's password whenever they want. It is also really easy to hack with SQL injection. The MySQL library is deprecated due to security vulnerabilities, you should use MySQLi or PDO.

Link to comment
Share on other sites

  • 2 weeks later...

The concept is below:

  • Make form to get email address from user
  • check whether the email address is present in table or not
  • If present, retrieve password from table
  • send retrieved password to given email address using email() in PHP

Edited by Ingolme
Advertising
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...