Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 在联系人表单7中实现垃圾邮件阻止_Php_Wordpress_Forms_Contact - Fatal编程技术网

Php 在联系人表单7中实现垃圾邮件阻止

Php 在联系人表单7中实现垃圾邮件阻止,php,wordpress,forms,contact,Php,Wordpress,Forms,Contact,我目前正在考虑在表单的前端和后端都添加一些代码,但我很难弄清楚如何做到这一点 这是前端代码 <li id="user"> <label for="username">Username</label> <input type="text" name="username"> </li> 用户名 我将不显示任何内容,并将其用作垃圾邮件机器人的蜜罐 但是,我需要实现的下一段代码是: <?php if( !isset($_POST['

我目前正在考虑在表单的前端和后端都添加一些代码,但我很难弄清楚如何做到这一点

这是前端代码

<li id="user"> <label for="username">Username</label> <input type="text" name="username"> </li> 
  • 用户名
  • 我将不显示任何内容,并将其用作垃圾邮件机器人的蜜罐

    但是,我需要实现的下一段代码是:

    <?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


    提前谢谢

    在/contact-form-7/includes/classes.php中,您可以添加代码并将其标记为垃圾邮件

    第432行,在函数spam()下添加与以下内容类似的行:

    if (isset($_POST['username'])) {
        $spam = true;
    }