Function: Create a picture format for the phone number in the page.
Copy Code code as follows:
<%
Call Com_creatvalidcode (Request.QueryString ("tel"))
Public Sub Com_creatvalidcode (Ptel)
'----------Prohibit caching
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 ' Probability of the occurrence of the miscellaneous points of the------------
Const str= "0123456789-"
StrLen = Len (Ptel)
Rndcolor = ChrB (CInt (rnd*255)) & ChrB (CInt (rnd*255)) & ChrB (CInt (rnd*255))
'-----------The color of the data (character, background)
Dim Vcolordata (1)
' Vcolordata (0) = ChrB (0) & ChrB (0) & ChrB (0) '----Blue 0, Green 0, Red 0 (black)
' Vcolordata (1) = ChrB (255) & ChrB (255) & ChrB (255) '----blue 250, green 236, red 211 (light blue)
' Vcolordata (0) = ChrB (197) & ChrB (0) & ChrB () '----blue 0, Green, Red 0 (black)
' Vcolordata (1) = ChrB (238) & ChrB (210) & ChrB (193) '-----Blue 250, green 236, red 211 (light blue)
Vcolordata (0) = ChrB (0) & ChrB (0) & ChrB (0) '---------Blue 0, Green 0, Red 0 (black)
Vcolordata (1) = ChrB (205) & ChrB (237) & ChrB (245) '------------Blue 250, green 236, red 211 (light blue)
'--------------------randomly generated characters
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
'------------character data
Dim Vnumberdata (11)
' Verdana Font
Vnumberdata (0) = "11111111111000111101110111011101110111011101110111011101110111011110001111111111"
Vnumberdata (1) = "11111111111101111110011111110111111101111111011111110111111101111110001111111111"
Vnumberdata (2) = "11111111111000111101110111011101111110111111011111101111110111111100000111111111"
Vnumberdata (3) = "11111111111000111101110111111101111100111111110111111101110111011110001111111111"
Vnumberdata (4) = "11111111111110111111001111101011111010111101101111100001111110111111100111111111"
Vnumberdata (5) = "11111111110000011101111111011111110000111111110111111101110111011110001111111111"
Vnumberdata (6) = "11111111111000111101101111011111110000111101110111011101110111011110001111111111"
Vnumberdata (7) = "11111111110000011101101111111011111101111111011111110111111101111111011111111111"
Vnumberdata (8) = "11111111111000111101110111011101111000111101110111011101110111011110001111111111"
Vnumberdata (9) = "11111111111000111101110111011101110111011110000111111101111011011110000111111111"
Vnumberdata (10) = "11111111111111111111111111111111111111111100000111111111111111111111111111111111"
Vnumberdata (11) = "11111111111111111111111111111111111111111111111111111111111111111111111111111111"
'-----------------output image file header <br>
Response.BinaryWrite ChrB (& ChrB) &CHRB ((strlen*8*10*3+54) mod 256)) & ChrB (((strlen*8*10*3+54) \ 256) mod 256) & ChrB (((strlen*8*10*3+54) 256) \256) mod 256) & ChrB ((((strlen*8*10*3+54) 256) \256) mod 256 ) & ChrB (0) & ChrB (0) &_
ChrB (0) & ChrB (0) & ChrB (a) & ChrB (0) & ChrB (0) & ChrB (0) & ChrB () & ChrB (0) &_
ChrB (0) & ChrB (0) & ChrB (strlen*8) & ChrB (0) & ChrB (0) & ChrB (0) & ChrB (a) & ChrB (0) &_
ChrB (0) & ChrB (0) & ChrB (1) & ChrB (0)
'------------------output Image information header
Response.BinaryWrite ChrB & ChrB (0) & ChrB (0) & ChrB (0) & ChrB (0) & ChrB (0) &_
ChrB ((strlen*8*10*3) mod 256) &CHRB (((strlen*8*10*3) \256) mod 256) &CHRB ((((strlen*8*10*3) \256) \256) mod 256) &CHRB ((((strlen*8*10*3) \256 \256) \256) mod 256) &_
ChrB (196) & ChrB (a) & ChrB (0) & ChrB (0) & ChrB (196) & ChrB (0) & &CHRB (0) ChrB
ChrB (0) & ChrB (0) & ChrB (0) & ChrB (0) & ChrB (0) & ChrB (0) & ChrB (0) & ChrB (0)
For i = 9 to 0 Step-1 '----------go through all the lines
For II = 0 to strLen-1 '-------after all the words
For III = 1 to 8 '--------after all the pixels
'---------output image data line by row, verbatim, and pixel-by-byte
If Rnd * + 1 < codds Then '---------randomly generated miscellaneous points
Response.BinaryWrite Rndcolor
Else
Response.BinaryWrite Vcolordata (Mid vnumberdata (Vcode (ii)), I * 8 + III, 1))
End If
Next
Next
Next
End Sub
%>
Demonstrate
Http://tools.jb51.net/telimg/index.asp
Index.asp content is
Copy Code code as follows: