Some additional forms are required for front-end users to submit in many website construction requirements. This allows you to collect, collect, analyze, and process more data. For example, online orders, online registration, and other common interactive applications.
The custom form function provided by DedeCMS can meet most of these requirements.
By adding a verification code to a custom form, you can prevent malicious submission by some users.
1. Go to the DedeCMS background to generate a custom form.
2. Add the verification code to the custom form template as follows:
| The code is as follows: |
Copy code |
<Input name = "validate" type = "text" id = "vdcode" style = "text-transform: uppercase;" size = "8"/>
<A href = "javascript: vide (-1);" onClick = "changeAuthCode ();"> can't see it clearly? </A> |
3. Add the JS code on the current page as follows:
| The code is as follows: |
Copy code |
<Script type = "text/javascript" language = "javascript"> // Verification code Function changeAuthCode (){ Var num = new Date (). getTime (); Var rand = Math. round (Math. random () * 10000 ); Num = num + rand; Certificate ('{ver_code'}.css ('Visibility ', 'visable '); If ($ ("# vdimgck") [0]) { $ ("# Vdimgck") [0]. src = "../include/vdimgck. php? Tag = "+ num; } Return false; } </Script> |
4. Modify the order processing page, open the website root directory/plus/diy. Php file, and add the verification code to around 61st lines. As follows:
| The code is as follows: |
Copy code |
If (! Empty ($ dede_fields )) { $ Validate = empty ($ validate )? '': Strtolower (trim ($ validate); $ svali = strtolower (GetCkVdValue ()); If ($ validate = ''| $ validate! = $ Svali) & preg_match ("/6/", $ safe_gdopen) {ResetVdValue (); ShowMsg ('verification code is incorrect! ', $ De_add ); Exit; }
|