This article introduces the ASP implementation to the webpage to add the authentication code function, you may add this function in the registration form, the webpage comment and so on, the below view realizes the method:
First step: Download the attachment under this article. The compressed package is a Imgchk folder with three files: Validatecode.asp,validatebody.fixvalidatehead.fix
The main is to generate the authentication Code service.
Release the unzipped folder directly in the same directory where you need to add a captcha to a page (for example, addnew.asp needs to add a CAPTCHA, which is under the Cnbruce folder, the Imgchk folder is released to the Cnbruce folder at the same time)
Step Two: Add display verification code and input box
Add the following code to the page where you want to add the authentication code:
Step three: Record accept page processing
In step 2, you must submit the records to a page, and then add the following code to the processing page:
If Trim (Request.Form ("Validatecode")) =empty Or Trim (Session ("Cnbruce.com_validatecode")) <>trim (Request.Form ("Validatecode")) Then
Response.Write ("Please note the correct input of the verification Code")
Response.End
End If
Verification Code principle:
When you generate a CAPTCHA picture, a session is generated with the value of the numeric value in the Captcha picture.
At the same time, provide input box for user input, submit input value, compared with the existing session value, according to the judgment result make corresponding judgment.
If you need to modify the name of the session, only two places are changed:
A: You download the Imgchk folder in the validatecode.asp, which involves the cnbruce.com to your;
B: Just step 3 of the Trim (session ("Cnbruce.com_validatecode")) <>trim (Request.Form ("Validatecode")) The cnbruce.com in is changed to a set.
In addition ===================================================
Show the check code patch (some friends show no verification code, here to see)
Create a file Sp2.reg with the following content (Notepad, save As)
Windows Registry Editor Version 5.00
[Hkey_local_machinesoftwaremicrosoftinternet explorersecurity]
"BLOCKXBM" =dword:00000000
Double-click the Import registry, and then restart the machine.
All right, so far, the verification code has been added, you can try to register several account number of the experiment, the only bad thing is that if you do not enter the verification code point to determine the words will automatically go to another page, the font is good ugly, there are free kung fu people can be changed to pop-up prompts,
Response.Write ("")