The following is the function file for obtaining the verification code. Save the file as getcode. asp.
<%
Option explicit
Response. Buffer = true
Numcode
Function numcode ()
Response. expires =-1
Response. addheader "Pragma", "No-Cache"
Response. addheader "cache-ctrol", "No-Cache"
Dim znum, I, j
Dim Ados, ados1
Randomize Timer
Znum = CINT (8999 * RND + 1000)
Session ("getcode") = znum
Dim zimg (4), NSTR
NSTR = CSTR (znum)
For I = 0 to 3
Zimg (I) = CINT (mid (NSTR, I + 1, 1 ))
Next
Dim POS
Set Ados = server. Createobject ("ADODB. Stream ")
Ados. mode = 3
Ados. type = 1
Ados. Open
Set ados1 = server. Createobject ("ADODB. Stream ")
Ados1.mode = 3
Ados1.type = 1
Ados1.open
Ados. loadfromfile (server. mappath ("images/body. Fix "))
Ados1.write Ados. Read (1, 1280)
For I = 0 to 3
Ados. Position = (9-zimg (I) * 320
Ados1.position = I * 320
Ados1.write Ados. Read (1, 320)
Next
Ados. loadfromfile (server. mappath ("images/head. Fix "))
Pos = lenb (Ados. Read ())
Ados. Position = POS
For I = 0 to 9 Step 1
For J = 0 to 3
Ados1.position = I x 32 + J x 320
Ados. Position = POS + 30 * j + I * 120
Ados. Write ados1.read (30)
Next
Next
Response. contenttype = "image/BMP"
Ados. Position = 0
Response. binarywrite Ados. Read ()
Ados. Close: Set Ados = nothing
Ados1.close: Set ados1 = nothing
End Function
%>
Body. Fix and head. Fix are digital image files.
During verification, you can use SESSION ("getcode") to compare the content in the input box.
If the reader needs two files, body. Fix and head. Fix, you can leave the E-MAIL and I will send it to you.