我的网页上有一个表格。我经常从我认为是网络机器人的东西中得到空提交。为了阻止这种情况,我遵循了这篇文章中接受的答案的建议,并做了一个“蜂蜜陷阱”以停止自动提交。
我不确定我是否做错了什么,但我仍然每天大约收到一次空提交。
我做错了什么,还是有其他原因使这种方法现在可以工作?
我的 HTML:
<form action="post.php" method="post">
<label for="email"></label>
<input type="email" placeholder="Enter your email address..."
name="email" required>
<input type="checkbox" name="contact_me_by_fax_only" value="1" style="display:none !important" tabindex="-1" autocomplete="off">
<button type="submit" class="signupbtn">Sign Up</button>
</form>
我的PHP:
<?PHP
$honeypot = FALSE;
$email = $_POST["email"];
if (!empty($_REQUEST['contact_me_by_fax_only']) && (bool) $_REQUEST['contact_me_by_fax_only'] == TRUE) {
$honeypot = TRUE;
log_spambot($_REQUEST);
# treat as spambot
} else {
mail("my@email.com", "Message from $email", "message here");
header('Location: thanks.html');
}
?>