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

example1 example1
example3 example4
Expired Captcha InvalidCaptcha

Instructions

First, include the Captcha class and start the session (as they are required)

  1. require_once("Captcha.class.php");
  2. session_start();

Second, you need to generate a unique CAPTCHA id

  1. $id = Captcha::Generate();

Third, display the CAPTCHA associated with this id

  1. Captcha::Display($id);

Finally, verify the user’s input with the id

  1. if (Captcha::Verify($id, $answer))
  2.   echo "CAPTCHA passed. You are not a robot!";
  3. else
  4.   echo "ROBOT! 'We don't serve their kind here' – Star Wars";

History

  • 9 April 2010 – v14 – First Public Release

Download

Links/Resources

Leave a Reply

Allowed tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>



  • Donate

    If my work has helped you and you want to return the favor, you could purchase something for me from my Amazon Wish List or send me a donation via PayPal.

  • License

    Unless otherwise noted, all source code and compiled files published on this website are released under the terms of the GNU Lesser General Public License.