PHP Classes
elePHPant
Icontem

Check spam: Generate and validate CAPTCHA verification images

Recommend this page to a friend!
  Info   Screenshots Screenshots   View files View files (20)   DownloadInstall with Composer Download .zip   Reputation   Support forum (2)   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2007-06-17 (9 years ago) RSS 2.0 feedStarStarStarStar 70%Total: 4,053 All time: 737 This week: 1,109Down
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

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  
  • screenshot/graphic_verification.png
  Files folder image Files  
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  /  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  /  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  /  checkspam  /  images  
File Role Description
  Image file checkSpam5493f0e69...c52e01179502984.png Data Temporary security images

  Files folder image Files  /  samples  
  Files folder image Files  /  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  /  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  /  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  /  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  /  samples  /  5_MULTIPLE_CODE_VERIFICATIONS  
File Role Description
  Plain text file form.php Example Multiple code verifications
  Plain text file register.php Example Validate

 Version Control Unique User Downloads Download Rankings  
 0%
Total:4,053
This week:0
All time:737
This week:1,109Down
 User Ratings  
 
 All time
Utility:90%StarStarStarStarStar
Consistency:81%StarStarStarStarStar
Documentation:79%StarStarStarStar
Examples:86%StarStarStarStarStar
Tests:-
Videos:-
Overall:70%StarStarStarStar
Rank:289