BotDetect PHP CAPTCHA Generator

CAPTCHA Generator Features:

Quickstarts:

BotDetect PHP Captcha generator allows you to easily add Captcha protection to various types of PHP based web forms.

We'll use default Captcha generator settings; to see how powerful and customizable BotDetect is, check the BotDetect features demo.

1. Copy Captcha Library Files

Copy botdetect.php and the botdetect folder to your website folder. These files are included in the BotDetect download package (the lib sub-folder).

2. Show a Captcha Challenge on the Form

On the very top of the source file for the PHP form you want to protect against bots, add:
<?php session_start(); ?>
<?php require("botdetect.php"); ?>
On the PHP form you want to protect against bots, add:
  <link type="text/css" rel="Stylesheet" 
    href="<?php echo CaptchaUrls::LayoutStylesheetUrl() ?>" />
</head>

  […]

<?php // Adding BotDetect Captcha to the page 
  $ExampleCaptcha = new Captcha("ExampleCaptcha");
  $ExampleCaptcha->UserInputID = "CaptchaCode";
  echo $ExampleCaptcha->Html(); 
?>

<input name="CaptchaCode" id="CaptchaCode" type="text" />

3. Check User Input During Form Submission

When the form is submitted, the Captcha validation result must be checked:
<?php 
  if ($_POST) {
    // validate the Captcha to check we're not dealing with a bot
    $isHuman = $ExampleCaptcha->Validate();
    
    if (!$isHuman) {
      // TODO: Captcha validation failed, show error message
    } else {
      // TODO: Captcha validation passed, perform protected action
    } 
  }
?>

In-Depth PHP CAPTCHA Instructions and Explanations

Detailed PHP Captcha instructions and explanations can be found in the PHP Captcha integration how to guide.

BotDetect PHP CAPTCHA Free Version

You can download BotDetect PHP CAPTCHA Library for free and use it immediately! Your PHP forms can be protected from spam (and bots in general) in minutes.

We offer basic email support for free to all BotDetect users. So if you need any assistance integrating BotDetect or have any questions or feedback, our Support department is at your disposal.

Once the BotDetect Captcha generator library has been integrated into your PHP website and you're satisfied with how it works, it's easy to upgrade your license if you need the extra features offered by commercial BotDetect versions.

BotDetect PHP CAPTCHA Free Download

BotDetect PHP CAPTCHA System Requirements

OS Server PHP

Supported Operating Systems:

  • Linux
  • Windows
  • Mac OS X

Supported Web Servers:

  • Apache 2.2+

Supported PHP Versions:

  • PHP 7.0.0+
  • PHP 5.6.0+
  • PHP 5.5.0+
  • PHP 5.4.0+
  • PHP 5.3.2+
  • PHP 5.2.1+

PHP installation must include libgd support.