User Login and Registration with Forgot Password using PHP and Mysql

In this tutorial we create the user registration and login process using PHP
and the backend we use MYSQL.

User Login and Registration with Forgot Password tutorial as below


The first thing we’ll need to do is set up our database . In this tutorial we have the following six pages we need named as:

  • register.php
  • index.php(login.php)
  • logincheck.php
  • dashboard.php
  • forgotpassword.php
  • resetpassword.php

Create a database called test. In the  test database, add a table called user. The users table will take the following six fields:

  • id
  • firstname
  • lastname
  • email
  • password
  • token

Now we create register.php. Where we form by which user can fill the details. The form have the following fields :

  • Firstname
  • Lastname
  • Email
  • Password
  • Register Button
Login and Registration

Register.php

for login we use index.php.
The form have the following fields :

  • email
  • password

index.php

login form

To check the login process we create loginCheck.php. In this it store the session of the user if user come again or reload the page it leads to dashboard .php

loginCheck.php

dashboard.php

Now we proceed the tutorial how we can get my password if i forgot.
When user forgot the password,User get a link by which a auto generated password is created as shown below

forget password

forgotpassword.php

For Reset Password We have to create a page called resetpassword.php

resetpassword.php

Conclusion: We provide you full source code above for User Login and Registration with Forgot Password