PHP Classes

OneClickCaptcha: CAPTCHA validation based on user clicks on circles

Recommend this page to a friend!
  Info   View files Example   Screenshots Screenshots   View files View files (16)   DownloadInstall with Composer Download .zip   Reputation   Support forum (3)   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2024-01-09 (4 days ago) RSS 2.0 feedStarStarStar 58%Total: 807 This week: 2All time: 4,255 This week: 204Up
Version License PHP version Categories
one-click-captcha 1.14GNU General Publi...5.3PHP 5, Graphics, Web services, Valida..., S...
Description 

Author

This class can perform CAPTCHA validation based on user clicks on circles.

It render an image with several circles on random positions. Only one circle appears cut.

The class performs CAPTCHA validation by checking the position where the user clicks on the image to verify it it is inside of the circle that is cut.

The generated image is served in PNG format. The values of the rendered circles are stored in session variables for subsequent validation.

The size and colors of the image and the circles are configurable parameters.

Picture of Kacper Rowinski
  Performance   Level  
Innovation award
Innovation award
Nominee: 8x

 

Example

<?php
declare(strict_types=1);

use
OneClickCaptcha\Service\OneClickCaptchaServiceFactory;

include
__DIR__ . '/../vendor/autoload.php';

ini_set('display_errors', '1');
error_reporting(E_ALL);

$OneClickCaptchaServiceFactory = new OneClickCaptchaServiceFactory();
$oneClickCaptcha = $OneClickCaptchaServiceFactory->getOneClickCaptcha();

// simple demonstration!
$request = $_GET['get_captcha'] ?? '';
if (
$request === 'true') {
    try {
       
$oneClickCaptcha->showCaptcha();
    } catch (
Exception $e) {
        echo
$e->getMessage();
    }
} elseif (isset(
$_REQUEST['position'][0], $_REQUEST['position'][1])) {
    if (
$oneClickCaptcha->validate((int)$_REQUEST['position'][0], (int)$_REQUEST['position'][1])) {
        echo
'<h3>You are human!!</h3>';
    } else {
        echo
'<h3>Wrong!</h3>';
    }
}

// this is all html you need to validate captcha
echo '
<form action="example.php" method="POST">
    <input type="image" src="example.php?get_captcha=true" name="position[]"/>
</form>
'
;


Details

OneClick captcha

Build Status Latest Stable Version Total Downloads Latest Unstable Version License

This lib can perform CAPTCHA validation based on user clicks on circles.

It render an image with several circles on random positions. Only one circle appears cut.

The class performs CAPTCHA validation by checking the position where the user clicks on the image to verify it it is inside of the circle that is cut.

The generated image is served in PNG format. The values of the rendered circles are stored in session variables for subsequent validation.

The size and colors of the image and the circles are configurable parameters.

1. install using composer
composer require krowinski/one-click-captcha
2. example


include __DIR__ . '/../vendor/autoload.php';
error_reporting(E_ALL);
$OneClickCaptchaServiceFactory = new \OneClickCaptcha\Service\OneClickCaptchaServiceFactory();
$oneClickCaptcha = $OneClickCaptchaServiceFactory->getOneClickCaptcha();
// simple demonstration!
$request = isset($_GET['get_captcha']) ? $_GET['get_captcha'] : '';
if ($request === 'true') {
    $oneClickCaptcha->showCaptcha();
} else {
    if (isset($_REQUEST['position'][0], $_REQUEST['position'][1])) {
        if (true === $oneClickCaptcha->validate($_REQUEST['position'][0], $_REQUEST['position'][1])) {
            echo '<h3>You are human!!</h3>';
        } else {
            echo '<h3>Wrong!</h3>';
        }
    }
}
// this is all html you need to validate captcha
echo '
<form action="example.php" method="POST">
	<input type="image" src="example.php?get_captcha=true" name="position[]"/>
</form>
';


Screenshots  
  • occ.png
  Files folder image Files  
File Role Description
Files folder imageexample (1 file)
Files folder imagesrc (4 directories)
Files folder imagetests (4 directories)
Accessible without login Plain text file .gitignore Data Auxiliary data
Accessible without login Plain text file .travis.yml Data Auxiliary data
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file phpunit.xml Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation

 Version Control Unique User Downloads Download Rankings  
 94%
Total:807
This week:2
All time:4,255
This week:204Up
User Ratings User Comments (1)
 All time
Utility:83%StarStarStarStarStar
Consistency:83%StarStarStarStarStar
Documentation:-
Examples:83%StarStarStarStarStar
Tests:-
Videos:-
Overall:58%StarStarStar
Rank:1551
 
Great idea.
10 years ago (Eduardo souza)
70%StarStarStarStar