Bitprison CAPTCHA System for PHP

I've made a CAPTCHA system what is ease of use for any PHP website. This is a full object oriented class library. Ease of use and ease of customisation. Try it! Feel free to download and use it. Please leave a comment.


  • Very minimal software requirements
  • Ease of customisation (parameters or class extending)
  • Full object oriented library
  • One file one class
  • API documentation
  • Totally free and Open Source! Download

Customisation with parameters

  • Set number of characters
  • Set size of captcha


  • PHP 5.0 or above
  • GD 2.0 or above
  • Only (Ubuntu) Linux tested, but theoretically works on Windows too, but I haven't got Windows.

Example and Demo

Example of BitPrison CAPTCHA image:

Try the demo page and download BitPrison CAPTCHA include the demo.

Code Example

Generate image

* This is an example of how to genereate captcha with this class library.
* 1. Include Captcha class!
* 2. Generate CAPTCHA with interface of Captcha class.
* 3. Send session cookie. And save to session the captcha object.
* 4. Print Captcha to std. output. Return as an image.

// 5 character long, 1.4x size, horizontal space, vertical space
$c = new Captcha(5, 1.4, 100, 50);
// Captcha() whitout parameters is also work

// save the object to session
$_SESSION['captcha'] = $c;

// draw it

Check CAPTCHA string


if (is_object($_SESSION['captcha']) &&
  $success = $_SESSION['captcha']->check($_POST['c']))
    $message = "You are Human.";
    // do something
} elseif ($_POST['c'] != '') {
    $message = "Are you spammer?";
    // do something

Ubuntu compatibility

This class library use only necessary image functions. Work under Ubuntu linux because not use imageantialias() or imagerotate() functions, what ubuntu packaged PHP-GD library don't support.


You can download from http://captcha.bitprison.net/captcha.tar.gz.

Coming soon

BitPrison CAPTCHA module for Drupal CMS coming soon.

Blog categories:  Programming

Add new comment