📄 login.asp
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="Connections/conn.asp" -->
<!--#include file="inc/md5.asp" -->
<!--#include file="global.asp" -->
<%
Dim rs
If (CStr(Request("MM_login")) <> "") Then
If Request("userright")="user" AND isNumeric(Request("cardno"))=false Then
freshTo "用户名不存在或密码不正确!请重新登陆系统!","login.asp"
End If
If Request("userright")="user" Then
sql = "SELECT cardno,name,lock FROM Borrowers WHERE "
sql = sql & " cardno=" & Replace(Request.Form("cardno"), "'", "''")
sql = sql & " AND passwd='" & md5(Request.Form("passwd"), 16) & "'"
Else
sql = "SELECT * FROM admin WHERE "
sql = sql & " name='" & Replace(Request.Form("cardno"), "'", "''") & "'"
sql = sql & " AND passwd='" & md5(Request.Form("passwd"), 16) & "'"
End If
Set rs=executeQuery(sql)
If Not rs.EOF Or Not rs.BOF Then
If Request("userright")="user" Then
If rs("lock")=1 Then
addLog "user",rs("name")&"("&rs("cardno")&")","登陆系统失败,因为帐号被锁定。"
freshTo "用户名已被管理员锁定!请速与管理员联系!","login.asp"
End If
Session("userright")="user"
Session("cardno")=CINT(rs("cardno"))
Session("username")=rs("name")
addLog "","","用户登陆系统"
Response.Redirect("main.asp")
Else
Session("userright")="admin"
Session("userid")=rs("id")
Session("username")=rs("name")
addLog "","","用户登陆系统"
Response.Redirect("main.asp")
End If
Else
Dim action
action = "以用户名“"&Replace(Request.Form("cardno"), "'", "''")&"”"
action = action & "和密码“"&Replace(Request.Form("passwd"), "'", "''")&"”"
action = action & "以“"&Replace(Request.Form("userright"), "'", "''")&"”的身份"
action = action & "登陆系统失败"
addLog "未知","游客",action
freshTo "用户名不存在或密码不正确!请重新登陆系统!","login.asp"
End if
rs.Close
End If
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>图书管理系统</title>
<script language="JavaScript" type="text/JavaScript">
<!--
function ChangeUserType()
{
if (document.all("userright").value=='admin' )
{
msg.innerHTML ="<FONT color=#000000>管理帐号:</font>"
}
else
{
msg.innerHTML ="<FONT color=#000000>借书卡号:</font>"
}
}
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_validateForm() { //v4.0
var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
if (val) { nm=val.name; if ((val=val.value)!="") {
if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
} else if (test!='R') { num = parseFloat(val);
if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
min=test.substring(8,p); max=test.substring(p+1);
if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
} } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
} if (errors) alert('The following error(s) occurred:\n'+errors);
document.MM_returnValue = (errors == '');
}
//-->
</script>
<link href="images/style.css" rel="stylesheet" type="text/css">
</head>
<body>
<p> </p>
<p> </p>
<p> </p>
<form name="form1" method="POST" action="<%=MM_editAction%>" onSubmit="MM_validateForm('cardno','','R','passwd','','R');return document.MM_returnValue">
<table bgcolor="#FFFFFF" width="97%" cellpadding="0" cellspacing="0" border="0" align="center">
<tr>
<td><br> <table cellspacing="0" cellpadding="0" border="0" width="97%" align="center" style="table-layout: fixed">
<tr>
<td class="nav" width="90%" nowrap> <a href="<%= systemurl %>"><%= systemname %></a> » 登陆提示</td>
<td align="right" width="10%"> </td>
</tr>
</table>
<br>
<div align="center" onClick="MM_validateForm('cardno','','R','passwd','','R');return document.MM_returnValue">
</div>
<table width="70%" border="0" align="center" cellpadding="4" cellspacing="1" bgcolor="#333333">
<tr>
<td width="12%" bgcolor="#f8f8f8"><img src="images/face.gif" width="250" height="160"></td>
<td width="88%" bgcolor="#f8f8f8">
<table width="100%" height="160" border="0" align="left" cellpadding="4" cellspacing="1" bgcolor="#333333">
<tr bgcolor="#FFFFFF" class="header">
<td height="26" colspan="2"><strong>用户登陆</strong></td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="30%" nowrap bgcolor="#F8F8F8"> <div id=msg><font color="#000000">借书卡号:</font></div></td>
<td><font color="#000000">
<input name="cardno" type="text" id="cardno2">
</font></td>
</tr>
<tr bgcolor="#FFFFFF">
<td nowrap bgcolor="#F8F8F8"><font color="#000000">密码:</font></td>
<td><font color="#000000">
<input name="passwd" type="password" id="passwd2">
</font></td>
</tr>
<tr bgcolor="#FFFFFF">
<td nowrap bgcolor="#F8F8F8"><font color="#000000">类别:</font></td>
<td><select name="userright" id="select" onChange="javascript:ChangeUserType();">
<option value="user" selected>普通用户</option>
<option value="admin">管理员</option>
</select></td>
</tr>
</table></td>
</tr>
</table>
<p align="center">
<input type="submit" name="Submit" value="登陆系统">
<input type="reset" name="Reset" value="重新填写">
</p>
<br>
<br> <br></td>
</tr>
</table>
<p>
<input type="hidden" name="MM_login" value="form1">
</p>
</form>
<p><% showFoot() %></p>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -