Skip to content
This repository has been archived by the owner on Apr 11, 2018. It is now read-only.
/ owncaptcha Public archive

[deprecated] Detects human/robots easily!

License

Notifications You must be signed in to change notification settings

mostofreddy/owncaptcha

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DEPRECATED

OwnCaptcha

Detects human/robots easily!

Build Status Dependency Status

Version

0.2.1

Features

  • Lifetime
  • Saves the captcha in session
  • Generates the captcha in png format
  • XSS clean
  • Extensible using adapters
  • Apdaters: random text, math equation

License

This content is released under the MIT License

Installation

Requirements

  • PHP 5.3.*

Github

cd /var/www
git clone https://github.com/rocket-code/owncaptcha.git
cd owncaptcha
composer install

Composer

"require": {
    "php": ">=5.3.0",
    "rocketcode/owncaptcha": "*",
}

Roadmap & issues

Roadmap & issues

Changelog

0.2.2 (development)

  • Add unit testing

0.2.1

  • Change repository url
  • Update composer.json
  • Update docblock
  • Travis-CI integration

0.2.0

  • Math image adapter
  • New examples
  • Unit testing
  • Change function name: setSessionVar to sessionVar
  • Change function name in \owncaptcha\Captcha class: draw to build

0.1.0

  • Text image adapter
  • Session storage
  • Captcha validation

Examples

View examples

Docs

Captcha

Tiempo de vida del captcha

El tiempo de vida del captcha se configura mediante el método ttl. Default: 60 seg

$captcha = new \owncaptcha\Catpcha();
$captcha->ttl(3600); //1 hora

Sessiones

Habilitar/deshabilitar sessiones

Para habilitar/deshabilitar que el script guarde el valor del captcha en sessiones: Default: true

$captcha->sessionSave(true); //o false

Variable donde se almacena el valor del capcha en session

Con el método setSessionVar se puede cambiar la variable donde se almacena el captcha en session Default: owncaptcha

$captcha->sessionVar('myvar');

Validación

La validación se realiza con el método validate

$code = (isset($_POST['code']))?$_POST['code']:'';
$result = $captcha->validate($code); // true or false

Apdaters

Los adapters son distintas clases que implementan la lógica de como renderizar el captcha.

TextImage

Crea imagen con un texto aleatorio.

$adapter = new \owncaptcha\adapters\TextImage();
$adapter->config(
    array(....)
);
  • width: (int) ancho de la imagen
  • height: (int) alto de la imagen
  • bg: (array) color de fondo (rgb)
  • forecolor: (array) color del testo (rgb)
  • linecolor: (array) color de las lineas del fondo (rgb)
  • lines: (int) cantidad de lineas en el fondo
  • enablettf: (bool) indica si se usa una tipografia ttf o del sistema (true: usa ttf, false: usa del sistema)
  • ttf: (string) ubicación de la fuente ttf
  • fontsize: (int) tamaño de la fuente ttf
  • padding: (int) padding de la imagen
  • lineweight: (int) grosor de las lineas de fondo

MathImage

Crea imagen con una ecuación matemática.

$adapter = new \owncaptcha\adapters\MathImage();

About

[deprecated] Detects human/robots easily!

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages