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.