登陆判断的问题

河南浪人 2009-08-28 01:54:33
<%
if request.ServerVariables("REQUEST_METHOD")="POST" then
Name=trim(request("Name"))
pass=trim(request("pass"))
set rs=server.createobject("adodb.recordset")
sql="select * from yuangong where name='"&Name&"'"
rs.open sql,conn,1,3
if Rs.eof or Rs.bof then
word=Rs("pass")
if pass<>word then
response.write "<script>alert('你密码有错,请重新输入!您输入的密码为:"&pass&"');window.history.back(-1)</script>"
response.end
else
Rs("zhdl")=now()
rs.update
session("name")=rs("name")
session("zhiwu")=rs("zhiwu")
session("id")=Rs("id")
session("zhdl")=Rs("zhdl")
response.redirect "user/index.asp"

end if
else
response.write "<script>alert('用户名不存在,请重新输入!');window.history.back(-1)</script>"
response.end
end if
end if
%>



上面的代码 没法进行 用户名不存在的判断 给我郁闷死了
哪地方我写反了吗?
...全文
92 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
河南浪人 2009-09-21
  • 打赏
  • 举报
回复
真是谢谢各位大虾了
lsf5921 2009-08-30
  • 打赏
  • 举报
回复
rs.bof or rs.eof
两个都不可以拥有的条件你全部让他拥有
使用not rs.bof and not rs.eof就行
startnow_loison 2009-08-30
  • 打赏
  • 举报
回复
if Rs.eof or Rs.bof then 反了!是有记录才进去
「已注销」 2009-08-28
  • 打赏
  • 举报
回复
判断用户名和密码得顺序换一下!
plcc123 2009-08-28
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 hookee 的回复:]
Value是rs()记录默认属性, 明确表示取值的话,可以加.Value
[/Quote]

可以加 也可以不加.value
hookee 2009-08-28
  • 打赏
  • 举报
回复
Value是rs()记录默认属性, 明确表示取值的话,可以加.Value
河南浪人 2009-08-28
  • 打赏
  • 举报
回复
response.write "<script>alert('用户名不存在,请重新输入!');window.history.back(-1)</script>"
response.end
Rs.Close
conn.Close
这地方你多用了
end if
end if

Trim(Rs("pass").Value)
麻烦给讲解下 为什么要加 .value


其他问题已解决


hookee 2009-08-28
  • 打赏
  • 举报
回复

<%
if request.ServerVariables("REQUEST_METHOD")="POST" then
Name=trim(request("Name"))
pass=trim(request("pass"))
set rs=server.createobject("adodb.recordset")
sql="select * from yuangong where name='" & Name & "'"
rs.open sql,conn,1,1
if Not (Rs.eof and Rs.bof) then
word = Trim(Rs("pass").Value)
if pass<>word then
response.write "<script>alert('你密码有错,请重新输入!您输入的密码为:"&pass&"');window.history.back(-1)</script>"
response.end
else
Rs("zhdl")=now()
rs.update
session("name")=rs("name")
session("zhiwu")=rs("zhiwu")
session("id")=Rs("id")
session("zhdl")=Rs("zhdl")
Rs.Close
conn.Close
response.redirect "user/index.asp"
end if
else
response.write "<script>alert('用户名不存在,请重新输入!');window.history.back(-1)</script>"
response.end
Rs.Close
conn.Close
end if
end if
%>

28,406

社区成员

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

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