https://github.com/krowinski/one-click-captcha
Simple captcha that requires from user to only click a cut circle on image with several other circles. You can customize color of circles, background, width and height of image. Its very lightweight require no js just simple form in html and php gd extension.
https://github.com/krowinski/one-click-captcha
captcha captcha-image captcha-validation circle cut php position
Last synced: 10 months ago
JSON representation
Simple captcha that requires from user to only click a cut circle on image with several other circles. You can customize color of circles, background, width and height of image. Its very lightweight require no js just simple form in html and php gd extension.
- Host: GitHub
- URL: https://github.com/krowinski/one-click-captcha
- Owner: krowinski
- Created: 2013-04-14T18:11:37.000Z (about 13 years ago)
- Default Branch: master
- Last Pushed: 2018-08-06T22:32:32.000Z (almost 8 years ago)
- Last Synced: 2025-04-07T20:56:18.006Z (about 1 year ago)
- Topics: captcha, captcha-image, captcha-validation, circle, cut, php, position
- Language: PHP
- Homepage:
- Size: 23.4 KB
- Stars: 14
- Watchers: 2
- Forks: 5
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# OneClick captcha
[](https://travis-ci.org/krowinski/one-click-captcha)
[](https://packagist.org/packages/krowinski/one-click-captcha) [](https://packagist.org/packages/krowinski/one-click-captcha) [](https://packagist.org/packages/krowinski/one-click-captcha) [](https://packagist.org/packages/krowinski/one-click-captcha)
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 ######
```bash
composer require krowinski/one-click-captcha
```
###### 2. example ######
```php
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 '
You are human!!
';
} else {
echo 'Wrong!
';
}
}
}
// this is all html you need to validate captcha
echo '
';
```