PHP Built-In Ajax Captcha Validation Code Sample

CAPTCHA included in PHP form validation
CAPTCHA
Reload the CAPTCHA codeSpeak the CAPTCHA code
 

Description

This sample project shows how to properly perform Ajax CAPTCHA validation using built-in BotDetect client-side functionality, which doesn't require any 3rd party Ajax frameworks.

It uses the Captcha Form Sample as a starting point, and adds client-side validation of all form fields.

Ajax CAPTCHA validation improves the user experience by reducing CAPTCHA validation response time, giving users much faster feedback about the validation result.

Client-side validation is not secure by itself (it can be bypassed trivially), so the sample also shows how the protected form action must always be secured by server-side CAPTCHA validation as well.

In case of any Ajax errors or timeouts, the sample simply falls back to full form posting and server-side CAPTCHA validation.

Beta Release Warning

BotDetect PHP Captcha Library Beta is a work in progress, and we need you to guide our efforts towards a polished product. Please let us know if you encounter any bugs, implementation issues, or a usage scenario you would like to discuss.

Free Version Limitations

  • The free version of BotDetect includes a randomized BotDetect™ trademark in the background of 50% of all Captcha images generated.
  • It also has limited sound functionality, replacing the CAPTCHA sound with "SOUND DEMO" for randomly selected 50% of all CAPTCHA codes.
  • Lastly, the bottom 10 px of the CAPTCHA image are reserved for a link to the BotDetect website.

These limitations are removed if you upgrade your BotDetect license.