Joke Collection Website - Blessing messages - How to write the verification code of ASP?

How to write the verification code of ASP?

Because of the character restriction, it is difficult to paste the code, and the program that generates the verification code cannot paste it. Please tell me your email address and I will send you an email.

The following is a complete verification code generation program to generate a picture.

Then you can call this picture on other pages.

The calling process is as follows:

& lttd colspan = 2 & gt? & ltspan class="new "> verification code:

& ltinput name = " verify code " type = text id = " verify code " >& ltimg src = verifycode.asp & gt& lt/TD & gt;

The verification code generator cannot paste.

You can save the program at the following address, named verifycode.asp.

& lt%

Option explicit

Response.buffer=true

digital code

Function NumCode ()

Response. Expiration time =-1

Response. AddHeader "miscellaneous note", "no cache"

Response. AddHeader "cache-ctrol "," no-cache "

dim zNum,I,j

dim Ados,Ados 1

Randomized timer

zNum = cint(8999*Rnd+ 1000)

Session("verifycode") = zNum

dim zimg(4),NStr

NStr=cstr (zinc)

For i=0 to 3

zimg(i)=cint(mid(NStr,i+ 1, 1))

then

Dimming position

Set Ados = server. CreateObject("Adodb。 Stream ")

Ados. Mode =3

Ados. Type= 1

Ados. open

Set ados 1 = server. CreateObject("Adodb。 Stream ")

Ados 1。 Mode =3

Ados 1。 Type= 1

Ados 1。 open

Ados. LoadFromFile(server . mappath(" comm/body。 Fix "))

ados 1 . write ados . read( 1280)

For i=0 to 3

Ados. Location =(9-zimg(i))*320

Ados 1。 Location =i*320

Ados 1.write ados.read(320)

then

Ados. LoadFromFile(server . mappath(" comm/head . fix "))

Pos=lenb(Ados.read())

Ados. Position = position

For i=0 to 9 steps 1

For j=0 to 3

Ados 1。 Location =i*32+j*320

Ados. Location =Pos+30*j+i* 120

Ados.write ados 1.read(30)

then

then

Response. ContentType = "image/BMP "

Ados. Location =0

Response. BinaryWrite Ados.read()

Ados. Close: set Ados=nothing.

Ados 1。 Off: set ados 1 = none.

End function

% & gt