1 Star 1 Fork 0

xy_god / xblog

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
test.php 3.14 KB
一键复制 编辑 原始数据 按行查看 历史
xy_god 提交于 2016-01-05 00:54 . xx
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="./themes/default/js/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#form_login").submit(function(e){
return false;// 返回
});
$("#sub_form_login").click(function() {
$.post("service_login.php",{username : $("#username").val(), password : $("#password").val()}, function(data){
var s_html = "";
if (data.status == 0) {
s_html = "<div id=\"hello\" style=\"background:red;width:200px;height:24px;margin:auto;\">" + data.rtn_username;
s_html += "<input id=\"logout\" type=\"button\" value=\"退出\" onclick=\"logout();\" />" + "</div>";
$("#wrap_login").remove();
$("#area_login").append(s_html);
} else if (data.status == 1) {
s_html = "<div id=\"hello\" style=\"background:red;width:200px;height:24px;margin:auto;\">" + data.rtn_username + "</div>";
$("#wrap_login").remove();
$("#area_login").append(s_html);
} else if (data.status == 2) {
alert("请通过正规渠道登录本系统!");
} else if (data.status == 3) {
alert("用户:" + data.pre_username + " 已经登录。请勿重复登录。");
s_html = "<div id=\"hello\" style=\"background:red;width:200px;height:24px;margin:auto;\">" + data.rtn_username + "</div>";
$("#wrap_login").remove();
$("#area_login").append(s_html);
} else if (data.status == 4) {
alert("用户:" + data.pre_username + " 已经登录。请勿重复登录。");
s_html = "<div id=\"hello\" style=\"background:red;width:200px;height:24px;margin:auto;\">" + data.rtn_username + "</div>";
$("#wrap_login").remove();
$("#area_login").append(s_html);
}else if (data.status == 5) {
alert("验证失败,请重新输入!");
}else if (data.status == 6) {
alert("用户:" + data.pre_username + " 已经登录。请勿重复登录。");
s_html = "<div id=\"hello\" style=\"background:red;width:200px;height:24px;margin:auto;\">" + data.rtn_username + "</div>";
$("#wrap_login").remove();
$("#area_login").append(s_html);
}
}, 'json');
});
});
</script>
<title>符动乾坤 -- 测试代码</title>
</head>
<body>
<div id="area_login" style="width:420px;height:24px;margin:auto;">
<div id="wrap_login">
<form method="post" action="./service_login.php" id="form_login">
名称:&nbsp; <input type="text" id="username" name="username" style="width:128px;height:24px;margin:0;padding:0; border: solid black 1px;box-sizing:border-box;vertical-align:middle;border-right:1;" />
&nbsp;密码:&nbsp;&nbsp;<input type="password" id="password" name="password" style="width:128px;height:24px;margin:0;padding:0;border: solid black 1px;box-sizing:border-box;vertical-align:middle;border-right:1;" />
<input type="submit" value="提交" id="sub_form_login" style="width:48px;height:24px;margin:0;padding:0;border: solid black 1px;vertical-align:middle;" />
</form>
</div>
</div>
</body>
</html>
PHP
1
https://gitee.com/thesct/xblog.git
git@gitee.com:thesct/xblog.git
thesct
xblog
xblog
master

搜索帮助