Mathematical CAPTCHA
[ Features | Screenshots | Instructions | Download | History | Links ]
{ PHP / Personal Project / January 2008}
This simple to use PHP CAPTCHA Class uses a basic math problem (converted to word form) instead of the normal repeat the letters/numbers concept.
I came up with this interesting CAPTCHA (among other terrible ones) with Adam Rua when we were working on our Senior Project, SHUGamer.com. Originally the image was a lot larger 250x250px and contained messages like “Answer using only numbers.” However, in 2009, I modified the image to be smaller to fit better in my Graduate Project, AreYouAG33k.com. And finally, I recently condensed the various functions into one solid class for anyone to use.
Features
Displays a 250px by 50px image using GD (built into most versions of PHP) with white background, randomly colored polygon, various scattered lines, and a mathematical word problem. No class instances need to be created as it uses Static calls.
Screenshots
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Instructions
First, include the Captcha class and start the session (as they are required)
-
require_once("Captcha.class.php");
-
session_start();
Second, you need to generate a unique CAPTCHA id
-
$id = Captcha::Generate();
Third, display the CAPTCHA associated with this id
-
Captcha::Display($id);
Finally, verify the user’s input with the id
-
if (Captcha::Verify($id, $answer))
-
echo "CAPTCHA passed. You are not a robot!";
-
else
-
echo "ROBOT! 'We don't serve their kind here' – Star Wars";
History
- 9 April 2010 – v14 – First Public Release
Download
- PHP Source and Example (v14) – 4kb
- md5: 7D53F351C6B119DDEF08D1220DFB8FED
- sha1: 81CF1355BCA5AB299C81B573875FC2DD3E1E6ABC








