80,349
社区成员
发帖
与我相关
我的任务
分享
<UINF>
<INF>0</INF>
<INF>S13*****</INF>
<INF>姓名^专业班级^入学时间</INF>
<INF>{***}{****}{*****}{N}~***学号***^@1$</INF>
</UINF>
function on_Login() { //验证数据的合法性
var ucode=document.getElementById('userCode');
var upwd=document.getElementById('passWord');
var utype;
if (document.getElementById('RadioButtonList1_0').checked) utype=document.getElementById('RadioButtonList1_0');
else if (document.getElementById('RadioButtonList1_1').checked) utype=document.getElementById('RadioButtonList1_1');
else if (document.getElementById('RadioButtonList1_2').checked) utype=document.getElementById('RadioButtonList1_2');
if (ucode.value == "" ) {
if (utype.value='S'){
alert("代码不能为空,请输入学号!");
}
else {alert("代码不能为空,请输入代码!");}
ucode.focus();
return false;
}
if (upwd.value == "") {
alert("密码不能为空,请输入密码!");
upwd.focus();
return false;
}
sendRequest("loginservlet?action=1&ucode="+ucode.value+"&upwd="+upwd.value+"&utype="+utype.value);
return true;
}
function sendRequest(url) {
var timenow = new Date().getTime();
createXMLHttpRequest();
XMLHttpReq.open("GET", url+"&d="+timenow, true);
XMLHttpReq.onreadystatechange = function(){
if (XMLHttpReq.readyState == 4) {
if (XMLHttpReq.status == 200) {
var info=XMLHttpReq.responseXML.getElementsByTagName('INF');
if (info[0].firstChild.data=='0') {
document.getElementById('userID').value=info[1].firstChild.data;
document.getElementById('userInfo').value=info[2].firstChild.data;
document.getElementById('userOther').value=info[3].firstChild.data;
window.onunload=null;
loginForm.submit();
}
else if (info[0].firstChild.data=='1') alert("代码或密码不正确!");
else if (info[0].firstChild.data=='2') alert("你欠学费,暂时不能使用!");
else if (info[0].firstChild.data=='3') alert("您非行政人员,不能使用!");
}
else {
alert("系统故障,请联系管理人员!");
}
}
}
XMLHttpReq.send(null);
}
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@page contentType="text/html; charset=GBK" session="false" isThreadSafe="true"%>
<%@page import="education.util.SysMessage"%>
<%@page import="education.util.TreeOther"%>
<%@page import="education.util.FunctionDeal"%>
<%
response.setHeader("Cache-Control","no-store");
response.setHeader("Expires","0");
response.setHeader("Pragma","no-cache");
response.setCharacterEncoding("GBK");
request.setCharacterEncoding("GBK");
String userID = (String) request.getParameter("userID");
String userOther = (String) request.getParameter("userOther");
if (userID == null || userOther==null) {
response.sendRedirect("login.html");
return;
}
else {
if (userID.charAt(0) != 'S' && userID.charAt(0) != 'T' && userID.charAt(0) != 'M') {
response.sendRedirect("login.html");
return;
}
}
FunctionDeal fd = new FunctionDeal();
String userInfo[] = fd.splitStr((String) request.getParameter("userInfo"), '^');
String userFile = new String("");
String usertree = new String("");
String userCode = fd.extractWord(1, userOther, '~', '^');
String userright = fd.extractWord(1, userOther, '@', '$');
String dp_sp_id =fd.extractWord(1, userOther, '{', '}');
int uid;
int dpid;
try {
uid = Integer.parseInt(userID.substring(2));
dpid = Integer.parseInt(dp_sp_id);
} catch (Exception e) {
response.sendRedirect("login.html");
return;
}
String dpcode_grade= fd.extractWord(2, userOther, '{', '}');
String fx= fd.extractWord(4, userOther, '{', '}');
userOther= fd.extractWord(3, userOther, '{', '}');
if (userID.charAt(0)=='S'){
usertree = SysMessage.getCourseTreeHtml()+SysMessage.getAddrTreeHtml()+SysMessage.getTPlanTreeHtml();
userFile = "student.html";
}
else {
TreeOther treeOther= new TreeOther();
if (userID.charAt(0)=='T'){
usertree = treeOther.createTeacherCourseMenu(uid).toString()+SysMessage.getTPlanTreeHtml();
userFile = "teacher.html";
}
if (userID.charAt(0)=='M'){
usertree = treeOther.createDepartmentMenu(dpid).toString()+treeOther.createStudentMenu(dpid).toString()+SysMessage.getAddrTreeHtml()+SysMessage.getTPlanTreeHtml();
userFile = "manager.html";
}
treeOther = null;
}
%>