// Original: www.111cn.net
Note: For reprint, please indicate www.111cn.net
//
The following describes the methods for generating and verifying asp Programs.
<%
Option Explicit
Response. buffer = true
NumCode
Dim znum
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 ("ver") = znum' write the verification code to the SESSION
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 ("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 ("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
%>
On the page to be called, set aaa.htm to ,
During verification, you must determine whether the user input is equal to the session ("ver.