PHP Classes
elePHPant
Icontem

Simple CAPTCHA: Generate and verify CAPTCHA validation images

Recommend this page to a friend!

  Author Author  
Name: Ver Pangonilo <contact>
Classes: 3 packages by
Country: Philippines Philippines
Age: ???
All time rank: 671 in Philippines Philippines
Week rank: 235 Down5 in Philippines Philippines Down
Innovation award
Innovation award
Nominee: 1x

Winner: 1x


  Detailed description   Download Download .zip .tar.gz  
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.

Details
{startverticalbanner}
Projectname:   Simple CAPTCHA class
Version:       0.1
Author:        Ver Pangonilo <smp@limbofreak.com>
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.



  Classes of Ver Pangonilo  >  Simple CAPTCHA  >  Download Download .zip .tar.gz  >  Support forum Support forum (2)  >  Blog Blog  >  RSS 1.0 feed RSS 2.0 feed Latest changes  
Name: Simple CAPTCHA
Base name: simplecaptcha
Description: Generate and verify CAPTCHA validation images
Version: -
PHP version: -
License: GNU General Public License (GPL)
All time users: 5533 users
All time rank: 418
Week users: 0 users
Week rank: 690 Equal
 
  Groups   Rate classes User ratings   Applications   Files Files  

  Groups  
Group folder image Graphics Colors, images, charts and picture formats View top rated classes
Group folder image Validation Validation algorithms View top rated classes
Group folder image Security Security protection and attack detection View top rated classes


  User ratings  
RatingsUtility Consistency Documentation Examples Tests Videos Overall Rank
All time: Sufficient (75%) Sufficient (78%) Sufficient (67%) Sufficient (78%) - - Not sure (59%) 1226
Month: Not yet rated by the users

  Applications that use this package  
No pages of applications that use this class were specified.

Add link image If you know an application of this package, send a message to the author to add a link here.

  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

Download Download all files: simplecaptcha.tar.gz simplecaptcha.zip
NOTICE: if you are using a download manager program like 'GetRight', please Login before trying to download this archive.