>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: 32529



Rating: 3.08 out of 40 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: 8479
Unique Hits: 6097


  Daily Weekly Monthly
  Unique Total Unique Total Unique Total
Average 17.8 27.2 87 129.5 439.3 630.9
Current 2 4 91 124 358 524
Previous 30 43 0 0 560 851
Nov 19 18 25 128 210 522 762
Nov 18 18 22 0 0 626 1031
Nov 17 23 30 118 163 615 954
Nov 16 14 17 0 0 636 854
Nov 15 19 32 125 174 0 0
Nov 14 19 36 137 197 615 757
Nov 13 20 39 144 221 402 507
Nov 12 15 24 127 206 59 69
Highest 38 61 165 280 636 1031


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