Joke Collection Website - Blessing messages - How to write the verification code of ASP?
How to write the verification code of ASP?
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
- Previous article:A mobile phone more powerful than 12345.
- Next article:Wedding: How to write wedding invitation language and creative circle of friends?
- Related articles
- In The Romantic Journey of the Wife, Cherrie Ying was criticized by many people, and this outspoken person was set to collapse?
- Short message content of mortgage interest rate reduction
- Download a software for reading short messages by voice to a smart phone, so that the phone can read short messages by voice?
- How does Huawei 4x hide the contents of calls and short messages?
- How to confirm the online booking after success?
- Extend New Year greetings to women
- What advanced inventions have been realized in the film?
- Attractive real estate advertising template (selected 40 sentences)
- QQ| girl's head | screen name, personalized signature, space name and personal description. Very cute, the head is a real person's 1 1 year old girl's ~
- Friendship greetings of Dragon Boat Festival