|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
Windows本身的所有问题都会一成不变的也累加到了它的身上。安全性、稳定性、跨平台性都会因为与NT的捆绑而显现出来;考证码一样平常,你能够看到一些考证码图片便是云云/
为何必要考证码
无效避免某个黑客对某一个特定注册用户,用特定程序暴力破解体例举行不休的上岸实验,即避免暴力注册/穷取暗码/服务器回绝等大概影响网站一般运转的举动。
考证码的运转机制是甚么
在随机发生考证码的同时天生了一Session,然后经由过程表单递交数据与Session中保留的考证码举行对照,准确即考证码经由过程,不然堕落提醒。
1,XBM文件
这是一个很复杂的显现XBM图片的例子,数字掩码是次要。
<%@Language=javascript%>
<%
//一个最复杂的例子
//可普遍使用于计数器、时钟等任何必要静态天生图形的中央
//经由过程改动ContentType的值,好比改成"image/gif"能够作出更大度的图形
Response.ContentType="image/x-xbitmap";
Response.Write("#definecounter_width8
");//图形宽
Response.Write("#definecounter_height10
");//图形高
Response.Write("staticunsignedcharcounter_bits[]={
");
Response.Write("0x3c,0x66,0x60,0x60,0x30,0x18,0x0c,0x06,0x06,0x7e");//2的掩码
Response.Write("};
");
%>
2,口角XBM随机考证码(原张三疯)
xbm.asp:次要感化,随机显现四位考证码,同时发生Session("validateCode")
<p><!--#includefile="numcode.asp"-->
<%
Response.Buffer=True
WithResponse
.Expires=-1
.AddHeader"Pragma","no-cache"
.AddHeader"cache-ctrol","no-cache"
EndWith
Dimnum
Randomize
num=Int(7999*Rnd+2000)
Session("validateCode")=num
DimImage
DimWidth,Height
Dimdigtal
DimLength
Dimsort
Dimhc
Length=4
hc=chr(13)&chr(10)
Redimsort(Length)
digital=""
ForI=1ToLength-Len(num)
digital=digital&"0"
Next
ForI=1ToLen(num)
digital=digital&Mid(num,I,1)
Next
ForI=1ToLen(digital)
sort(I)=Mid(digital,I,1)
Next
Width=8*Len(digital)
Height=10
Response.ContentType="image/x-xbitmap"
Image="#definecounter_width"&Width&hc
Image=Image&"#definecounter_height"&Height&hc
Image=Image&"staticunsignedcharcounter_bits[]={"&hc
ForI=1ToHeight
ForJ=1ToLength
Image=Image&a(sort(J),I)&","
Next
Next
Image=Left(Image,Len(Image)-1)
Image=Image&"};"&hc
Response.WriteImage
%>
<p>
个中包括文件<!--#includefile="numcode.asp"-->的次要内容就是数字的掩码
numcode.asp
<p><%
Dima(10,10)
a(0,1)="0x3c"数字0
a(0,2)="0x66"
a(0,3)="0xc3"
a(0,4)="0xc3"
a(0,5)="0xc3"
a(0,6)="0xc3"
a(0,7)="0xc3"
a(0,8)="0xc3"
a(0,9)="0x66"
a(0,10)="0x3c"
a(1,1)="0x18"数字1
a(1,2)="0x1c"
a(1,3)="0x18"
a(1,4)="0x18"
a(1,5)="0x18"
a(1,6)="0x18"
a(1,7)="0x18"
a(1,8)="0x18"
a(1,9)="0x18"
a(0,10)="0x7e"
a(2,1)="0x3c"数字2
a(2,2)="0x66"
a(2,3)="0x60"
a(2,4)="0x60"
a(2,5)="0x30"
a(2,6)="0x18"
a(2,7)="0x0c"
a(2,8)="0x06"
a(2,9)="0x06"
a(2,10)="0x7e"
a(3,1)="0x3c"数字3
a(3,2)="0x66"
a(3,3)="0xc0"
a(3,4)="0x60"
a(3,5)="0x1c"
a(3,6)="0x60"
a(3,7)="0xc0"
a(3,8)="0xc0"
a(3,9)="0x66"
a(3,10)="0x38"
a(4,1)="0x38"数字4
a(4,2)="0x3c"
a(4,3)="0x36"
a(4,4)="0x33"
a(4,5)="0x33"
a(4,6)="0x33"
a(4,7)="0xff"
a(4,8)="0x30"
a(4,9)="0x30"
a(4,10)="0xfe"
a(5,1)="0xfe"数字5
a(5,2)="0xfe"
a(5,3)="0x06"
a(5,4)="0x06"
a(5,5)="0x3e"
a(5,6)="0x60"
a(5,7)="0xc0"
a(5,8)="0xc3"
a(5,9)="0x66"
a(5,10)="0x3c"
a(6,1)="0x60"数字6
a(6,2)="0x30"
a(6,3)="0x18"
a(6,4)="0x0c"
a(6,5)="0x3e"
a(6,6)="0x63"
a(6,7)="0xc3"
a(6,8)="0xc3"
a(6,9)="0x66"
a(6,10)="0x3c"
a(7,1)="0xff"数字7
a(7,2)="0xc0"
a(7,3)="0x60"
a(7,4)="0x30"
a(7,5)="0x18"
a(7,6)="0x18"
a(7,7)="0x18"
a(7,8)="0x18"
a(7,9)="0x18"
a(7,10)="0x18"
a(8,1)="0x3c"数字8
a(8,2)="0x66"
a(8,3)="0xc3"
a(8,4)="0x66"
a(8,5)="0x3c"
a(8,6)="0x66"
a(8,7)="0xc3"
a(8,8)="0xc3"
a(8,9)="0x66"
a(8,10)="0x3c"
a(9,1)="0x3c"数字9
a(9,2)="0x66"
a(9,3)="0xc3"
a(9,4)="0xc3"
a(9,5)="0x66"
a(9,6)="0x3c"
a(9,7)="0x18"
a(9,8)="0x0c"
a(9,9)="0x06"
a(9,10)="0x03"
%>
<p>
以下举行的援用,保留为img.asp
<p><%
yznum=trim(request.form("yznum"))
ifyznum""then
ifint(Session("validateCode"))=int(yznum)then
response.write("true")
else
response.write("false")
endif
else
response.write("你没有输出考证码")
endif
%>
<formaction=img.aspmethod=post>
<imgsrc="xbm.asp">
<inputname="yznum">
<inputtype=submitname=submit1value=GOIT>
</form>
专业性的服务。有的ASP商提供垂直型的应用服务,针对某一特定行业提供应用服务。 |
|