| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 621 人关注过本帖
标题:[求助]帮我看看我的验证码,为什么用不了好吗?
取消只看楼主 加入收藏
虫子世界
Rank: 1
等 级:新手上路
帖 子:32
专家分:0
注 册:2009-10-15
结帖率:57.14%
收藏
已结贴  问题点数:20 回复次数:1 
[求助]帮我看看我的验证码,为什么用不了好吗?
以下是表单页面user.asp
      <form action="user_login.asp" method="post" name="login" id="login">
        <tr>
          <td height="20" align="right" class="title">用户名:</td>
          <td height="20" align="left"><input name="username" type="text" id="username" size="12" maxlength="50" /></td>
        </tr>
        <tr>
          <td height="10" align="right" class="title">密码:</td>
          <td height="10" align="left"><input name="userpow" type="text" id="userpow" size="12" maxlength="50" /></td>
        </tr>
        <tr>
          <td height="10" colspan="2" align="right" class="title">验证码:<input type="text" size="9" maxlength=="6" name="code"><img src="code.asp" align="absmiddle" onclick="this.src='code.asp?rndcode=' + Math.random();" style="cursor:pointer;" alt="看不清请点击更换!"> </td>
          </tr>
        <tr>
          <td height="20" colspan="2" align="center" valign="middle" class="title"><label>
            <input type="submit" name="button" id="button" value="提交">
          </label>
            &nbsp;&nbsp;&nbsp;&nbsp;<a href="user_apply.asp">注册</a></td>
        </tr>
      </form>

以下是验证码页面code.asp

<%
Option Explicit
Response.buffer = True
NumCode (1)   
Function NumCode(CodeType)
    Response.Expires = -1
    Response.AddHeader "Pragma", "no-cache"
    Response.AddHeader "cache-ctrol", "no-cache"
    On Error Resume Next
    Dim zNum, rNum, i, j, listnum, listcode
    Dim Ados, Ados1
    listcode = "0123456789abcdefghijklmnopqrstuvwxyz"
    Randomize Timer
    Dim zimg(6), NStr
    For i = 0 To 5
        rNum = CStr(CInt(35 * Rnd)) '将35改为9即为使用纯数字密码
        zimg(i) = rNum
        listnum = listnum & Mid(listcode, rNum + 1, 1)
    Next
    Session("ChkCode") = listnum
    Dim Pos
    Set Ados = Server.CreateObject("Adodb.Stream")
    Ados.Mode = 3
    Ados.Type = 1
    Ados.Open
    Set Ados1 = Server.CreateObject("Adodb.Stream")
    Ados1.Mode = 3
    Ados1.Type = 1
    Ados1.Open
    Ados.LoadFromFile (Server.mappath("body" & CodeType & ".Fix"))
    Ados1.write Ados.read(2880)
    For i = 0 To 5
        Ados.Position = (35 - zimg(i)) * 480
        Ados1.Position = i * 480
        Ados1.write Ados.read(480)
    Next
    Ados.LoadFromFile (Server.mappath("head.fix"))
    Pos = LenB(Ados.read())
    Ados.Position = Pos
    For i = 0 To 15 Step 1
        For j = 0 To 5
            Ados1.Position = i * 32 + j * 480
            Ados.Position = Pos + 30 * j + i * 270
            Ados.write Ados1.read(30)
        Next
    Next
    Response.ContentType = "image/BMP"
    Ados.Position = 0
    Response.BinaryWrite Ados.read()
    Ados.Close: Set Ados = Nothing
    Ados1.Close: Set Ados1 = Nothing
    'If Err Then Session("CheckCode") = "999999"
End Function
%>
body1.fix和Head.Fix文件我都有了。

以下是表单确认页面user_login.asp
<%
dim conn
set conn = Server.CreateObject("adodb.connection")
conn.open "driver={microsoft access driver (*.mdb)};dbq="&server.MapPath("../data/data.mdb")
 %>
<%
if Request("username")<>"" then
    sql="select * from userhao where username='" & trim(request("username")) & "' and userpow='" & replace(trim(request("userpow")),"'","''") & "'"
    'response.write sql
    'response.End
    set rs = conn.Execute(sql)
    if not (rs.eof or err) then
        session("username")=rs("username")
        session("userpow")=rs("userpow")
        session("uuserfirm")=rs("uuserfirm")
        session("useradd")=rs("useradd")
        session("usertel")=rs("usertel")
        session("userfax")=rs("userfax")
        session("email")=rs("email")
        session("oicq")=rs("oicq")
        session("userreason")=rs("userreason")
        session("tong")=rs("tong")
        a=rs("tong")
        response.redirect "index.asp"
    else
%>
    <script language=Javascript>
    alert("错误!请重新输入");
    window.history.go(-1);   
    </script>
<%end if%>
<%end if%>
搜索更多相关主题的帖子: 验证 
2009-10-30 13:56
虫子世界
Rank: 1
等 级:新手上路
帖 子:32
专家分:0
注 册:2009-10-15
收藏
得分:0 
可以帮我全部写出来吗?
2009-10-30 19:33
快速回复:[求助]帮我看看我的验证码,为什么用不了好吗?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.037958 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved