Ajax Login Example

In this program you will learn how to validate the user and show alert message if user name or password are not correct. These days almost all the e-comm applications requires authentication before accessing the secured part of the web site.

Search Tutorials:

Software Solutions and Services



Google Custom Search:


Advertise Here
Website Designing Services

Web Designing Packages From $150!

Website Designing Company Web Hosting

Website Designing Quotation
Ajax Login Program



In this program you will learn how to validate the user and show alert message if user name or password are not correct. These days almost all the e-comm applications requires authentication before accessing the secured part of the web site. In this program we will show how you can send ajax request to authenticate the user.

When a user input username and password and press Login button, 'call_login()' function is called. This method sends ajax request to server (login.php) to validate the user. We have hardcoded the authonication mechanism e.g. if you enter login name admin and password admin then the program will show you success message. Otherwise it will show login failed message. You can change the authentication logic in the page and easily authenticate use from database.

Example of Ajax login Program :
























Login
User
Name:
Password:









Here is the code for login.php page:
$username=$_GET["username"];
$password=$_GET["password"];
if($username=="admin" && $password=="admin"){
echo "yes";
}else{
echo "No";
}
?>

0 comments:

Post a Comment