ASP登录验证问题登录不了

来源:百度知道 编辑:UC知道 时间:2024/05/16 23:37:44
帮我看下下面的代码,那里出问题,怎么登录不了,

<!--#include file="conn.asp"-->
<!--#include file="../md5.asp"-->
<%dim admin,password,verifycode
admin=replace(trim(request("admin")),"'","")
password=md5(replace(trim(request("password")),"'",""))
verifycode=replace(trim(request("verifycode")),"'","")
if admin="" or password="" then
response.Write "<script LANGUAGE='javascript'>alert('您的管理ID或密码有误!');history.go(-1);</script>"
response.end
end if
if cstr(session("getcode"))<>cstr(trim(request("verifycode"))) then
response.Write "<script LANGUAGE='javascript'>alert('请输入正确的验证码!');history.go(-1);</script>"
response.end
end if

set rs=server.CreateObject("adodb.recordset&q

首先确定数据库存在你输入的管理ID或密码.

判断语句嵌套混乱
改下
set rs=server.CreateObject("adodb.recordset")
rs.Open "select * from xr_admin where admin='"&admin&"'",conn,1,1

if rs.Eof and rs.Bof then
response.write "<script LANGUAGE='javascript'>alert('管理员ID不存在!');history.go(-1);</script>"
response.end

elseif password<>rs("password") then
response.write "<script LANGUAGE='javascript'>alert('密码错误!');history.go(-1);</script>"
response.end

else
session("admin")=trim(rs("admin"))
session("flag")=int(rs("flag"))
session.Timeout=20
rs.Close
set rs=nothing
response.Redirect "index.asp"

end if

这样是不是清楚多了?

中毒 请给我分 谢谢

错误页面显示的是什么?