Weaving Dream Dedecms website to customize the form plus Dede template to bring the verification code method.

Source: Internet
Author: User

Sometimes we prevent malicious filling out of form submissions because we need to add a verification code to a custom form for the Dede site.

We can use the following methods to achieve:

First, we're going to find/plus/diy.php this file.

Introduce files in the head:

Require_once (dedeinc. ' /membermodel.cls.php ');

And then find

ElseIf ($do = = 2)

{Add code blocks to this place

Verification Code Verification

$svali = Getckvdvalue ();

if (Preg_match ("/1/", $safe _gdopen)) {

if (Strtolower ($vdcode)! = $svali | | $svali = = ")

{

Resetvdvalue ();

ShowMsg (' Verification code Error! ', '-1 ');

Exit ();

}

}

Save the file after you have modified it.

Step two: Insert a code block in a custom form static page that uses a CAPTCHA

<input type= "text" class= "Intxt w200" style= "width:50px; text-transform:uppercase; "id=" Vdcode "name=" Vdcode "class=" code "/>

can't see clearly?

In this static page, you still have to quote jquery.

Add JS code block again

<script type= "Text/javascript" >
$ = jQuery;
function Changeauthcode () {
var num = new Date (). GetTime ();
var rand = Math.Round (math.random () * 10000);
num = num + rand;
$ (' #ver_code '). CSS (' visibility ', ' visible ');
if ($ ("#vdimgck") [0]) {
$ ("#vdimgck") [0].SRC =]: /include/vdimgck.php?tag= "+ num;
}
return false;
}
</script>

OK, now try, is it possible to implement the verification code submission? A simple dedecms custom form dede template comes with a verification code function.

Generally encounter a 172th line of error, because a "}" only need to add one on line 172 OK.

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.