Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fighting Spam in Laravel 4

What are the most effective and/or easiest to implement methods for reducing spam entries on a comment form in Laravel?

I have tried https://github.com/msurguy/Honeypot, but the time field doesn't pass validation I think it is because I'm using ardent?

like image 451
Jeremy Plack Avatar asked Aug 04 '14 19:08

Jeremy Plack


Video Answer


1 Answers

We implement this method at work and it stops almost all spam. You need to hide a text field (Using css "display:none" on a parent element. Don't use a hidden field, spambots know better) and when you validate the form, make sure that field has no content. If there is content, you know it is spam. Spam bots like to fill in as many fields as possible. Here is an example:

.special-field {
  display:none;
}
<div class="special-field">
  <label for="birthday">Birthday</label>
  <input type="text" name="birthday" id="birthday" value="" />
</div>

Applying a name to the field may help to confuse spam bots as well, further encouraging them to fill in a value.

like image 107
Patrick Stephan Avatar answered Sep 17 '22 17:09

Patrick Stephan