复制代码 代码如下:
<%
Call Com_CreatValidCode(Request.QueryString("tel"))
Public Sub Com_CreatValidCode(pTel)
'----------禁止缓存
Response.Expires = 0
Response.AddHeader "Pragma","no-cache"
Response.AddHeader "cache-ctrol","no-cache"
Response.ContentType = "Image/BMP"
Randomize
Dim i, ii, iii ,rndColor,strLen,sql,rs
Const cOdds = 5 '------------杂点出现的机率
Const str="0123456789-"
strLen = len(pTel)
rndColor = ChrB(cint(rnd*255)) & ChrB(cint(rnd*255)) & ChrB(cint(rnd*255))
'-----------颜色的数据(字符,背景)
Dim vColorData(1)
'vColorData(0) = ChrB(0) & ChrB(0) & ChrB(0) '----蓝0,绿0,红0(黑色)
'vColorData(1) = ChrB(255) & ChrB(255) & ChrB(255) '----蓝250,绿236,红211(浅蓝色)
'vColorData(0) = ChrB(197) & ChrB(106) & ChrB(49) '---- 蓝0,绿0,红0(黑色)
'vColorData(1) = ChrB(238) & ChrB(210) & ChrB(193) '-----蓝250,绿236,红211(浅蓝色)
vColorData(0) = ChrB(0) & ChrB(0) & ChrB(0) '---------蓝0,绿0,红0(黑色)
vColorData(1) = ChrB(205) & ChrB(237) & ChrB(245) '------------蓝250,绿236,红211(浅蓝色)
'--------------------随机产生字符
Randomize
Dim vCode()
redim vCode(strLen-1)
For i = 0 To strLen-1
vCode(i) =instr(1,str,mid(pTel,i+1,1),1)-1
Next
'-----------字符的数据
Dim vNumberData(11)
内容版权声明:除非注明,否则皆为本站原创文章。