能执行,但是无论输入什么密码都是跳回登陆那页,为什么!
<%
'判断用户是否提交表单
if isempty(Request.Form("Login")) then
Session.abandon
Session("NumAttempts") = 1
'TheMessage = "请在下面登录本系统:"
else
Dim constr, conn
connstr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("chuzu.asp")
Set conn = Server.CreateObject("ADODB.Connection")
conn.open connstr
TheUsername=Request.Form("Username")
ThePassword=Request.Form("Password")
'<2> 连接数据库进行身份验证
If Instr(TheUsername, "'")=0 and Instr(ThePassword, "'")=0 and Instr(TheUsername, "'")=0 _
and Instr(ThePassword, "'")=0 then
set RSLogin = conn.Execute("select * from managers where " & "ID = '" _
& TheUsername & "' and " & "password = '" & ThePassword & "'")
'<3> 登录失败处理
if RSLogin.EOF then
Session("NumAttempts") = Session("NumAttempts") + 1
if Application("NumAttempts") = 0 then
TheMessage = "登录不成功,请重试!"
elseif Session("NumAttempts") > Application("NumAttempts") then
TheMessage = "登录不成功,登录次数已满,无法重试!"
else
TheTimes=Application("NumAttempts")-Session("NumAttempts")+1
TheMessage = "登录不成功,还有" & TheTimes & "次机会,请重试!"
end if
else
'登录成功
Session("ID") = RSLogin("LoginID")
Application("ID") = RSLogin("LoginID")
Session("managename") = RSLogin("managename")
Session("password") = RSLogin("password")
Session("department") = RSLogin("department")
Session("E-MAIL")=RSLogin("E-MAIL")
Session("internalPhone")=RSLogin("internalPhone")
' Session("HomePhone")=RSLogin("HomePhone")
Session("mobilePhone")=RSLogin("mobilePhone")
Session("QQ")=RSLogin("QQ")
' Session("Birthday")=RSLogin("Birthday")
' Session("HomeAddress")=RSLogin("HomeAddress")
Session("isfinancial")=RSLogin("isfinancial")
Session("isbusiness")=RSLogin("isbusiness")
Response.Redirect "manager2.asp"
end if
else
TheMessage="用户名或者密码输入不合格式"
end if
end if
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>管理登陆页</title>
<style type="text/css">
<!--
a {
text-decoration: none;
}
-->
</style>
</head>
<body leftmargin="0" topmargin="0">
<table width="99%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="98"><img src="%B1%CF%D2%B5%C9%E8%BC%C6%D3%C3%B5%C4%BB%AD/ASPLogo33.png" width="756" height="89"></td>
</tr>
</table>
<table width="99%" height="10" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#0099FF">
<tr>
<td bgcolor="#FFFFFF"><img src="%B1%CF%D2%B5%C9%E8%BC%C6%D3%C3%B5%C4%BB%AD/line1.jpg" width="765" height="8"></td>
</tr>
</table>
<table width="99%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="15" bgcolor="#66CCFF"><a href="index.asp"><font size="2">返回首页</font></a></td>
</tr>
</table>
<table width="99%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="16" bgcolor="#f2f8ff">
<p align="left"><font size="2">内部办公管理系统>>登陆首页</font></p>
</td>
</tr>
</table>
<hr align="center" width="760">
<table width="99%" height="236" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="29%" height="23"> </td>
<td width="42%"><font size="2">请在下面登陆本系统:</font></td>
<td width="29%"> </td>
</tr>
<tr>
<td height="120"> </td>
<%
if TheMessage <> "登录不成功,请重试!" then
%>
<form name="form1" method="post" action="manager1.asp "><%'查看manager2.asp中的代码%>
<td><table width="101%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="33">
<div align="left"><font size="2">管理员ID :</font>
<select name="usr">
<option>01</option>
<option>02</option>
<option>03</option>
<option>04</option>
</select>
</div>
</td>
</tr>
<tr>
<td height="37"><div align="left"><font size="2">密码:</font>
<input type="password" name="pass">
</div>
</td>
</tr>
</table>
<table width="456" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="125"><div align="right">
<input name="login" type="submit" id="login" value="登陆">
</div></td>
<td width="26"> </td>
<td width="305"><input name="reset" type="submit" id="reset" value="重设"></td>
</tr>
</table> </td>
<td> </td></form>
<%
end if
%>
</tr>
<tr>
<td height="89"> </td>
<td> </td>
<td> </td>
</tr>
</table>
</body>
</html>

