<%
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) (". /getcode/body. Fix "))
Ados1.write Ados.read (1280)
For I=0 to 3
ados.position= (9-zimg (i)) *320
ados1.position=i*320
Ados1.write Ados.read (320)
Next
Ados.loadfromfile (Server.MapPath) (". /getcode/head.fix "))
Pos=lenb (Ados.read ())
Ados.position=pos
For i=0 to 9 Step 1
For J=0 to 3
ados1.position=i*32+j*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
%>
Using the above code method
This is OK.
If you want to be random, take the RAND function behind you.