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
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service