Monday, April 15, 2013

How to prevent spam without using captcha

Using captcha's on your website form to prevent spam there a plenty of reasons of not using CAPTCHA'S

  • It creates a barrier to users by with giving a frustrating images or text

  • Need extra effort to work upon, because they are annoying and disturb your visitor attention

  • CAPTCHAs Can Consume A Lot Of Hosting Resources : CAPTCHAs requires additional CPU memory as they generate random text based images which may slow down a shared server.

  • CAPTCHAs Can Be Broken : CAPTCHAs can be bypassed and broken, attackers can have outsourced human workers who can easily deCAPTCHA your security. Another, much more rare way that CAPTCHAs can be broken, is through computer algorithms that are capable of cracking even the most sophisticated CAPTCHA systems.


Here is some examples of simple methods to prevent spam without using captcha :

1) Using css :
We can declare some additional fields and hide them using css and upon form submission check those fields on server side if some robot script try to fill out the fields they will also populate those hidden fields.

Example :
Your HTML would be
[html]
<label>Leave this blank: <input class="hidethis" type="text" name="leaveblank" /></label>

<label>Do not change this: <input class="hidethis" type="text" name="dontchange" value="http://" /></label>
[/html]
Your css
[css]
.hidethis{ display:none; }
[/css]

Your server side php
[php]
if ($_POST['leaveblank'] != '' or $_POST['dontchange'] != 'http://') {
// display message that the form submission was rejected
}
else {
// accept form submission
}
[/php]

2) Use php to change input field names periodically : We can use the date() function to change field names, use the daily date parameter.

[php]
$date = date('d');
$html = "<input type='text' name='abc$date'>\n";

if ( !isset($_POST["abc$date"] ) {
// do not accept the request
}
[/php]

No comments:

Post a Comment