|
|
|
Simple Ajax Application
ajax_login_db.txt
|
-- Database: `ajax_login`
CREATE TABLE `admin_table` (
`admin_name` varchar(20) NOT NULL default '',
`admin_pwd` varchar(20) NOT NULL default '',
`name` varchar(20) NOT NULL default '',
`street` varchar(30) NOT NULL default '',
`city` varchar(30) NOT NULL default '',
`state` varchar(30) NOT NULL default '',
`country` varchar(30) NOT NULL default '',
`zip` int(10) NOT NULL default '0',
`email` varchar(40) NOT NULL default '',
`home` varchar(255) NOT NULL default '',
`admin_id` varchar(4) NOT NULL default '0',
PRIMARY KEY (`admin_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1; | |
CheckUser.php
| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Get Customer Data</title>
<?php
error_reporting(0);
$sID = $_REQUEST["id"];
$link = mysql_connect("localhost", "root", "");
mysql_select_db("ajax_login", $link);
$result = mysql_query("Select `admin_name` from admin_table where `admin_name`='$sID'" , $link);
$num_rows = mysql_num_rows($result);
if($num_rows>0) {
$sInfo = "Please enter ur Password ";
} else {
$sInfo = "Username $sID doesn't exist.";
}
mysql_close($link);
?>
</head>
<body>
<div id="divInfoToReturn" align="center">
<?php echo $sInfo; ?>
</div>
</body>
</html> | |
display.htm
| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Customer Account Information</title>
<script type="text/javascript">
var url = "CheckUser.php?id="; // The server-side script
var url_1 = "GetUserData.php?pid="; // The server-side script
function handleHttpResponse() {
if (http.readyState == 4) {
if(http.status==200) {
var results=http.responseText;
document.getElementById('divCustomerInfo').innerHTML = results;
}
}
}
function requestCustomerInfo() {
var sId = document.getElementById("txtCustomerId").value;
http.open("GET", url + escape(sId), true);
http.onreadystatechange = handleHttpResponse;
http.send(null);
}
function requestpwdinfo() {
var pId = document.getElementById("pwd").value;
http.open("GET", url_1 + escape(pId), true);
http.onreadystatechange = handleHttpResponse;
http.send(null);
}
function resetbut(){
document.getElementById("txtCustomerId").value='';
document.getElementById("pwd").value='';
}
function getHTTPObject() {
var xmlhttp;
if(window.XMLHttpRequest){
xmlhttp = new XMLHttpRequest();
}
else if (window.ActiveXObject){
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
if (!xmlhttp){
xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
}
}
return xmlhttp;
}
var http = getHTTPObject(); // We create the HTTP Object
</script>
<style type="text/css">
<!--
.style1 {color: #FFFFFF}
.style3 {
color: #333333;
font-weight: bold;
font-style: italic;
}
body {
background-color: #FFFFFF;
}
-->
</style>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head>
<body>
<table width="16%" height="62" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#D4D0C8">
<tr>
<td width="147" height="60" bgcolor="#D4D0C8"><div align="justify" id="divCustomerInfo" > </div>
<div align="center"></div></td>
</tr>
</table>
<p> </p>
<table width="343" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td colspan="5" bgcolor="#D4D0C8"><hr></td>
</tr>
<tr>
<td width="37" bgcolor="#D4D0C8"> </td>
<td width="97" bgcolor="#D4D0C8"> </td>
<td colspan="3" bgcolor="#D4D0C8"> </td>
</tr>
<tr>
<td bgcolor="#D4D0C8"> </td>
<td bgcolor="#D4D0C8"><span class="style3">Username</span></td>
<td colspan="2" bgcolor="#D4D0C8"><div align="center"><span class="style1">
<input name="text" type="text" id="txtCustomerId" value="" />
</span></div></td>
<td width="65" bgcolor="#D4D0C8"> </td>
</tr>
<tr>
<td bgcolor="#D4D0C8"> </td>
<td bgcolor="#D4D0C8"> </td>
<td colspan="2" bgcolor="#D4D0C8"> </td>
<td bgcolor="#D4D0C8"> </td>
</tr>
<tr>
<td bgcolor="#D4D0C8"> </td>
<td bgcolor="#D4D0C8"><strong><em>Password</em></strong></td>
<td colspan="2" bgcolor="#D4D0C8"><div align="center"><span class="style1">
<input type="password" name="textfield" id="pwd" onFocus="requestCustomerInfo()">
</span></div></td>
<td bgcolor="#D4D0C8"> </td>
</tr>
<tr>
<td bgcolor="#D4D0C8"> </td>
<td bgcolor="#D4D0C8"> </td>
<td colspan="3" bgcolor="#D4D0C8"> </td>
</tr>
<tr>
<td bgcolor="#D4D0C8"> </td>
<td bgcolor="#D4D0C8"> </td>
<td width="56" bgcolor="#D4D0C8"><input type="submit" name="Submit" onClick="requestpwdinfo()" value="Submit" ></td>
<td width="88" bgcolor="#D4D0C8"><input type="submit" name="Submit2" value="Reset" onClick="resetbut()"></td>
<td bgcolor="#D4D0C8"> </td>
</tr>
<tr>
<td bgcolor="#D4D0C8"> </td>
<td bgcolor="#D4D0C8"> </td>
<td colspan="3" bgcolor="#D4D0C8"> </td>
</tr>
<tr>
<td colspan="5" bgcolor="#D4D0C8"><hr></td>
</tr>
</table>
<p> </p>
</body>
</html> | |
GetUserData.php
| <?php
error_reporting(0);
$pID = $_REQUEST["pid"];
$link = mysql_connect("localhost", "root", "");
mysql_select_db("ajax_login", $link);
$result_1 = mysql_query("Select `admin_pwd` from admin_table where `admin_name`='$pID'" , $link);
$num_rows_1 = mysql_num_rows($result_1);
if($num_rows_1>0) {
$val_result = mysql_query("Select * from admin_table where `admin_name`='$pID'" , $link);
$Values = mysql_fetch_assoc($val_result);
$sInfo_1 = '
<table width="177" border="0" cellpadding="0" cellspacing="0">
<tr>
<td colspan="3" bgcolor="#D4D0C8"><hr /></td>
</tr>
<tr>
<td width="24" bgcolor="#D4D0C8"> </td>
<td width="84" bgcolor="#D4D0C8">Name</td>
<td width="124" bgcolor="#D4D0C8">'.$Values['name'].'</td>
</tr>
<tr>
<td bgcolor="#D4D0C8"> </td>
<td bgcolor="#D4D0C8">Street</td>
<td bgcolor="#D4D0C8">'.$Values['street'].'</td>
</tr>
<tr>
<td bgcolor="#D4D0C8"> </td>
<td bgcolor="#D4D0C8">City</td>
<td bgcolor="#D4D0C8">'.$Values['city'].'</td>
</tr>
<tr>
<td bgcolor="#D4D0C8"> </td>
<td bgcolor="#D4D0C8">State</td>
<td bgcolor="#D4D0C8">'.$Values['state'].'</td>
</tr>
<tr>
<td bgcolor="#D4D0C8"> </td>
<td bgcolor="#D4D0C8">Country</td>
<td bgcolor="#D4D0C8">'.$Values['country'].'</td>
</tr>
<tr>
<td bgcolor="#D4D0C8"> </td>
<td bgcolor="#D4D0C8">Zip</td>
<td bgcolor="#D4D0C8">'.$Values['zip'].'</td>
</tr>
<tr>
<td bgcolor="#D4D0C8"> </td>
<td bgcolor="#D4D0C8">Email</td>
<td bgcolor="#D4D0C8">'.$Values['email'].'</td>
</tr>
<tr>
<td colspan="3" bgcolor="#D4D0C8"><hr /></td>
</tr>
</table>';
} else {
$sInfo_1 = "Password incorrect.";
}
mysql_close($link);
?>
</head>
<body>
<div id="divInfoToReturn" align="center">
<?php echo $sInfo_1; ?>
</div>
</body>
</html> | | |
|
| AJAX Data Grid System using php and mysql. A complete login system with the ability to display data in a grid using ajax. Add , update and delete the records without reloading the page. Categories : PHP, AJAX, Databases, MySQL, Java Script | | | Ajax PHP Tree (Left and Right) with MySQL Categories : PHP, Databases, MySQL, AJAX, PHP Classes | | | Data Retrieve from Mysql using AJAX with PHP Categories : PHP, AJAX, Date Time, Databases, MySQL | | | bookmarker - PHP, PHPLIB, MySQL WWW based bookmark manager Categories : MySQL, PHP, MySQL, Complete Programs, Databases | | | This program allows you to upload an ODBC ressource - i.e. an MS-Access database to a MySQL server. Categories : Databases, MySQL, Complete Programs, PHP, Databases | | | Password reminder Categories : PHP, PHP Classes, Databases, MySQL, Mail | | | Identify and log search engine access (spiders, robots, etc.) to a page. Categories : HTTP, Environment Variables, PHP, MySQL, Databases | | | A simple script to count and report hits and the last
modification time of an HTML page. Requires MySQL support
(other DBs should work too, except possibly mSQL). Categories : HTTP, MySQL, PHP, Databases | | | The Ajax Tree view class fetches data from a db for the requested parent category id. The data is then stored in an array and converted into JSON (Javascript Object Notation) format. This format is then used by JavaScript for populating tree view. Categories : PHP, PHP Classes, Java Script, AJAX, Databases | | | create a grid out of <INPUT TYPE=TEXT> then saving to a database. Uses
a 'multi-dimension array', but not really as the array is just one big array
with the index of "[$i][$j]". Have a look at the code and you'll see what I
mean. Categories : PHP, MySQL, Arrays, Databases | | | php-gtk mysql querying tool Categories : PHP-GTK, MySQL, PHP, Databases | | | Simple function to return the number of days in a time span between 2 given dates. Categories : PHP, Date Time, MySQL, Databases | | | Specify your connection settings and create a link to a MySQL database. Categories : PHP, PHP Classes, Databases, MySQL, Beginner Guides | | | dynamic table columns Categories : PHP, HTML and PHP, Arrays, Databases, MySQL | | | mediaCat-GTK v2.0.0 - an mp3/cd/dvd cataloging utility written in php-gtk which interfaces with mysql and ms access (or db supported by PHP's Unified ODBC Functions) Categories : PHP, MySQL, MS Access, Utilities, Databases | |
|
|