欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

ASP實(shí)現(xiàn)加法驗(yàn)證碼

 更新時(shí)間:2015年10月28日 11:54:46   投稿:lijiao  
這篇文章主要介紹了ASP實(shí)現(xiàn)加法驗(yàn)證碼,是在原來的驗(yàn)證碼基礎(chǔ)上進(jìn)行創(chuàng)新,將驗(yàn)證碼改為加法運(yùn)算,感興趣的小伙伴們可以參考一下

將驗(yàn)證碼改為加法運(yùn)算,比如驗(yàn)證碼顯示“25+64等于?”,那么輸入“91”就能通過驗(yàn)證。
來看看效果圖對(duì)比:字符驗(yàn)證碼: → 加法驗(yàn)證碼:
優(yōu)點(diǎn):
①與純字符驗(yàn)證碼相比,本程序效防止了絕大部分(99%以上)廣告機(jī)的自動(dòng)識(shí)別。即使是中文驗(yàn)證碼, 也能被市面上的部分廣告機(jī)識(shí)別。
②與中文驗(yàn)證碼相比,避免了用戶輸入用戶名密碼驗(yàn)證碼的時(shí)候需要切換輸入法的麻煩。
說明:該程序需要網(wǎng)站空間支持ASPJpeg組件、楷體_GB2312字體。
代碼如下:

<%
Const FontColor = &H000000 ' 字體顏色
Const BgColor = &HFFCCFF ' 背景顏色
Call CreatValidCode("GetCode")
Sub CreatValidCode(pSN)
  Dim x, Jpeg
  Randomize
  x = Array(1+Int(Rnd()*9), Int(Rnd()*10), 1+Int(Rnd()*9), Int(Rnd()*10), 0, 0, "+")
  x(4) = x(0)*10 + x(1)
  x(5) = x(2)*10 + x(3)
  'Session(pSN) = CStr(Eval(x(4) & x(6) & x(5)))
  Session(pSN) = CStr(x(4) + x(5))
  Set Jpeg = Server.CreateObject("Persits.Jpeg")
  Jpeg.New 100,20,BgColor
  Jpeg.Quality=100
  With Jpeg.Canvas
    .Font.Bold = True
    .Font.Size = 16
    .Font.Rotation = 0
    .Font.Family = "楷體_GB2312"
    .Font.Color = FontColor
    .PrintText 4, 3, CStr(x(0))
    .PrintText 14, 3, CStr(x(1))
    .PrintText 26, 3, x(6)
    .PrintText 38, 3, CStr(x(2))
    .PrintText 48, 3, CStr(x(3))
    .Font.Rotation = 15
    .PrintText 55, 3, "等"
    .PrintText 70, 3, "于"
    .PrintText 85, 3, "?"
  End With
  '禁止緩存
  Response.ContentType = "image/jpeg"
  Response.Expires = -9999
  Response.AddHeader "pragma", "no-cache"
  Response.AddHeader "cache-ctrol", "no-cache"
  Response.AddHeader "Content-Disposition","inline; filename=vcode.jpg"
  Jpeg.SendBinary
  Jpeg.Close
  Set Jpeg = Nothing
End Sub
%>

以上就是關(guān)于asp實(shí)現(xiàn)加法驗(yàn)證碼的關(guān)鍵代碼,有興趣的朋友,還可以擴(kuò)展為其他的運(yùn)算,比如乘法,減法,乘方等,希望本文對(duì)大家的學(xué)習(xí)有所幫助。

相關(guān)文章

最新評(píng)論