PHP Classes

Simple CAPTCHA: Generate and verify CAPTCHA validation images

Recommend this page to a friend!
  Info   View files View files (5)   DownloadInstall with Composer Download .zip   Reputation   Support forum (2)   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStar 59%Total: 5,559 All time: 437 This week: 204Up
Version License Categories
simplecaptcha 1.0GNU General Publi...Graphics, Validation, Security


This class can be used to generate and verify CAPTCHA validation images.

It can generate an image with a random text drawn on it that the user must read and enter the text to confirm that is a human user and not a robot.

The length of the text, the colors of the image, the background image, the text font and the text inclination angle and transparency level are configurable parameters.

The class generates the verification image as the current script output in the PNG format.

Picture of Ver Pangonilo
Name: Ver Pangonilo <contact>
Classes: 3 packages by
Country: Philippines Philippines
Age: ???
All time rank: 681 in Philippines Philippines
Week rank: 105 Down2 in Philippines Philippines Down
Innovation award
Innovation award
Nominee: 1x

Winner: 1x

Projectname: Simple CAPTCHA class Version: 0.1 Author: Ver Pangonilo <> Last modified: 18 May 2006 Copyright (C): 2006 Ver Pangonilo, All Rights Reserved * GNU General Public License (Version 2, June 1991) * * This program is free software; you can redistribute * it and/or modify it under the terms of the GNU * General Public License as published by the Free * Software Foundation; either version 2 of the License, * or (at your option) any later version. * * This program is distributed in the hope that it will * be useful, but WITHOUT ANY WARRANTY; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A * PARTICULAR PURPOSE. See the GNU General Public License * for more details. Description: This class can generate CAPTCHAs for user forms. Parameters can be set on the configuration file including transprency. Note: The font "BRADHITC.TTF" is required for the default configuration. This is a common script font for Windows. A replace the default font to suit application. Usage : Create a configuration file which contains the following: <? session_start(); require_once('class.simplecaptcha.php'); /* CONFIGURATION STARTS */ //Background Image $config['BackgroundImage'] = "white.png"; //Background Color- HEX $config['BackgroundColor'] = "FFFC00"; //image height - same as background image $config['Height']=30; //image width - same as background image $config['Width']=100; //text font size $config['Font_Size']=20; //text font style $config['Font']="BRADHITC.TTF"; //text angle to the left $config['TextMinimumAngle']=15; //text angle to the right $config['TextMaximumAngle']=45; //Text Color - HEX $config['TextColor']='000000'; //Number of Captcha Code Character $config['TextLength']=6; //Background Image Transparency // 0 - Not Visible, 100 - Fully Visible $config['Transparency']=70; /* CONFIGURATION ENDS */ //Create a new instance of the captcha $captcha = new SimpleCaptcha($config); //Save the code as a session dependent string $_SESSION['string'] = $captcha->Code; ?> Save this file as captcha.php or any filename you wish to. In the html form, the usage will be <img src="PATH_TO/captcha.php" alt="captcha" width="WIDTH" height="HEIGHT" /> Limitations: 1. Initially, it only uses PNG images. 2. The image size should be the same as the background image size.
  Files folder image Files  
File Role Description
Accessible without login Plain text file captcha.php Example Simple Captcha configuration file
Plain text file class.simplecaptcha.php Class Simple Captcha Class
Accessible without login Plain text file Readme.txt Doc. Sample True Type Font file
Accessible without login Plain text file testCaptcha.php Example Test Application for the Simple Captcha class
Accessible without login Image file white.png Data Sample Background Image for the Simple Captcha Class

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:437
This week:204Up
User Ratings User Comments (1)
 All time
not working
12 years ago (php max)