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 trouble of switching the input method when users enter username, password verification code.
Friends who are interested can also expand it to other operations, such as multiplication, subtraction, multiplication, etc.
How to use: Save the following code as a Dv_GetCode.asp file and replace the file in the Dynamic Network forum. The background color and font color can be modified in the code.
Note: This program requires the website space to support ASPJpeg components and fonts of Kaiyi_GB2312.
In the future, I will publish a version that does not require component and font support. If you are interested, please follow my blog.
The code copy is as follows:
<%
'==============================================================================================================
'Dongwang Forum Addition Verification Code (ASPJpeg Version)
'Author: cuixiping
'Blog (CSDN): http://blog.csdn.net/cuixiping/
'Blog (Blog Park): http://www.cnblogs.com/cuixiping/
'Date: November 2008
'Create a 100x20 jpeg image verification code, the content is similar to "25+64 equal?"
'The website space requires support for the ASPJpeg component (Persits.Jpeg).
'If the server does not have the "KaiTi_GB2312" font, please modify it to another font and adjust the character position.
'Usage method: Replace the content in the Dv_GetCode.asp file of the Dynamic Network Forum, do not leave blank lines at the beginning and end of the file.
'==============================================================================================================
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
'No caching
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