I have a whois form in my site that enables users to query for domain name availability and if available gives them the option to request for registering it. The whois form is inserted via shortcodes.

My problem is that I want to protect this form from spam bots by hiding the form until the user solves a simple math question or enters a captcha.

I made a lot of research on the internet but found nothing on hiding content for visitors until they prove their humanity. All I found is to hide content for un-logged-in users, which is not my case, because I want to give general visitors (not members) the ability to use the whois form and prevent spam bots at the same time.

Any help or guide lines is greatly appreciated.

Many Many Thanks,

Kri Kab


Well the way I see it have a few options:

1: Use jQuery to .hide() and .show() the form after verification. While user friendly I'm not sure this would deter the bots since the html form will still be visible in your source when 'hidden'

2: Use a separate form that will validate the user input (from captcha or some other service) and then upon proper entry will display the whois form. This could be used to store a cookie or session variable to mark the user as human and let them query the whois form multiple times without revalidating.

3: Add a new required form field to your existing whois form that would serve as user validation and submit it at the time of the Whois request - if it doesn't validate don't submit the request.

Options 2 and 3 would both require some digging around in your code to find where the shortcode is generated and add in the new form fields.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.