PHP Classes
elePHPant
Icontem

Animated CAPTCHA: CAPTCHA validation using animated math expressions

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Info   View files View files (21)   DownloadInstall with Composer Download .zip   Reputation   Support forum (3)   Blog    
Last Updated Ratings Unique User Downloads Download Rankings  
2007-06-08 (8 years ago) RSS 2.0 feedStarStarStarStar 65%Total: 5,954 This week: 2All time: 359 This week: 646Down
Version License PHP version Categories  
animatedcaptcha 1.1GNU Lesser Genera...4.0Graphics, Validation, Security
Description Author  

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

It generates an animated GIF image that displays a mathematical expression of a simple operation between two random numbers, like sum, subtraction and multiplication.

The numbers and the operation are stored in session variables for posterior verification.

Innovation Award  
PHP Programming Innovation award nominee
June 2007
Number 6


Prize: One year server license IP to country region city database
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 that show validation text that is easy to guess using common OCR (optical character recognition) programs.

This class provides a CAPTCHA alternative that uses animated images. In each animation frame, it is presented a number or the symbol of a simple math operation that the users must solve to pass the validation tests.

This solution raises the difficulty to robots in comparison to other CAPTCHA solutions that are easier to defeat by the current generation of robots.

Manuel Lemos
Picture of Josh Storz
Name: Josh Storz <contact>
Classes: 1 package by
Country: United States United States
Age: ???
All time rank: 44453 in United States United States
Week rank: 604 Down66 in United States United States Down
Innovation award
Innovation award
Nominee: 1x

Details provided by the author  
AnimatedCaptcha v1.1 >> 5-31-07

This Animated Gif Captcha system is brought to you courtesy of ...
josh@betteradv.com                                    ==> Josh Storz
http://www.querythe.net/Animated-Gif-Captcha/         ==> Download Current Version

OOP (PHP 4 & 5) Interface by ...
krakjoe@krakjoe.info                                  ==> J Watkins

The GIFEncoder class was written by ...
http://gifs.hu                                        ==>  László Zsidi
http://www.phpclasses.org/browse/package/3163.html    ==>  Download Current Version

This file is part of QueryThe.Net's AnimatedCaptcha Package.

    QueryThe.Net's AnimatedCaptcha is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
    the Free Software Foundation; either version 2.1 of the License, or
    (at your option) any later version.

    QueryThe.Net's AnimatedCaptcha is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public License
    along with QueryThe.Net's AnimatedCaptcha; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA



***********************
**                   **
**     Features      **
**                   **
***********************

- Bold letters & numbers on a white background ... Easy for anyone to read and comprehend
- Layered Captcha image, very hard for robots to decipher
- Random frames number and time elapsed, so if they do decipher the animated gif AnimatedCaptcha will still keep them guessing
- Math oriented so it's language independent
- Questions are simple enough for a 10 year old to answer
- No co-dependencies on the GD library
- PHP 4 or 5 
- Optional Object Oriented Programming
- All browsers (except text based ones) can render a .gif flawlessly
- All answers are positive whole numbers (no decimals or fractions)
- 125 different question combinations by default
    
    

***********************
**                   **
**       Files       **
**                   **
***********************

readme.txt - this file
example.php - working implementation of AnimatedCaptcha
index.php - Displays a randomly generated animated gif & sets session variables
OOP4.php - Object-Oriented version of AnimatedCaptcha for PHP4
OOP5.php - Object-Oriented version of AnimatedCaptcha for PHP5
GIFEncoder.class.php - class for stitching frames together to create animation effect
/frames/ - folder containing all possible images
    - solve.gif ... 1st frame
    - equals.gif ... last frame
    - plus.gif, minus.gif, times.gif ... operators (+,-,*)
    - 0-9.gif ... an image for each possible number
    
    

***********************
**                   **
**   Installation    **
**                   **
***********************

1> Upload the AnimatedCaptcha folder (including sub-folders) to your host in a location visible to the web. Erase the version number at the end of the folder name.
2> Navigate to /AnimatedCaptcha/example.php and try the the script out
3> Implement into your existing site and enjoy a spam free environment :]
    
    

***********************
**                   **
**   Common Hacks    **
**                   **
***********************

1> Implement AnimatedCaptcha using an Object Oriented programming paradigm - OOP4.php & OOP5.php work flawlessly right out of the box.  Goto line 48 in example.php and uncomment your choice of implementations to switch to OOP.
2> Change the way the animation looks - create new frames using The GIMP or Photoshop and upload over the existing images in /frames/.  GIF FORMAT ONLY!!!
3> Increase / Decrease the time elapsed between frames - Seek out $time [ ] array in index.php, OOP4.php or OOP5.php and make your changes. 100 = 1 second.
4> Increase the number of answers - Search out rand(1, 9) in index.php {~line 21 & 22} and change them to your desired settings {ex. rand(0, 99) for random numbers between 0-99}.
5> Only use +/- (no multiplication) - Search out rand(0, 2) in index.php {~line 23} and change to rand(0, 1).
  Files folder image Files  
File Role Description
Files folder imageframes (15 files)
Accessible without login Plain text file example.php Example Working Example
Plain text file GIFEncoder.class.php Class GIFEncoder class
Accessible without login Plain text file index.php Example Main Function - Displays picture & sets session
Plain text file OOP4.php Class OOP4
Plain text file OOP5.php Class OOP5
Accessible without login Plain text file readme.txt Doc. readme

  Files folder image Files  /  frames  
File Role Description
  Accessible without login Image file 0.gif Icon readme
  Accessible without login Image file 1.gif Icon readme
  Accessible without login Image file 2.gif Icon readme
  Accessible without login Image file 3.gif Icon readme
  Accessible without login Image file 4.gif Icon readme
  Accessible without login Image file 5.gif Icon readme
  Accessible without login Image file 6.gif Icon readme
  Accessible without login Image file 7.gif Icon readme
  Accessible without login Image file 8.gif Icon readme
  Accessible without login Image file 9.gif Icon readme
  Accessible without login Image file equals.gif Icon gif frame
  Accessible without login Image file minus.gif Icon gif frame
  Accessible without login Image file plus.gif Icon gif frame
  Accessible without login Image file solve.gif Icon gif frame
  Accessible without login Image file times.gif Icon gif frame

 Version Control Unique User Downloads Download Rankings  
 0%Total:5,954All time:359
 This week:2This week:646Down
User Ratings User Comments (3)  
 All time
Utility:81%StarStarStarStarStar
Consistency:81%StarStarStarStarStar
Documentation:81%StarStarStarStarStar
Examples:83%StarStarStarStarStar
Tests:-
Videos:-
Overall:65%StarStarStarStar
Rank:489
 
The nice thing that I noticed about this app is that it doesn...
4 years ago (Ved)
77%StarStarStarStar
A++
7 years ago (Gavrilov Alexander)
80%StarStarStarStarStar
your best~
7 years ago (ganji)
80%StarStarStarStarStar