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.
– 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.
– 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.
I hope this helps! Cheers.
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.