设为首页收藏本站

新微赢技术网

 找回密码
 注册
搜索
热搜: 回贴
查看: 53|回复: 1
打印 上一主题 下一主题

总是提示验证码错误!明明是对的

[复制链接]
跳转到指定楼层
1#
发表于 2010-1-17 05:09:01 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
相关代码:
<tr>
<td align="right">验证码:</td>
<td><input name="code" size="4"><%call getcode()%></td>
</tr>

提交验证部分:
<%
if instr(request("login_name"),"'")<>0 then
response.write "<script language=JavaScript>" & chr(13) & "alert('非法数据提交!');" & "history.back()" & "</script>"
Response.End
else
call CodeIsTrue("member.asp")
password1=md5(request("password1"))
if request("user")="1" then
exec="select id,login_name,password1 from register where login_name='"&request("login_name")&"'"
end if
if request("user")="2" then
exec="select id,login_name,password1,vip from regvip where login_name='"&request("login_name")&"'"
end if
rs.open exec,conn,1,1
if rs.eof and rs.bof then
response.write "<script language=JavaScript>" & chr(13) & "alert('用户名错误!');" & "history.back()" & "</script>"
rs.close
set rs=nothing
set conn=nothing
response.end
else
if password1<>rs("password1") then
response.write "<script language=JavaScript>" & chr(13) & "alert('密码错误!');" & "history.back()" & "</script>"
rs.close
set rs=nothing
set conn=nothing
response.end
else
if rs("login_name")<>"" then session("login_name")=rs("login_name")
session("vip")=false
session("id")=rs("id")
session("login_name")=rs("login_name")
session("user")=request("user")
rs.close
set rs=nothing
set conn=nothing
response.redirect "login.asp"
end if
end if
rs.close
set rs=nothing
set conn=nothing
end if
%>


<%
'以下为常用过程
public sub GetCode()
response.write "<img src=""getcode.asp"" alt= ""验证码,看不清楚?请点击刷新验证码"" style=""cursor : pointer;height : 20px;"" onclick=""this.src='getcode.asp'""/> "
end sub
public sub CodeIsTrue(b)
if CStr(Session("GetCode"))<>cstr(Trim(Request("Code"))) then
randomize
Session("GetCode")=rnd()
if b="" then
response.write "<script language=JavaScript>" & chr(13) & "alert('验证码错误,请刷新页面后重新输入!');" & "history.back()" & "</script>"
else
response.write "<script language=JavaScript>" & chr(13) & "alert('验证码错误,请确认重新输入!');"&"window.location.href = '"&b&"'"&" </script>" '验证码对的 也运行到这边
end if
Response.End
end if
end sub
%>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

申请友链|小黑屋|最新主题|手机版|新微赢技术网 ( 苏ICP备08020429号 )  

GMT+8, 2024-11-19 11:16 , Processed in 0.100091 second(s), 9 queries , Gzip On, Memcache On.

Powered by xuexi

© 2001-2013 HaiAn.Com.Cn Inc. 寰耽

快速回复 返回顶部 返回列表