Loading.......
Loading...

Secure Forgot Password System Using Ajax, Jquery and PHP

Posted on 29th October, 2025
PHP FORGOT PASSWORD SCRIPT MYSQL FORGOT PASSWORD SCRIPT PHP LOGIN SCRIPT MYSQL LOGIN SCRIPT PHP SIGN UP SCRIPT PHP REGISTRATION SCRIPT
This tutorial teaches you how to build a secure forgot password system or a complete login system with the forgot password feature without refreshing your website page using Ajax, Jquery and PHP.

This system is secure in the sense that, the users of your website have been given the privilege to set their private security questions and answers during their account creation process that they will later use, should they forget or lost their account passwords.

If a user of your website happens to lost or forget his account password, that user does not need to request for a new random generated password sent via his or her email box which is not secure because an attacker can intercept such messages and therefore gain access to the account of your user(s).

What this system does is to allow your users to set their private or secret questions and answers during their account creation so that, if a user forgets his or her password, all the user will do is to come to the login page of your website and click on the forgot password button, the system will then prompt the user to enter his or her account username.

After the user has provided his or her account username and clicks on the submit button, the system will now validate the submitted username to ensure that its valid and gets the secret question associated with the submitted username from the database for the user to answer it.

If the user answers the secret question correctly, access to change the password that is associated with the submitted username account will be given to this user otherwise this user will be denied access.

Users are given 6 chances to enter correct answer for their security questions during their reset password process after which the system will lock a user out for 30 minutes, should the user submit wrong security answer up to six times.

The system supports all browsers and the scripts are written in a way that any one can easily understand and customize with good programming code comments to ease usability.

To install the system on your server after you must have downloaded the zipped folder containing the required files, extract it to your system then, open the file named README.txt and follow the three steps instructions given in that file.

DATABASE CONNECTION

<?php
//Database Connection Details
define("HOST", 'localhost');     // The host you want to connect to.
define("USER", 'root');    		// The database username. 
define("PASSWORD", '');    		// The database password. 
define("DATABASE", 'demo');    // The database name.

$mysqli = mysqli_connect(HOST, USER, PASSWORD) or die("Unable to connect to MySQL Server: ". mysqli_connect_error());
mysqli_select_db($mysqli, DATABASE) or die("Unable to connect to Database: ". DATABASE);
?>

START


To see the system in action, please click on the Live Demo button below and download if you like what you see.
Post Comment
Press Enter to send
No comment yet.

Submit your Job or Project Today!

We can help you turn your idea into reality, take over your existing project, or extend your current development team.

Submit your idea job or project below and we will follow up with you shortly.

OUR OBJECTIVE

Our objective is to reach a place where our services will be highly regarded by businesses from various industrial domains for building their innovative busines solutions with our cutting-edge technological expertise, interactive designs and uncompromised quality.

OUR MISSION

We aspire to help businesses ranging from startups to enterprises, who reach out to us with their requirements, in achieving great lengths, expanding their reach, upscaling their products, and generate a large user-base with our outstanding and cost-effective services.

Please Wait....
Please Wait...