Ados.LoadFromFile(Server.mappath("body.Fix"))
Ados1.write Ados.read(1280)
'第一個for迴圈,按產生的隨機數字順序從 10X100的數字陣列中提取出相應的四個數字,但是豎排的數字陣列
for i=0 to 3
Ados.Position=(9-zimg(i))*320
Ados1.Position=i*320
Ados1.write ados.read(320)
next
'清空已經用完的ADOS的資料,調入替換新的映像頭54位元組的標頭檔
Ados.LoadFromFile(Server.mappath("head.fix"))
Pos=lenb(Ados.read())
Ados.Position=Pos ' 指定Pos位置,即可再位移54位元組的位置添加圖形資料,第二個for迴圈,進行數位陣列變換,由豎排的塊轉換為橫排的數字塊,方法是隔320位元組抽取4次30位元組寫入ados對象,再抽取位移第二行的映像資料,30位元組是因為bmp 寬大於長時無00 00的行結束標記
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
Ados.Position=0
response.BinaryWrite '直接向用戶端發送映像資料
Response.ContentType = "image/BMP"
Response.BinaryWrite Ados.read()
Ados.Close:set Ados=nothing
Ados1.Close:set Ados1=nothing
End Function
處理頁:
--------chklogin.asp--------
<%
dim GetCode,valicode
GetCode=int(request("GetCode")
valicode=int(Session("GetCode")
if GetCode<>valicode then
response.write ("驗證碼輸入錯誤,請重輸入")
response.end
end if
%>