Hi, I am trying to make forgot password script on www.thewallclone.com and I do not worry about it, because it was successful. In this post we are going to learn how to implement forgot password system on our web application, recover lost password from account using php, on this forgot password system we have form for account verification that will help us to create a new password for that account.
First, we are to verify either the user email address to send reset link for an opportunity to create new [fresh] password. The Password recover email has a link to the page where we can reset password.
How does password recovery work ?
Password Recovery help you recover lost and forgotten password or an opportunity to create new password or reset password.
E-mail verification is use to send a reset link to the user. Generate a unique random code, tie it to the user account, probably set an expiration time this is optional and store them into the database. Then generate a unique link and mail it to the user email address during registration.
So, for the verification aspect. When the user clicks the link, they will have the following data at your disposal: the email, and the token (a unique random code). That should be enough to do verification. This part do the following checks:
- Is the email valid?
- Is the email-token binding valid?
- Is the token expired? (Optional)
- Has the token been used?
- Is the token field empty?
If all checks out, allow the user to provide a new password/verify their email. No matter success or failure, it is very important to invalidate the token after use.
Check demo here download source code.
Basic PHP mail() Function code to send emails from a form
Now, on this tutorial we are using basic PHP mail() Function code to send emails from a form. You can use the PHP mail() function to send an email with PHP. The simplest way to do this is to send a text email. This is one way to handle sending emails to your users.
Index contain verification form and validation code change where you find thewallclone.com to your own domain.
This file contain form reset password after done all the verification and validations
Here is the database schema for this tutorial.
Don’t forget to share, subscribe to newsletters, or just say hello..