| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 473 人关注过本帖
标题:大家帮忙看一下这个图片验证那里错了。
只看楼主 加入收藏
h527
Rank: 1
等 级:新手上路
帖 子:24
专家分:0
注 册:2006-6-29
收藏
 问题点数:0 回复次数:2 
大家帮忙看一下这个图片验证那里错了。

index.asp//

<img src="code.asp">

code.asp//


<%
Option Explicit
Response.buffer = True
NumCode (7) '注:1,4,7,10,13,16为彩色背景型 2,5,8,11,14,17为黑白型 3,6,9,12,15,18为噪点型
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("CheckCode") = listnum
'response.write session("checkcode")
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
%>

老是不能正常显示图片
是不是需要”head.fix“这些文件啊。如果是这个文件是怎么来的咯。谢谢1

[此贴子已经被作者于2007-2-9 10:56:00编辑过]

搜索更多相关主题的帖子: 验证 
2007-02-09 10:38
hangxj
Rank: 6Rank: 6
等 级:贵宾
威 望:29
帖 子:2045
专家分:0
注 册:2006-4-10
收藏
得分:0 
以下是引用h527在2007-2-9 10:38:44的发言:

index.asp//

<img src="code.asp">

code.asp//


<%
Option Explicit
Response.buffer = True
NumCode (7) '注:1,4,7,10,13,16为彩色背景型 2,5,8,11,14,17为黑白型 3,6,9,12,15,18为噪点型
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("CheckCode") = listnum
'response.write session("checkcode")
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
%>

老是不能正常显示图片
是不是需要”head.fix“这些文件啊。如果是这个文件是怎么来的咯。谢谢1



http://www./
2007-02-09 11:33
h527
Rank: 1
等 级:新手上路
帖 子:24
专家分:0
注 册:2006-6-29
收藏
得分:0 
什么意思,不明白?

2007-02-10 12:03
快速回复:大家帮忙看一下这个图片验证那里错了。
数据加载中...
 
   



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

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