Today we are going to discuss a few ways to prevent web form spam which we are sure is a problem faced by many webmasters. The captcha code may be the best solution to avoid autofill forms spamming on websites. It can control spams on all kind of website forms the like contact form, quote form, message form, blog comments, etc.
By using captcha, google captcha or any other captcha script you can stop spam on types of forms. You can also generate captcha images using PHP captcha.
Some captcha is made by complex images or even patterns to validate the form.
Below are a few optional ways to avoid spamming.
- Coerce registered users into verifying their email address before posting some content to your website.
- Some forms allow placement of a hidden field that is designed to be blank but automated submission robots don’t know this and will often try to fill it out anyways. When they submit the form with this “bot trap” field filled in, it will prevent submission.
- There are third party services ( like Askimet ) that can be used to detect spam. These third party services check spam against their API over submission of forms.
- Server side strong validation of forms to check if an email address exists within the system and application or not. Use PHP default filters for validation.
- Hide your forms from google search engine using robox.txt
- Use some conditional logic for contact forms or registration form like payment fees for registration or something like that. It will be more useful.
- Another way is to substitute the “@” and “.” symbols from your email with words – for example <youremail> (AT) <something> (DOT) <com> – i.e support (at) Mysite (dot) com.You can safely post your email address as an image that can be created with any PHP code.
- Restrict user for 1 entry/1 day(per IP address). You can get user IP address using PHP function $_SERVER[‘REMOTE_ADDR’] and the restricted user can fill only one entry from one IP in a single day.
- For WordPress websites, there are so many plugins readily available. These plugins for site security efficiently help in preventing spammers.
About Author
Pankaj Sakariya - Delivery Manager
Pankaj is a results-driven professional with a track record of successfully managing high-impact projects. His ability to balance client expectations with operational excellence makes him an invaluable asset. Pankaj is committed to ensuring smooth delivery and exceeding client expectations, with a strong focus on quality and team collaboration.