Production and use of verification code (ASP)

xiaoxiao2021-03-06  13

Below is a function file for obtaining a verification code, saving the file as getCode.asp

<% Option ExplicitResponse.buffer = trueNumCodeFunction 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") ads.mode = 3 ads.type = 1 ads.open set ados1 = server.createObject ("AdoDb.Stream ") ADOS1.MODE = 3 ADOS1.TYPE = 1 adoS1.Open ads.loadfromfile (server.mappath (" images / body.fix ")) ADOS1.WRITE ADOS.READ (1280) for i = 0 to 3 ads.position = (9-zimg (i)) * 320 adoS1.position = i * 320 adoS1.write ads.read (320) Next adoAdFromFile (server.mappath ("images / head.fix") POS = lenb (ADOS) .read ()) apos.position = POS for i = 0 to 9 step 1 for j = 0 to 3 adoS1.position = i * 32 j * 320 ads.position = POS 30 * J i * 120 ADOS. Write adoS1.read (30) Next Next response.contentType = "image / bmp" adoS.position = 0 response.binaryWrite ads.read () ads.close: set adoS = Nothing adoS1.close: set adoS1 = nothingend function%>

Among them, Body.fix and Head.fix are digital image files

Get the verification code such as

When verifying, you can compare the content ("getcode") and content within the input box.

If the reader needs Body.fix and Head.fix 2 files, you can leave E-mail, I will send you past

转载请注明原文地址:https://www.9cbs.com/read-48479.html

New Post(0)