There are many people who need it, and many people have asked, I remember a detailed reply in a post.
Now, sort it out!
1. Download an object
Imgchk.rar
The compressed package is an imgchk folder, which has three files: validatecode. asp, validatebody. fix, validatehead. fix
This service is mainly used to generate verification codes.
Release the decompressed folder directly to the same directory where you need to add verification codes on a page.
(For example, you need to add a verification code to addnew. asp. If the file is in the cnbruce folder, The imgchk folder will be released to the cnbruce folder at the same time)
2. Add the verification code and input box
Add the following code to the page where you want to add a verification code:
<Input name = 'validatecode' type = 'text' size = '5'>
3. Record acceptance page processing
In step 2, the record will be submitted to a page for processing, 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 that the verification code is entered correctly ")
Response. end
End if
Code copy box
If Trim (Request. Form ("validatecode") = Empty Or Trim (Session ("cnbruce.com _ ValidateCode") <> Trim (Request. Form ("validatecode") Then
Response. write ("Please note that the verification code is entered correctly ")
Response. end
End if
[Ctrl + A select all and copy]
Verification Code principle:
When a verification code image is generated, a Session is generated at the same time. The value is the numerical value in the verification code image.
In addition, the input box is provided for the user to input. After the input value is submitted, it is compared with the existing Session value and determined based on the judgment result.
If you need to modify the Session name, there are only two changes:
A: The validatecode. asp file in the imgchk folder you downloaded involves modifying cnbruce.com to yours;
B: Switch cnbruce.com in Trim (Session ("cnbruce.com _ ValidateCode") <> Trim (Request. Form ("validatecode") in step 3 to the one set by.
In addition ==================================
Patch for displaying Verification Code (some friends do not display the verification code. Let's take a look)
Use the following content to create the file SP2.reg (you can use NotePad to save the file by selecting "Save ")
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Internet Explorer \ Security]
"BlockXBM" = dword: 00000000
Double-click to import the registry, and restart the machine.