SGCaptcha: CAPTCHA validation using geometric shapes

Recommend this page to a friend!
  Info   View files Example   Screenshots Screenshots   View files View files (4)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 369 All time: 6,740 This week: 261Up
Version License PHP version Categories
sgcaptcha 1MIT/X Consortium ...5.0PHP 5, Graphics, Validation, Security
Description Author

This class implements CAPTCHA validation using geometric shapes.

It can generate an image with several geometric shapes and associated numbers on them.

The user is required to enter the numbers that are in images of one of the types of geometric shape displayed in the end of the CAPTCHA image.

The correct answer is stored in session variable for subsequent verification.

Innovation Award
PHP Programming Innovation award nominee
July 2014
Number 3

Prize: One downloadable copy of PhpED Professional
CAPTCHA solutions are useful to prevent that sites are abused by robot scripts.

However, some CAPTCHA solutions become a little to hard to authenticate real users.

This class implements an approach that provides a simple solution by letting the users pick numbers associated with given geometric shapes displayed around the numbers.

Manuel Lemos
Picture of Francisco del Aguila
  Performance   Level  
Name: Francisco del Aguila <contact>
Classes: 2 packages by
Country: Spain Spain
Age: 55
All time rank: 169642 in Spain Spain
Week rank: 618 Up24 in Spain Spain Up
Innovation award
Innovation award
Nominee: 2x

Winner: 1x

Simple geometric captcha for PHP

Version 1. 2014-06-07.
Author: Francisco del Aguila (,
Generate a captcha with geometric figures.


    Include the next line in your HTML/PHP webpage:
    <img src="{path}/sgcaptcha.php" alt="Captcha" />
    The captcha solution value is stored in $_SESSION['captcha']
    The key figure appears at right with no value.
    User must input digits inside the key figures. The result may be an empty string.

    See the 'example.php' file.
    You can change the colour schema and length of the key editing the file 'captcha.php'.


    Requires GD library enabled in PHP. 


    This software is published under the MIT license. (see
    This information must remain in all copies of this software.

    Version 1, 2014-06-07. First version.
  • Image1.jpg
  Files folder image Files  
File Role Description
Accessible without login Plain text file example.php Example Sample use of sgcaptcha.php
Accessible without login Plain text file LICENSE.txt Lic. License
Accessible without login Plain text file README.txt Doc. Basic information
Plain text file sgcaptcha.php Class The sgcaptcha class

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:6,740
This week:261Up
For more information send a message to info at phpclasses dot org.