【php开源代码栏目提醒】:以下是网学会员为您推荐的php开源代码-19_4.php,希望本篇文章对您学习有所帮助。
<?
//包含SAJAX代码
require("19_1.php");
//初始化SAJAX
//设置请求方式
$sajax_request_type = "GET";
//设置响应用户请求的
PHP脚本
$sajax_remote_uri = "19_5.php";
sajax_init();
//邦定客户端与服务器端脚本
s
ajax_export("checkLogin","userLogin","initData","updateUser","updatePassword");
sajax_handle_client_request();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD X
HTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html
xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>用户管理</title>
<script>
<?
//显示AJAX引擎代码
sajax_show_javascript();
?>
function checkLogin(){
x_checkLogin(checkLogin_cb);
}
function checkLogin_cb(z){
if(z=="false"){
alert("请登录!");
document.getElementById("login_div").style.display = "";
document.getElementById("user_div").style.display = "none";
document.getElementById("submit").disabled = false;
}
}
function userLogin(){
var username = document.getElementById("username").value;
var password = document.getElementById("password").value;
var code = document.getElementById("getcode").value;
document.getElementById("submit").disabled = true;
x_userLogin(username,password,code,userLogin_cb);
}
function userLogin_cb(z){
if(z == "true"){
alert("登录成功。");
initData();
document.getElementById("login_div").style.display = "none";
document.getElementById("user_div").style.display = "";
document.getElementById("password_div").style.display = "none";
document.getElementById("find_div_1").style.display = "none";
document.getElementById("find_div_2").style.display = "none";
}else{
document.getElementById("submit").disabled = false;
alert(z);
}
}
function initData(){
x_initData(initData_cb);
}
function initData_cb(z){
var user = eval('('+z+')');
document.getElementById("email").value = user.email;
document.getElementById("question").value = user.question;
if(user.sex == 1){
document.getElementById("boy").checked=true;
}else{
document.getElementById("girl").checked=true;
}
}
function userspan(){
document.getElementById("tab_user").className = "user_tabgroup";
document.getElementById("tab_password").className = "user_tabgroup_on";
document.getElementById("user_span").style.display = "";
document.getElementById("password_span").style.display = "none";
}
function passwordspan(){
document.getElementById("tab_user").className = "user_tabgroup_on";
document.getElementById("tab_password").className = "user_tabgroup";
document.getElementById("user_span").style.display = "none";
document.getElementById("password_span").style.display = "";
}
function updateUser(){
var sex = "";
var boy = document.getElementById("boy");
var girl = document.getElementById("girl");
if(boy.checked){
sex = boy.value;
}else{
sex = girl.value;
}
var email = document.getElementById("email").value;
document.getElementById("update_info").style.display = "";
x_updateUser(sex,email,updateUser_cb);
}
function updateUser_cb(){
initData();
document.getElementById("update_info").style.display = "none";
}
function updatePassword(){
var oldpwd = document.getElementById("oldpwd").value;
var pwd = document.getElementById("pwd").value;
var repwd = document.getElementById("repwd").value;
var question = document.getElementById("question").value;
var answer = document.getElementById("answer").value;
document.getElementById("update_info").style.display = "";
x_updatePassword(oldpwd,pwd,repwd,question,answer,updatePass
word_cb);
}
function updatePassword_cb(z){
alert(z);
checkLogin();
initData();
document.getElementById("update_info").style.display = "none";
}
</script>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body onload="checkLogin();">
<div id="update_info" style="left:0px;right:0px;display:none;margin-top:10px;padding:5px;margin-left:10px;width:200px;height:20px;border:8px solid #CCCCCC;color:#CC0000;border:1px solid #999999;text-align:center;z-index:-1;">
正在提交数据,清稍后...
</div>
<br>
<div id='login_div'>
<table cellpadding="5" cellspacing="0" align="cente