There are many people who need it, and many people ask, and I remember replying in a post.
Now sort it out!
1. Download the file
imgchk.rar
The compressed package is an imgchk folder, which has three files: validatecode.asp, validatebody.fix, validatehead.fix
It is mainly used to generate verification codes.
Release the decompressed folder directly in the same directory where you need to add verification code on a certain page.
(For example, addnew.asp needs to add verification code. If the file is in the cnbruce folder, the imgchk folder will be released into the cnbruce folder at the same time)
2. Add display verification code and input box
Add the following code to the page where verification code needs to be added:
<inputname='validatecode'type='text'size='5'><imgsrc='imgchk/validatecode.asp'align='absmiddle'border='0'>
3. Record acceptance page processing
In step 2, the record will be submitted to a page for processing, so add the following code to the processing page:
IfTrim(Request.Form("validatecode"))=EmptyOrTrim(Session("cnbruce.com_ValidateCode"))<>Trim(Request.Form("validatecode")) Then
response.write("Please note that the verification code is entered correctly")
response.end
endif
Code copy box
IfTrim(Request.Form("validatecode"))=EmptyOrTrim(Session("cnbruce.com_ValidateCode"))<>Trim(Request.Form("validatecode")) Then
response.write("Please note that the verification code is entered correctly")
response.end
endif
[Ctrl+A Select all and copy]
Verification code principle:
When generating the verification code picture, a session is generated at the same time, and its value is the numeric value in the verification code picture.
At the same time, an input box is provided for the user to enter. After submitting the input value, it is compared with the existing Session value, and makes corresponding judgments based on the judgment results.
If you need to modify the Session name, there are only two changes:
a: The validatecode.asp in the imgchk folder you downloaded, which involves changing the cnbruce.com to yours;
b: In step 3 just now, cnbruce.com in Trim(Session("cnbruce.com_ValidateCode"))<>Trim(Request.Form("validatecode")) was replaced by a.
In addition=============================================================================================================================================================================================================================================================
Patch that displays the verification code (some friends cannot display the verification code, please take a look here)
Use the following content to create the file SP2.reg (it's OK with Notepad, select "Save As" when saving)
WindowsRegistryEditorVersion5.00
[HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/InternetExplorer/Security]
"BlockXBM"=dword:00000000
Double-click to import the registry and restart the machine