Preventing spam on your website without using captcha
This is an alternative to the image and audio captcha and it is much simpler than the other two methods.
1. Add an input field to your form, with some interesting name, for example ‘URL’.
<input name=”url” type=”text” value=”"/>
2. Hide the input box using css so that users(genuine) cannot see it directly.
<style>
.style1 {
display: none;
}
</style>
<p class=”style1″><input name=”url” type=”text” value=”"/></p>
3. While processing the form check if the “url” contains any value. If it does, reject the post or put it for moderation.
if (strlen(trim($_POST['url'])) > 0){
//It is a spam, reject this post here
}
4. any doubt? Well, it works simply because geniune users cannot see a hidden input box on your form and therefore, they won’t fill it, while robots can.
Another approach is to create an entire duplicate form for comments above the real form and set the action attribute as an empty file. Then hide this form using CSS. After that, all the spam will be submitted to this form(hopefully).