The editor of the Error New Technology Channel will share with you the verification code function using ASP and refresh it. In fact, this code is very simple and practical. Friends in need can learn it with the editor of the Error New Technology Channel.
Change the verification code to an addition operation, for example, if the verification code shows "25+64 equals?", then enter "91" to pass the verification.
Let’s take a look at the rendering comparison: Character verification code: → Additive verification code:
advantage:
① Compared with pure character verification codes, this program prevents the automatic recognition of most (more than 99%) advertising machines. Even the Chinese verification code can be recognized by some advertising machines on the market.
② Compared with Chinese verification code, it avoids the hassle of switching the input method when users enter username, password verification code.
Note: This program requires the website space to support ASPJpeg components and fonts of Kaiyi_GB2312.
The code is as follows:
<%Const FontColor = &H000000 ' Font Color Const BgColor = &HFFCCFF ' Background Color 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 = "KaiTi_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, "etc" .PrintText 70, 3, "on" .PrintText 85, 3, "?" End With 'Cache 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 = NothingEnd Sub%>The above is the addition verification code for the key code implemented by ASP. Interested friends can also expand to other projects for operations, such as multiplication, subtraction, etc. I hope this article will be helpful to your study, and I hope you will continue to support the wrong new technology channel!