2017-10-31 2 views
0

Ich versuche, ein verstecktes Feld zu platzieren, um einige Webform-Spam einzuschränken.Nicht sicher, wo ich mein honeytrap PHP-Skript platzieren soll

So, hier ist das versteckte Feld, das ich zu meiner Form hinzufügen werden:

<label for="humans" class="humans">Human check: Leave this field empty</label> 
<input type="text" name="humans" id="humans" class="humans" /> 

Und hier ist die CSS:

.humans { display: none; } 

Und hier ist die PHP:

<?php 

if(!empty($_POST['humans'])) { 
    // it's spam 
} else { 
    // it's human 
} 

?> 

Meine Frage ist - ich dachte, ich könnte die Schaltfläche "Senden" in der 'else' Selektor platzieren, aber es macht das Markup ungültig.

Hier ist meine Form:

  <form class="form-view theme7" id="agile-form" action="https://xxx.agilecrm.com/formsubmit" style="max-width:100%;" method="GET" > 

       <fieldset> 

        <!-- Form Name --> 
        <legend class="agile-hide-formname"><?php the_field('agile_form_name'); ?></legend> 

        <p style="padding-top:50px;">Speaking Opportunities | Ticket Discounts | Early Bird Deals</p> 

        <!-- <p class="agile-form-description"></p> --> 
        <div style="display: none; height: 0px; width: 0px;"> 
         <input type="hidden" id="_agile_form_name" name="_agile_form_name" value="<?php the_field('agile_form_name'); ?>"> 
         <input type="hidden" id="_agile_domain" name="_agile_domain" value="xxxx"> 
         <input type="hidden" id="_agile_api" name="_agile_api" value="xxxx"> 
         <input type="hidden" id="_agile_redirect_url" name="_agile_redirect_url" value="<?php the_field('agile_thank_you_page_url'); ?>"> 
         <input type="hidden" id="_agile_document_url" name="_agile_document_url" value=""> 
         <input type="hidden" id="_agile_confirmation_msg" name="_agile_confirmation_msg" value="Great! Thanks for filling out the form."> 
         <input type="hidden" id="_agile_form_id_tags" name="tags" value="<?php the_field('agile_tags'); ?>"> 
         <input type="hidden" id="_agile_form_id" name="_agile_form_id" value="<?php the_field('agile_form_value'); ?>"> 
        </div> 

<label for="humans" class="humans">Human check: Leave this field empty</label> 
<input type="text" name="humans" id="humans" class="humans" /> 

        <!-- Text input--> 
        <div class="agile-group required-control"> 
         <!-- <label class="agile-label" for="agilefield-2">Enter Email<span class="agile-span-asterisk"> *</span></label> --> 
         <div class="agile-field-xlarge agile-field"> 
         <input maxlength="250" id="agilefield-2" name="email" type="email" placeholder="Enter your email" class="agile-height-default" required=""> 
         </div> 
         <div class="agile-custom-clear"></div> 
        </div> 
        <!--recaptcha aglignment--> 
        <!-- Button --> 
        <div class="agile-group"> 
         <label class="agile-label">&nbsp;</label> 

         <div class="agile-field agile-button-field"> 
         <button type="submit" class="agile-button">Subscribe Now</button> 
         <p class="text-muted" style="padding-top:20px;">Cancel Anytime | We Do Not Spam</p> 
         <br><span id="agile-error-msg"></span> 
         </div> 

        </div> 

       </fieldset> 
      </form> 

Wie bekomme ich diese Arbeit? Danke für die Richtung und Hilfe.

Antwort

2

Ich dachte, dass ich den Submit-Button im 'else' Selektor platzieren könnte, aber es macht das Markup ungültig.

Das würde bedeuten, dass:

Wenn der Benutzer das Formular erfolgreich abgegeben, ohne in der Honeypot-Füllung, dann würden Sie geben ihnen die Möglichkeit, das Formular abzuschicken.

Das ist Catch-22.

Legen Sie einfach den Absenden-Button in das Formular. Sie benötigen es, damit es eingereicht werden kann.

Verwandte Themen