How to stop spam from your web pages

Bots, which are meant to send spam, work all over the Internet. They try to fill every web page with an online form, including comment forms and contact forms. Manual work is needed to remove them from useful pages and blogs. Fortunately, there are several automated ways to use scripts to stop these nuisances. In this article, I will try to guide you towards some of these tricks.

Antispam question: This is the easiest way actually. Add a question that only a human can answer. Add obvious questions that anyone can answer, for example, “does the sun rise in the east or north?” It’s easy enough for any human being to answer. The bots, however, will not be able to respond to this 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 scripting and coding.

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

Matching Options Menu: If the form contains a dropdown option, such as a “Country” field, you can always use this trick to avoid bots. The bots are not aware of the fact that ‘$posted_var’ must have a default value. In case it is a ‘country’ field, it should be a valid country name 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 mismatch.

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 it won’t be seen by normal users. However, the 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. So human feedback will be allowed, but 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 enough for the name field. Bots, by nature, will try to fill in as much data as they can in any given field. And therefore, they will be prevented from posting anything.

Of course, there are other methods that can be used and each programmer has their own preferences. These methods are just some of the effective methods, used by programmers all over the world now.

Leave a Reply

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