This is the official GitHub project from code.google.com/p/cool-php-captcha
Clone or download
josecl Merge pull request #35 from xuedi/master
added a difficulty level for the default values
Latest commit dd8ea19 Mar 4, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
resources typo Jan 20, 2016
.gitignore ignore .swp files Jan 20, 2016
LICENSE.txt Change license to GPLv3 Jun 10, 2008
README.md Update README.md Jan 20, 2016
captcha.php added a difficulty level for the default values Aug 20, 2016
example-form.php Update project information: email, url, version Jan 20, 2016
example.jpg - OOP implementation Jun 8, 2008

README.md

cool-php-captcha

This is the official GitHub project from code.google.com/p/cool-php-captcha

This project generates friendly captcha images. This project provides the SimpleCaptcha class. Some fetures are: Background and foreground colors, dictionary words, non-dictionary random words, blur, shadows, JPEG and PNG support.

Basic example

session_start();
$captcha = new SimpleCaptcha();
// Change configuration...
//$captcha->wordsFile = null;           // Disable dictionary words and use random letters instead
//$captcha->wordsFile = 'words/es.txt'; // Enable spanish words dictionary
//$captcha->session_var = 'secretword'; // Changes the session variable from 'captcha' to 'secretword'
$captcha->CreateImage();

... will output an image, for example:
http://cool-php-captcha.googlecode.com/files/example.jpg

You can validate the php captcha with: (case-insensitive version)

if (empty($_SESSION['captcha']) || strtolower(trim($_REQUEST['captcha'])) != $_SESSION['captcha']) {
    return "Invalid captcha";
}

You can see a live example here: http://joserodriguez.cl/cool-php-captcha

More examples

Background and foreground colors, dictionary words, non-dictionary random words, blur, shadows, JPEG and PNG support: