反SPAM新思路—换Z-BLOG的验证码!(2)
Const posX = 3 '位置随机范围X
Const posY = 2 '位置随机范围Y
ImgWidth = 60 '图像宽(要为4的倍数)
ImgHeight = 20 '图像高
Const cAmount = 10 '字库数量
Const cCode = "0123456789" '字库对应的字符
Const UnitWidth = 16 '字宽(要为4的倍数)
Const UnitHeight = 15 '字高
Const DotsLimit = 10 '每次删除有效点的上限(避免无法人为识别)
Const tryCount = 5 '避免删除有效点超过上限的尝试次数限制
'-----------
Randomize
Dim i,ii,iii,flag,ActUnitWidth,ImgYuWidth,codeLen,ImgWidth,ImgHeight
codeLen = codeLenMin + cint(Rnd*(codeLenMax-codeLenMin))
If ImgWidth Mod 4 <> 0 Or ImgWidth < codeLen*UnitWidth Then ImgWidth = codeLen*UnitWidth
If ImgHeight < UnitHeight Then ImgHeight = UnitHeight
' 禁止缓存
Response.Expires = -9999
Response.AddHeader "Pragma","no-cache"
Response.AddHeader "cache-ctrol","no-cache"
Response.ContentType = "Image/BMP"
' 颜色的数据(字符,背景)
内容版权声明:除非注明,否则皆为本站原创文章。