PHP Classes

Check spam: Generate and validate CAPTCHA verification images

Recommend this page to a friend!
  Info   Screenshots   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStarStar 68%Total: 4,065 All time: 766 This week: 455Up
Version License PHP version Categories
checkspam 1.6GNU General Publi...5.0HTML, PHP 5, Graphics, Validation
Description 

Author

This package can be used to generate and validate CAPTCHA validation images.

It can create an image in the PNG format displaying a random text. The text is stored in a session variable for later verification.

The class can also generate HTML to display the verification image and the inputs of a form on which the user must type the text in the image.

The class can verify whether the submitted form input text matches the text in the image.

All actions are recorded in a log stored as a class variable.

Picture of Giuseppe Leone
Name: Giuseppe Leone <contact>
Classes: 1 package by
Country: Italy Italy
Age: 39
All time rank: 75828 in Italy Italy
Week rank: 192 Up8 in Italy Italy Up

Details

NAME CheckSpam - a simple Class that helps you to prevent the spam attack to your website. It provide to generate two types of verification: 1 - Text (Customizable style in CSS like); 2 - Graphic (Using the GD 2.x PHP Library). SYNOPSIS # THE FORM: <?php define('CHECKSPAM_DIR','../../checkspam/'); require_once(CHECKSPAM_DIR.'checkspam.class.php'); $cs = new checkspam; $cs->init_session(); $cs->exec_checkspam(0); // Text mode verification ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>checkspam - First example</title> </head> <body> <h1>SIMPLE TEXT VERIFICATION:</h1> <form method="post" action="register.php"> <table width="60%" border="1"> <tr> <td width="30%">Name:</td> <td width="70%"><input type="text" name="txt_name" /></td> </tr> <tr> <td>Security code: <?php $cs->print_imagetext(); ?></td> <td><?php $cs->print_input(); ?></td> </tr> <tr> <td colspan="2" align="center"><input type="submit" value="send data" /></td> </tr> </table> </form> <body> </html> # THE VERIFICATION: <?php define('CHECKSPAM_DIR','../../checkSpam/'); require_once(CHECKSPAM_DIR.'checkspam.class.php'); $cs = new checkspam; $cs->init_session(); if($cs->verify($_POST['secretcode'])){ echo "Valid code specified !"; }else{ echo "NO valid code specified !"; } ?> DESCRIPTION GETTING STARTED IMPORTANT # About the Graphic Mode # If the Graphic mode is enable, the "checkspam/images/ directory must be writable by everyone ( chmod 777 ) # How to use other fonts # A new font image can be uploaded into the font's directory "checkspam/font"; IMPORTANT NOTE: The new font PNG image must have the same color and character position of the other font image already present into the directory. COPYRIGHT Copyright(c) 2006 joseph@masterdrive.it. All rights reserved. This software is released under the GNU General Public License. http://www.gnu.org

Screenshots (1)  
  • screenshot/graphic_verification.png
  Files folder image Files (21)  
File Role Description
Files folder imagecheckspam (1 file, 2 directories)
Files folder imagesamples (5 directories)
Plain text file AUTHORS Doc. Authors file
Plain text file INSTALL Doc. Installation file
Plain text file LICENSE Lic. License file
Plain text file README Doc. Readme file
Plain text file VERSION Doc. Version file

  Files folder image Files (21)  /  checkspam  
File Role Description
Files folder imagefont (3 files)
Files folder imageimages (1 file)
  Plain text file checkspam.class.php Class The main source of class

  Files folder image Files (21)  /  checkspam  /  font  
File Role Description
  Image file checkspam-font-1.png Data PNG font image
  Image file checkspam-font-2.png Data PNG font image
  Image file checkspam-font-3.png Data PNG font image

  Files folder image Files (21)  /  checkspam  /  images  
File Role Description
  Image file checkSpam5493f0e69...c52e01179502984.png Data Temporary security images

  Files folder image Files (21)  /  samples  /  1_SIMPLE_TEXT_VERIFICATION  
File Role Description
  Plain text file form.php Example Simple text verification
  Plain text file register.php Example Validate

  Files folder image Files (21)  /  samples  /  2_GRAPHIC_VERIFICATION  
File Role Description
  Plain text file form.php Example Graphic verification
  Plain text file register.php Example Validate

  Files folder image Files (21)  /  samples  /  3_CUSTOM_TEXT_VERIFICATION  
File Role Description
  Plain text file form.php Example Custom text verification
  Plain text file register.php Example Validate

  Files folder image Files (21)  /  samples  /  4_GRAPHIC_VERIFICATION_WITH_CUSTOM_INPUT  
File Role Description
  Plain text file form.php Example Graphic verification with custom input form
  Plain text file register.php Example Validate

  Files folder image Files (21)  /  samples  /  5_MULTIPLE_CODE_VERIFICATIONS  
File Role Description
  Plain text file form.php Example Multiple code verifications
  Plain text file register.php Example Validate

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:4,065
This week:0
All time:766
This week:455Up
 User Ratings  
 
 All time
Utility:88%StarStarStarStarStar
Consistency:80%StarStarStarStarStar
Documentation:76%StarStarStarStar
Examples:84%StarStarStarStarStar
Tests:-
Videos:-
Overall:68%StarStarStarStar
Rank:397