asp生成數(shù)字圖片驗證碼
來源:易賢網(wǎng) 閱讀:992 次 日期:2014-08-26 10:24:32
溫馨提示:易賢網(wǎng)小編為您整理了“asp生成數(shù)字圖片驗證碼”,方便廣大網(wǎng)友查閱!

查看效果:asp生成數(shù)字圖片驗證碼

下載地址:asp生成數(shù)字圖片驗證碼下載

在這個代碼中,用到了兩個文件,一個是head.fix,body.Fix

調(diào)用代碼:

<img src=numbercode.asp onclick="javascript:change();" alt="點擊變化" id="codeimg">

<script language="javascript">

function change(){

document.getElementById("codeimg").src='numbercode.asp';

}

</script>

圖片代碼:

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("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("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

更多信息請查看IT技術專欄

更多信息請查看網(wǎng)絡編程
易賢網(wǎng)手機網(wǎng)站地址:asp生成數(shù)字圖片驗證碼

2025國考·省考課程試聽報名

  • 報班類型
  • 姓名
  • 手機號
  • 驗證碼
關于我們 | 聯(lián)系我們 | 人才招聘 | 網(wǎng)站聲明 | 網(wǎng)站幫助 | 非正式的簡要咨詢 | 簡要咨詢須知 | 新媒體/短視頻平臺 | 手機站點 | 投訴建議
工業(yè)和信息化部備案號:滇ICP備2023014141號-1 云南省教育廳備案號:云教ICP備0901021 滇公網(wǎng)安備53010202001879號 人力資源服務許可證:(云)人服證字(2023)第0102001523號
聯(lián)系電話:0871-65099533/13759567129 獲取招聘考試信息及咨詢關注公眾號:hfpxwx
咨詢QQ:1093837350(9:00—18:00)版權所有:易賢網(wǎng)