Application Technique of addition verification Code for ASP

Source: Internet
Author: User

The

Changes the validation code to an addition operation, such as the verification code display "25+64 equals?" , then enter "91" to pass validation.
Look at the effect chart contrast: Character verification Code: → Addition Verification code:
Advantages:
① compared with the pure character verification Code, this procedure 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.
② with the Chinese authentication code, avoids the user to enter the user name password authentication code needs to switch input method trouble.
Description: This program requires web space to support AspJpeg components, italics _gb2312 fonts. The
code is as follows:

<% Const FONTCOLOR = &h000000 ' font Color const bgcolor = &AMP;HFFCCFF ' background color call Creatvalidcode ("GetCode") Sub CREATV Alidcode (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" Disables 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%>

The above is about ASP to implement the key code of the addition verification code, interested friends, can also be extended for other operations, such as multiplication, subtraction, and so on, I hope this article for everyone's learning help.

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.