我目前正在考虑在我的表单的前端和后端添加一些代码,但我无法弄清楚如何这样做 .
这是前端代码
<li id="user"> <label for="username">Username</label> <input type="text" name="username"> </li>
我将不会显示任何内容,并将其用作垃圾邮件机器人的蜜 jar .
但是,我需要实现的下一部分代码是:
<?php if( !isset($_POST['name'])) { die("No Direct Access"); } // Make sure the form has actually been submitted
$name = $_POST['name'];
$email = $_POST['email'];
$spam = $_POST['username']; // This is our Honeypot field if($spam) { // If the Honeypot field has been filled in die("No spamming allowed bitch!"); }
else { // Process the form like normal } ?>
现在重点是$ name和$ email是联系表单7中的动态字段 . 我可以做些什么来使用这个脚本的联系表单7作为var?
提前致谢!
1 回答
在/contact-form-7/includes/classes.php中,如果需要,您可以添加代码并将其标记为垃圾邮件 .
函数spam()下的第432行添加了类似于以下内容的行: