This article mainly introduces the implementation of ASP addition verification code, which is an innovation based on the original verification code, and changes the verification code to addition operation. Interested friends can refer to it.
Change the verification code to an addition operation, for example, the verification code shows that 25+64 is equal? , then input 91 can 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:
?
- <%
- ConstFontColor=&H000000'Font Color
- ConstBgColor=&HFFCCFF' Background Color
- CallCreatValidCode(GetCode)
- SubCreatValidCode(pSN)
- Dimx, 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))
- SetJpeg=Server.CreateObject(Persits.Jpeg)
- Jpeg.New100,20,BgColor
- Jpeg.Quality=100
- WithJpeg.Canvas
- .Font.Bold=True
- .Font.Size=16
- .Font.Rotation=0
- .Font.Family=KaiTi_GB2312
- .Font.Color=FontColor
- .PrintText4,3,CStr(x(0))
- .PrintText14,3,CStr(x(1))
- .PrintText26,3,x(6)
- .PrintText38,3,CStr(x(2))
- .PrintText48,3,CStr(x(3))
- .Font.Rotation=15
- .PrintText55,3, etc.
- .PrintText70,3,
- .PrintText85,3,?
- EndWith
- 'No caching
- Response.ContentType=image/jpeg
- Response.Expires=-9999
- Response.AddHeaderpragma,no-cache
- Response.AddHeadercache-ctrol,no-cache
- Response.AddHeaderContent-Disposition,inline;filename=vcode.jpg
- Jpeg.SendBinary
- Jpeg.Close
- SetJpeg=Nothing
- EndSub
- %>