| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 486 人关注过本帖
标题:验证码问题?
只看楼主 加入收藏
天上的星
Rank: 2
来 自:烟台
等 级:论坛游民
帖 子:57
专家分:21
注 册:2009-6-7
结帖率:47.06%
收藏
已结贴  问题点数:10 回复次数:6 
验证码问题?
我的验证码也能产生,但输入不正确也能登陆?
搜索更多相关主题的帖子: 验证 
2009-09-06 11:15
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
收藏
得分:3 
代码怎么写的?没代码怎么知道你哪写错了?
2009-09-06 12:03
天上的星
Rank: 2
来 自:烟台
等 级:论坛游民
帖 子:57
专家分:21
注 册:2009-6-7
收藏
得分:0 
有没有源文件大侠?
2009-09-07 09:43
aspic
Rank: 17Rank: 17Rank: 17Rank: 17Rank: 17
等 级:贵宾
威 望:51
帖 子:2258
专家分:8050
注 册:2008-2-18
收藏
得分:3 
是人家问你要 怎么反倒变成你问别人要了~你不是有问题吧 那就把你的代码贴出来呗
2009-09-07 10:02
limeng586aa
Rank: 1
等 级:新手上路
帖 子:12
专家分:3
注 册:2009-9-8
收藏
得分:3 
随机码验证
'以下保存在yzm.asp文件里
<%
Option Explicit
Response.Expires = 0
Response.AddHeader "Pragma","no-cache"
Response.AddHeader "cache-ctrol","no-cache"
Response.ContentType = "Image/BMP"
Randomize Timer
Dim Text_Data(9),Text_Len,Int_Temp(),I,j,k,Int_Temp2
''***** 参数配置区 *****
Text_Len = 4 ''验证码长度(支持1-25位)
''**********************
ReDim Int_Temp( Text_Len - 1 )
Text_Data(0) = "00000000000001111000001100110000110111000011011100001100110000111011000011101100001100110000011110000000000000"
Text_Data(1) = "00000000000000011000000011100000111110000000011000000001100000000110000000011000000001100000000110000000000000"
Text_Data(2) = "00000000000001111000001100110000110011000000001100000001100000001100000001100000001100000000111111000000000000"
Text_Data(3) = "00000000000001111000001100110000110011000000001100000011100000000011000011001100001100110000011110000000000000"
Text_Data(4) = "00000000000001100000000110000000011011000001101100000110110000110011000011111110000000110000000011000000000000"
Text_Data(5) = "00000000000011111100001100000000110000000011000000001111100000000011000000001100000001100000111100000000000000"
Text_Data(6) = "00000000000000111000000011000000011000000011111000001100110000110011000011001100001100110000011110000000000000"
Text_Data(7) = "00000000000011111100000000110000000110000000011000000011000000001100000001100000000110000000011000000000000000"
Text_Data(8) = "00000000000001111000001100110000110011000011101100000111100000110111000011001100001100110000011110000000000000"
Text_Data(9) = "00000000000001111000001100110000110011000011001100001100110000011111000000011000000011000000011100000000000000"
''下面随机生成各位验证码
Session("Num") = ""
For I = 0 To Text_Len - 1
Int_Temp(I) = Int(Rnd * 10)
Session("Num") = Session("Num") + Mid("0123456789",Int_Temp(I)+1,1)
Next
''下面输出文件头部分
Int_Temp2 = (Text_Len - 1) \ 4 * 220 + ((Text_Len - 1) / 4 - (Text_Len - 1) \ 4 * 4) * 44
Response.BinaryWrite ChrB(&H42) & ChrB(&H4D)
Response.BinaryWrite ChrB(((Int_Temp2 + 206) / 256 - (Int_Temp2 + 206) \ 256) * 256) & ChrB((Int_Temp2 + 206) \ 256) ''特殊位
Response.BinaryWrite ChrB(0) & ChrB(0) & ChrB(0) & ChrB(0) & ChrB(0) & ChrB(0) & ChrB(&H76) & ChrB(0) & ChrB(0) & ChrB(0) & ChrB(&H28) & ChrB(0) & ChrB(0) & ChrB(0)
Response.BinaryWrite ChrB(Text_Len * 10) ''特殊位
Response.BinaryWrite ChrB(0) & ChrB(0) & ChrB(0) & ChrB(&HB) & ChrB(0) & ChrB(0) & ChrB(0) & ChrB(&H1) & ChrB(0) & ChrB(&H4) & ChrB(0) & ChrB(0) & ChrB(0) & ChrB(0) & ChrB(0)
Response.BinaryWrite ChrB(((Int_Temp2 + 88) / 256 - (Int_Temp2 + 88) \ 256) * 256) & ChrB((Int_Temp2 + 88) \ 256) ''特殊位
Response.BinaryWrite ChrB(0) & ChrB(0) & ChrB(0) & ChrB(0) & ChrB(0) & ChrB(0) & ChrB(0) & ChrB(0) & ChrB(0) & ChrB(0) & ChrB(16) & ChrB(0) & ChrB(0) & ChrB(0) & ChrB(16) & ChrB(0) & ChrB(0) & ChrB(0) & ChrB(0) & ChrB(0) & ChrB(0) & ChrB(0) & ChrB(0) & ChrB(0) & ChrB(&H80) & ChrB(0) & ChrB(0) & ChrB(&H80) & ChrB(0) & ChrB(0) & ChrB(0) & ChrB(&H80) & ChrB(&H80) & ChrB(0) & ChrB(&H80) & ChrB(0) & ChrB(0) & ChrB(0) & ChrB(&H80) & ChrB(0) & ChrB(&H80) & ChrB(0)
Response.BinaryWrite ChrB(&H80) & ChrB(&H80) & ChrB(0) & ChrB(0) & ChrB(&H80) & ChrB(&H80) & ChrB(&H80) & ChrB(0) & ChrB(&HC0) & ChrB(&HC0) & ChrB(&HC0) & ChrB(0) & ChrB(0) & ChrB(0) & ChrB(&HFF) & ChrB(0) & ChrB(0) & ChrB(&HFF) & ChrB(0) & ChrB(0) & ChrB(0) & ChrB(&HFF) & ChrB(&HFF) & ChrB(0) & ChrB(&HFF) & ChrB(0) & ChrB(0) & ChrB(0) & ChrB(&HFF) & ChrB(0) & ChrB(&HFF) & ChrB(0) & ChrB(&HFF) & ChrB(&HFF) & ChrB(0) & ChrB(0) & ChrB(&HFF) & ChrB(&HFF) & ChrB(&HFF) & ChrB(0)
''下面输出图片数据
For i = 10 to 0 Step -1
For j = 0 to Text_Len - 1
For k = 1 to 9 Step 2
If Mid(Text_Data(Int_Temp(j)) , i * 10 + k , 1) = "0" Then Int_Temp2 = Get_BackColor() * 16 Else Int_Temp2 = Get_ForeColor() * 16
If Mid(Text_Data(Int_Temp(j)) , i * 10 + k + 1 , 1) = "0" Then Int_Temp2 = Int_Temp2 + Get_BackColor() Else Int_Temp2 = Int_Temp2 + Get_ForeColor()
Response.BinaryWrite ChrB(Int_Temp2)
Next
Next
Int_Temp2 = (Text_Len / 4 - Text_Len \ 4) * 4
Select Case Int_Temp2
Case 1
Response.BinaryWrite ChrB(0) & ChrB(0) & ChrB(0)
Case 2
Response.BinaryWrite ChrB(0) & ChrB(0)
Case 3
Response.BinaryWrite ChrB(0)
End Select
Next
Function Get_BackColor()
''得到一个背景色
If Int(Rnd * 30) = 0 Then ''注:此处的 Rnd * 30 是决定背景杂色的多少,值越大,则杂色越少,图片越容易看清楚
Get_BackColor = CInt(Mid("00021209",Int(Rnd * 4) * 2 + 1,2))
Else
Get_BackColor = CInt(Mid("081515151515",Int(Rnd * 6) * 2 + 1,2))
End If
End Function
Function Get_ForeColor()
''得到一个前景色
Get_ForeColor = CInt(Mid("00021209",Int(Rnd * 4) * 2 + 1,2))
End Function
%>

'以下引用页面

<input name="txt_check" type="text" size=16 maxlength=4 class="input">
                &nbsp;<img id="yzm" src="yzm.asp" onclick="document.getElementById('yzm').src='yzm.asp?pp='+ Math.random();"/>
'以下保存在校验的页面
<%
dim ErrorMessagetxt
txt=trim(request("txt_check"))
if  txt<>trim(session("Num"))  then
ErrorMessage = "请输入正确的验证码"
response.write(" <script>alert('"&ErrorMessage&"');location.href='login.asp';</script>")
else
ErrorMessage = "欢迎管理员"
response.write(" <script>alert('"&ErrorMessage&"');location.href='deault.asp';</script>")
end if
%>
2009-09-08 16:07
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
收藏
得分:0 
提交验证码的页面怎么写的?
2009-09-08 20:32
天籁1983
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2009-10-22
收藏
得分:0 
看不明白
2009-10-22 22:55
快速回复:验证码问题?
数据加载中...
 
   



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

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