Watch Star Fork

XiaoSK / DB2PHPGPL-2.0

加入碼雲
與超過 200 萬 開發者一起發現、參與優秀開源項目,私有倉庫也完全免費 :)
免費加入
DB2 是 2013-2014 学年春季学期数据库实验。
一鍵複製 編輯 原始數據 按行查看 歷史
index.php 3.44 KB XiaoSK 提交於 2014-05-22 17:12 . Support Redis
<?php
require 'ctrl/conn.php';
$st = $dbc->prepare("select v from admin where k=? limit 1");
$st->bindValue(1,'term');
$st->execute();
$term = $st->fetchAll();
?>
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>上海大学选课系统</title>
<script type="text/javascript" src="static/jquery.min.js"></script>
<link rel="stylesheet" href="static/pure-min.css" />
<style type="text/css">
body {
background: url(static/bg.gif);
}
.login-box {
margin: 120px auto;
width: 440px;
box-shadow: 0 0 8px gray;
border-radius: 3px;
background: url(static/banner.jpg) top center no-repeat;
}
.season {
font: 26px/54px 微软雅黑;
margin:0 10px;
text-align: center;
}
.login-input {
border-bottom-left-radius: 3px;
border-bottom-right-radius: 3px;
padding: 15px 20px 20px 183px;
background: white url(static/shulogo.png) 3% center no-repeat;
}
.pure-input-1-2 {
width: 235px!important;
}
.list {
font: 16px 微软雅黑;
text-align: center;
margin: -6px 0px 8px;
}
.pure-form .pure-group input {
padding: 8px!important;
}
.captcha {
background: url(ctrl/Captcha.php) 95% center no-repeat;
}
#errmsg {
background: red;
text-align: center;
font: 16px/40px SimSun;
color: white;
visibility: hidden;
}
</style>
<script type="text/javascript">
function login() {
for(var i=0;i<3;i++)
if($("input")[i].value == '') {
$("input")[i].focus();
return;
}
$("button").unbind("click", login);
$("button").html("提交中...");
$.ajax({
type : "post",
url : "ctrl/login.php",
data : {
"idno": $("input")[0].value,
"pwd": $("input")[1].value,
"captcha": $("input")[2].value,
"who": $("input[type=radio]:checked").val()
},
async : false,
success : function(data){
if(data == '1') window.location.href='student.php';
if(data == '2') window.location.href='teacher.php';
if(data == '3') window.location.href='admincp.php';
$(".captcha").css("background", "url(ctrl/Captcha.php?t=" + new Date().getTime() + ") 95% center no-repeat");
if(data == '9') $("#errmsg").html("验证码错误!");
if(data == '0') $("#errmsg").html("非法的数据请求!");
if(data == '4') $("#errmsg").html("学号/工号或密码错误!");
$("button").html("登 录");
$("button").bind("click", login);
$("#errmsg").css('visibility','visible');
setTimeout(function(){
$("#errmsg").css('visibility','hidden');
},2345);
}
});
}
</script>
</head>
<body>
<div id="errmsg">
&nbsp;
</div>
<div class="login-box">
<div class="season">
<?=$term[0][0]?>选课系统
</div>
<div class="login-input">
<form class="pure-form">
<fieldset class="pure-group">
<input type="text" name="idno" placeholder="学号/工号" required value class="pure-input-1-2" maxlength="8" />
<input type="password" name="pwd" placeholder="密码" required value class="pure-input-1-2" />
<input type="text" name="captcha" placeholder="验证码" required value class="pure-input-1-2 captcha" maxlength="4" />
</fieldset>
<div class="list">
<label>
<input name="who" type="radio" value="1" checked>
学生 
</label>
<label>
<input name="who" type="radio" value="2">
教师 
</label>
<label>
<input name="who" type="radio" value="3">
管理
</label>
</div>
<button type="button" class="pure-button pure-input-1-2 pure-button-primary">登 录</button>
</form>
</div>
</div>
<script>
$(function() {
$("button").bind("click",login); //绑定登录处理事件
});
</script>
</body>
</html>

評論 ( 0 )

你可以在登錄後,發表評論

11_float_left_people 11_float_left_close