PHP Classes

Math Guard: CAPTCHA validation using math expressions

Recommend this page to a friend!
  Info   View files View files (4)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStarStar 70%Total: 2,272 All time: 1,715 This week: 488Up
Version License PHP version Categories
mathguard 0.2GNU General Publi...3.0HTML, Validation, Security


This class can be used to perform CAPTCHA validation presenting simple mathematical expressions to the users to make it difficult for robots to pass a form being validated.

It displays a mathematical expression of a sum between two random numbers and asks the user to enter the result in a text form input.

The class generates an hash of the result using a secret prime number that is passed in an hidden form input.

When the user enters the result, the class validates it comparing the hash of the value entered by the user with the hash passed in the hidden input.

Innovation Award
PHP Programming Innovation award nominee
June 2007
Number 7

Prize: One book of choice by Packt
CAPTCHA validation is being used everywhere on the Internet to make it difficult for robots to access sites that should be accessed only by real human user beings.

One of the problems is that most solutions are based on images. Obviously, such images cannot be read by blind users using regular text to speech conversion programs.

This class provides a CAPTCHA alternative that is not based on images, but rather on simple math operations.

This way, blind users can read what is written in the pages and pass the CAPTCHA validation tests giving the correct results to requested operations.

Manuel Lemos
Picture of m
Name: m <contact>
Classes: 1 package by
Country: Slovak Republic Slovak Republic
Age: ???
All time rank: 13536 in Slovak Republic Slovak Republic
Week rank: 280 Up1 in Slovak Republic Slovak Republic Up
Innovation award
Innovation award
Nominee: 1x

  Files folder image Files  
File Role Description
Plain text file ClassMathGuard.php Class Main MathGuard class
Accessible without login Plain text file formhandler.php Example The php script which handles the verification and action
Accessible without login Plain text file index.php Example Main sample Form that has to be protected
Accessible without login HTML file readme.html Doc. Simple readme file with the example description

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:1,715
This week:488Up
 User Ratings  
 All time