能执行,但是无论输入什么密码都是跳回登陆那页,为什么!

<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%
'判断用户是否提交表单
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>
[5769 byte] By [slhpig-小爱] at [2008-2-13]
# 1
555……,高手去哪里拉???
slhpig-小爱 at 2007-9-30 > top of Msdn China Tech,Web,ASP...
# 2
我不想看了,你贴那么多源码,那个想看嘛,贴精要的就是了嘛。
yinwenjie-java入门中 at 2007-9-30 > top of Msdn China Tech,Web,ASP...
# 3
只把检查跳转的帖出来啊.看晕了,都
sywj115447-樱木花道 at 2007-9-30 > top of Msdn China Tech,Web,ASP...
# 4
返回时的提示是什么?
hch686-寒窗 at 2007-9-30 > top of Msdn China Tech,Web,ASP...
# 5
<%
if TheMessage <> "登录不成功,请重试!" then
%>
是不是这里的问题
hch686-寒窗 at 2007-9-30 > top of Msdn China Tech,Web,ASP...
# 6
你的IF 。。。ELSE 。。。END IF 太多,太乱
一定在这里出问题了
sfply-随风飘零叶 at 2007-9-30 > top of Msdn China Tech,Web,ASP...
# 7
晕倒了!
liuyangxuan-阿轩 at 2007-9-30 > top of Msdn China Tech,Web,ASP...
# 8
instr是什么函数?
slhuang-★Shawn★ at 2007-9-30 > top of Msdn China Tech,Web,ASP...
# 9
InStr函数是返回一个字符串在另一字符串中首次出现的位置
slhuang-★Shawn★ at 2007-9-30 > top of Msdn China Tech,Web,ASP...
# 10
简单的看了你的程序
在这里有一句
TheUsername=Request.Form("Username")
ThePassword=Request.Form("Password")
然而你的用户名选择却是
<select name="usr">
输入密码是
<input type="password" name="pass">
也就是说,在检测用户名密码的时候TheUsername和ThePassword肯定为空,这样显然是无法完成登陆的。其他的太长了没看

lhzyn-无心睡眠 at 2007-9-30 > top of Msdn China Tech,Web,ASP...
# 11
是不是你的表单就是提交到本页?

你只要这么改就行:成功后response.Redirect("aa.asp")跳到你要打开的页面就可以了。
# 12
lhzyn(无心睡眠) 说的很有道理
hch686-寒窗 at 2007-9-30 > top of Msdn China Tech,Web,ASP...
# 13
几百个session 估计几个人访问你的网就慢吞吞的了。服务器真累
life360-wenjian at 2007-9-30 > top of Msdn China Tech,Web,ASP...
# 14
太乱了. 文件名也没贴上

看是不是这里有错误....

<%
if TheMessage <> "登录不成功,请重试!" then
%>
<form name="form1" method="post" action="manager1.asp "><%'查看manager2.asp中的代码%>
QZY2003-剑客飘红 at 2007-9-30 > top of Msdn China Tech,Web,ASP...
# 15
太多了
那有时间去看那
检主要的贴呀
truelzg-学无止境 at 2007-9-30 > top of Msdn China Tech,Web,ASP...
# 16
拜托,给点职业道德好吗??
这里不是检错的场所,是讨论的地方!
关键代码贴一下,主要问题说明就可以了,
你一贴代码走人,这算什么事!