How to stop spam on your web pages

Bots, which are intended to send spam, are working all over the Internet. They try to fill all web pages with an online form, including comment forms and contact forms. It takes manual work to remove them from useful pages and blogs. Fortunately, there are several automated ways to use scripts to stop these annoyances. In this article, I’ll try to guide you towards some of these tricks.

Anti-spam question: this is the simplest way actually. Add a question that only a human can answer. Add obvious questions that anyone can answer, for example, “Does the sun rise from the east or from the north?” it’s easy enough for any human to answer. Bots, however, will not answer this question, as they have no cognitive knowledge. The question must remain in the tag element and must be associated with the answer entry. The wrong answer can stop spam without much programming and coding.

There are other variations of this approach such as image-based questions, random questions, slider-based questions.

Option combination menu: If the form contains a dropdown menu option, like a ‘Country’ field, you can always use this trick to avoid bots. Bots are not aware of the fact that ‘$ posted_var’ must have a pre-designated value. In case it is a ‘country’ field, it must be the name of a valid country and not something arbitrary. Most bots will put values ​​like ‘1’ just to put something in each field. Comments can be avoided due to this discrepancy.

The Honeypot Spam Trap: This is a fun way to stop bots, using their idiocy to your advantage. You can simply use a field that is hidden using ‘offset class’ and will not be seen by normal users. However, bots, being a program, will be able to see this field and as usual, put something in this field. The trick is that the script will only allow comments when this field is left empty. Therefore, human comments will be allowed, but the bots will automatically receive the error message.

Input length regulation: You can use these tricks by limiting the allowed input length for any particular field. Personally, I think a 20 character limit is sufficient for the name field. Bots, by nature, will try to fill in as much data as they can in any field. And therefore, they will not be able to post anything.

Of course, there are other methods that can be used and each programmer has his own preferences. These methods are just some of the effective methods used by programmers around the world today.

Leave a Reply

Your email address will not be published. Required fields are marked *

Back To Top