高手看下这段代码错哪了?

叫我梁大侠 2010-06-02 11:14:50
<!-- #include file = "inc/conn.asp" -->
<%
admin_name=request("usern")
admin_password=request("password")
CheckCode = trim(request("CheckCode"))
set rw = server.CreateObject("adodb.recordset")
sql = "select * from admin where admin_name='"&admin_name&"' and admin_password='"&admin_password&"'"
rw.open sql,conn,1,1
if not (rw.eof and rw.bof) then
if CheckCode<>CStr(session("CheckCode")) then
response.Write"<script> alert('验证码输入不正确!');location.href='javascript:history.go(-1)'</script>"
else
response.Write"<script>alert('欢迎您进入我的博客!');location.href='index.asp'</script>"
response.End()
end if
end if
rw.close
set rw = nothing
set conn = nothing
%>
调试发现:什么都不会出现,错误也没
空白的
高手们指点下,如需要代码,我马上贴上,谢谢!
...全文
66 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
jerryong 2010-06-02
  • 打赏
  • 举报
回复
internet选项,高级,去掉友好的,选中显示所有错误,
验证码在最前验证
叫我梁大侠 2010-06-02
  • 打赏
  • 举报
回复

四楼是对的
可是后面还是错了
if not (rw.eof and rw.bof) then
改成
if rw.eof and rw.bof then
这杨就没错误了
还是谢谢你们
handy_wzh 2010-06-02
  • 打赏
  • 举报
回复
验证码应该是在之前校验

admin_name=request("usern")
admin_password=request("password")
CheckCode = trim(request("CheckCode"))

if CheckCode<>session("CheckCode") then
response.Write("<script language='javascript'>alert('验证码不正确');history.go(-1);</script>")
end if

set rw = server.CreateObject("adodb.recordset")
sql = "select * from admin where admin_name='"&admin_name&"' and admin_password='"&admin_password&"'"
rw.open sql,conn,1,1
if not (rw.eof and rw.bof) then
response.Write"<script>alert('欢迎您进入我的博客!');location.href='index.asp'</script>"
else
response.Write("<script language='javascript'>alert('用户名或密码不正确');history.go(-1);</script>")
end if
rw.close
set rw = nothing
set conn = nothing
%>
叫我梁大侠 2010-06-02
  • 打赏
  • 举报
回复
谢谢,可还是没用额
gingerkang 2010-06-02
  • 打赏
  • 举报
回复
location.href='javascript:history.go(-1) !!
检测到有问题需要及时response.end
验证码在先前校验,没有必要可能多的读取数据库.
还有注意一下注入的安全问题.
zw0578 2010-06-02
  • 打赏
  • 举报
回复
你把浏览器里面那个internet选项,高级,禁用脚步调试,去掉,就有提示了
叫我梁大侠 2010-06-02
  • 打赏
  • 举报
回复
[Quote=引用 8 楼 yunxiang_myx 的回复:]
if rw.eof and rw.bof then
这个的意思是记录集为空吧,
如果为空,后面的怎么。。。。。。
有点不明白?
有请高人解释下。
[/Quote]
if rw.eof and rw.bof then
表示数据表里面没有记录,既然没有记录,那用户名肯定是没注册的,所以失败
if not(rw.eof and rw.bof) then
表示数据表里面有记录,说明用户存在,如果密码正确就可以进入了 。
我也是高人指点的。
yunxiang_myx 2010-06-02
  • 打赏
  • 举报
回复
if rw.eof and rw.bof then
这个的意思是记录集为空吧,
如果为空,后面的怎么。。。。。。
有点不明白?
有请高人解释下。
KFCILIKEIT 2010-06-02
  • 打赏
  • 举报
回复
说明逻辑判断错误了啊

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧