"stylesheet" href="http://blogbeta.blueidea.com/css/style.css" _fcksavedurl=""http://blogbeta.blueidea.com/css/style.css"" type="text/css">
<title>无标题文档</title>
<?php $xajax->printJavascrīpt(''inc/''); ?>
<scrīpt type="text/javascrīpt">
function submitSignup()
{
xajax.$(''submitButton'').disabled=true;
xajax.$(''submitButton'').value="http://blogbeta.blueidea.com/wait...";
xajax_processForm(xajax.getFormValues("signupForm"));
return false;
}
</scrīpt>
</head>
<body><form id="signupForm" action="javascrīpt:void(null);" ōnSubmit="submitSignup();">
<div id="main">
<div id="m1">用 户 登 陆</div>
<div id="formDiv">
<table width="100%" border="0" cellspacing="0" cellpadding="5">
<tr>
<td align="right"> </td>
<td> </td>
</tr>
<tr>
<td width="31%" align="right">用户名:</td>
<td width="69%"><input name="usr" type="text" id="usr" />
*</td>
</tr>
<tr>
<td align="right">密码:</td>
<td><input name="pwd" type="password" id="pwd" />
*</td>
</tr>
<tr align="center">
<td colspan="2"><input type="submit" name="submitButton" value="提交" class="button" />
<input type="reset" name="Submit2" value="重置" class="button" /></td>
</tr>
</table>
</div>
</div>
</form>
</body>
</html>
4、inc/login.php 登陆用的处理文件
复制代码 代码如下:
<?php
define (''XAJAX_DEFAULT_CHAR_ENCODING'', ''gb2312'' );
require_once("xajax.inc.php");
require_once("function.php");
$xajax = new xajax();
$xajax->registerFunction("processForm");
function processForm($aFormValues)
{
$objResponse = new xajaxResponse();
require_once("conn.php");
$usr=$aFormValues[''usr''];
$email=$aFormValues[''email''];
$pwd=$aFormValues[''pwd''];
$pw=Md5($pwd);
$errmsg="";
//要过滤的非法字符
$ArrFiltrate=array("''",";","union");
foreach($aFormValues as $key=>$value){
if (FunStringExist($value,$ArrFiltrate)){
$objResponse->addAlert("输入的信息含有非法字符\"'' ; union!\"");
$objResponse->addAssign("submitButton","value","继续");
$objResponse->addAssign("submitButton","disabled",false);
return $objResponse;
}
}
if (trim($usr) == "")
{
$errmsg.="请输入用户名!\n";
}
if (trim($pwd) == "")
{
$errmsg.="请输入密码!\n";
}
$sql="select * from zl_usr where zl_usr=''$usr'' and zl_pwd=''$pw''";
$result=mysql_query($sql,$db);
if(!$myrow=mysql_fetch_array($result)){
$errmsg.="用户名不存在,或密码错误!\n";
}
if ($errmsg=="")
{
$sForm = "登陆成功";
$objResponse->addAssign("formDiv","innerHTML",$sForm);
}
else
{
$objResponse->addAlert($errmsg);
$objResponse->addAssign("submitButton","value","继续");
$objResponse->addAssign("submitButton","disabled",false);
}
return $objResponse;
}
$xajax->processRequests();
?>
登陆于注册原理差不多,就不废话了:)
另外下面是两个用到的文件代码 conn.php function.php
conn.php
复制代码 代