Friday , 29 May 2015
Home » Helpful Tips and Tricks » 100% SPAM Free Protection Using PHP and jQuery
100% SPAM Free Protection Using PHP and jQuery

100% SPAM Free Protection Using PHP and jQuery

Hello Friends,

I am working with PHP and MySql since last 5 years and I was keep complained from my clients that they are getting spam emails via contact forms. Solution is Captcha ? Oops. You are judging me wrong. As I said I am PHP Developer over 5 years of experience so I have used captcha obviously for the forms.

Even if I placed captcha, clients are getting spam emails. It may be possible that spammers may have some script which will read captcha and submit forms automatically. It was out of my mind to come up with the solution and make them spam free. Here is what I think for it.

I come up with 2 solutions and both works for my clients.

Solution 1.
– Pick your required field.
– Make an ajax call onblur or onkeyup event for that field.
– Create a session on server side with that ajax call.
– Now when form submit, check with that session. If that session is created than its a real person who submit the form and not the spammer.
– This will make sure that visitor has physically enter the required field and all other fields.

Solution 2.
– Build your own captcha instead of using popular readymade captcha solution. Its simple to create one. Here is how you can achieve it.
– Create 2 random numeric number and save them in session.
– In answer box, ask visitors to enter sum or subtraction or any other mathematic operation with those numbers. Every time page refresh, keep different mathematic operation and save it to session to use it while form submits.
– This will also make sure that visitor will physically enter the information on site and submit the form.

Problem with Solution 1 is when user does not have javascript enabled on browser. But only 5% people comes in this case.

I hope this helps! Cheers.

About Rakshit Patel

I am PHP Freelancer, Rakshit Patel AKA WordPress Freelancer working as PHP Programmer India. I am here to share all my developing knowledge, quick coding techniques, quick solutions to save your time and help you guys for any issue or bug fixing. If you have any PHP, WordPress, Magento related work, please contact me. I am interested for the work.

One comment

  1. WOW! Gives me a big information! your idea is very good.

Leave a Reply

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


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>