Dynamic Network Forum Verification Code improved addition verification code (AspJpeg version) _ Application techniques

Source: Internet
Author: User
Look at the effect chart contrast: Character verification Code: → Addition Verification Code:
Advantages:
① compared with the pure character verification Code, this program effect prevents the majority of (more than 99%) advertising machine automatic recognition. Even the Chinese verification code can be identified by some of the advertising machines in the market.
Compared with Chinese verification code, ② avoids the trouble of switching input method when users enter user name password verification code.
Interested friends can also be extended to other operations, such as multiplication, subtraction, exponentiation, and so on.
How to: Save the following code as a dv_getcode.asp file, replacing the Web forum's file. background colors, font colors can be modified in your code.
Description: This program requires web space to support AspJpeg components, italics _gb2312 fonts.
I will post a version that does not require the support of components and fonts, and interested people please pay attention to my blog.
Copy Code code as follows:

<%
'=============================================================================
' Dynamic Network 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
' Generate 100x20 JPEG image verification code, content similar to ' 25+64 equals? ”
' requires web space support for AspJpeg components (PERSITS.JPEG).
' If the server does not have a ' italic _gb2312 ' font, modify it to another font and adjust the character position.
' Usage: Replace this code with the contents of the dv_getcode.asp file of the dynamic Network forum, and do not leave the file blank.
'=============================================================================

Const fontcolor = &h000000 ' Font color
Const bgcolor = &AMP;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 = "Italics _gb2312"
. Font.Color = FontColor
. Printtext 4, 3, CSTR (x (0))
. Printtext 3, CSTR (x (1))
. Printtext, 3, X (6)
. Printtext, 3, CStr (x (2))
. Printtext, 3, CStr (x (3))
. Font.rotation = 15
. Printtext 55, 3, "et"
. Printtext 70, 3, "on"
. Printtext 85, 3, "? "
End With
' Disable 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
End Sub
%>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.