>All Tutorials 
Ajax and .NET Ajax and .NET RSS XML
Ajax and ColdFusion Ajax and ColdFusion RSS XML
Ajax and Java Ajax and Java RSS XML
Ajax and PHP Ajax and PHP RSS XML
Ajax and SOA Ajax and SOA RSS XML
Ajax Goodies Ajax Goodies RSS XML
Ajax Tool Ajax Tool RSS XML
Facebook MockAjax Facebook MockAjax RSS XML
Google Web Toolkit Google Web Toolkit RSS XML
JavaScript Framework JavaScript Framework RSS XML
Ruby on Rails Ruby on Rails RSS XML
Technique Introduction Technique Introduction RSS XML
Without XMLHttpRequest Without XMLHttpRequest RSS XML
Yahoo! UI Yahoo! UI RSS XML

AJAX Login - ajax username login password session function php database

 
Registered tutorials: 501
Registered Users: 29843



Rating: 2.94 out of 34 votes cast


  
Category: Ajax and PHP

AJAX Login

Digg this   Post to del.icio.us

Abstract: Shows how to create a nice simple login script which uses POST to send the username and password entered to a PHP document, which then queries a MySQL database for a match.

It's a very simple example, and in the coming weeks I'll add further tutorials to expand this, such as a registration page, control panel to edit a user profile and an admin page to manage users. For the purpose of this entry however, i'll stick to a simple login feature.

If you are unfamiliar with AJAX, please see my AJAX search tool tutorial where I have explained how AJAX works. The JavaScript code used there, is very similar to that which I use in this example.

I will start by creating a function that creates and returns the XML HTTP object or ActiveX object that is required to implement AJAX. I have put this function in a separate file, so it can be accessed by different pages that use AJAX, instead of having to repeat the function body in every script.

JAVASCRIPT:
  1. function cl_xmlHttpObject () {
  2.  
  3.     var xml_http_object;
  4.    
  5.     try {
  6.         xml_http_object = new XMLHttpRequest();
  7.     } catch(e) {
  8.         try {
  9.             xml_http_object = new ActiveXObject("Msxml2.XMLHTTP");
  10.         } catch(e) {
  11.             try {
  12.                 xml_http_object = new ActiveXObject("Microsoft.XMLHTTP");
  13.             } catch(e) {
  14.                 //alert("ERROR: Your browser does not support AJAX.");
  15.                 return false;
  16.             }
  17.         }
  18.     }
  19.    
  20.     return xml_http_object;
  21.  
  22. }

    Read Full Tutorial...



Reviews:

Rate and Review This Site

No reviews yet


Statistic Information About this Resource:


Total Hits: 7454
Unique Hits: 5394


  Daily Weekly Monthly
  Unique Total Unique Total Unique Total
Average 17.8 28.5 120.2 188.4 369 528.4
Current 15 29 40 64 215 350
Previous 25 35 127 206 522 762
Oct 12 15 33 84 142 626 1031
Oct 11 17 30 128 191 615 954
Oct 10 18 23 140 187 636 854
Oct 9 16 24 115 170 0 0
Oct 8 20 30 103 152 615 757
Oct 7 18 36 158 240 402 507
Oct 6 23 30 161 280 59 69
Oct 5 11 15 146 252 0 0
Highest 38 61 165 280 636 1031


Script Execution Time: 0.34348 | SQL Queries: 10 | Members: 501
Ajax Tutorial Top List - Powered by Aardvark Topsites PHP 5.1.2