Configurable Captcha generator for Code Igniter


What is a captcha ?

What is Code Igniter ?

Requirements ?

Contents of the zip file ?

How to install ?

Configure how and what ?

How to call ?

How to check ?

Some Samples

Download

Thanks


What is a captcha ?

A captcha is an image containing a code made of random alphanumeric characters.
They are integrated into websites, generaly in forms, to verify if the user is an human or not (robot).
So that the goal is also to scramble OCR detection, it contains generaly some jamming informations
(blur background, blur characters, jamming lines,...).

top

What is Code Igniter ?

CI is a PHP based MVC (Model View Controller) framework.
You will find more about Code Igniter here.

top

Requirements ?

  1. Knomledge of PHP and Code Igniter ...
  2. Code Igniter framework
  3. GD installed on your webserver
  4. Session library enabled on your CI controller or autoloaded
top

Contents of the zip file ?

sig.php: the controller file
sig_model.php: the model file
sig_config.php: the configuration file
sig_read_me.html: this file
sig_captcha.png: sample of background image
arial.ttf: sample of font file
samples: a folder containing the samples you can see here under
top

How to install ?

sig.php: save in CI "controllers" folder
sig_model.php: save in CI "models" folder
sig_config.php: save in CI "config" folder
sig_captcha.png: save where ever you want if needed
arial.ttf: save where ever you want if needed
top

Configure how and what ?

It is very easy and all the configurable parameters, with their explanations, are in the file "sig_config.php".

What can you configure ?

top

How to call ?

When you want to generate a security image you just have to point it as http://domain/sig

In the form it would looks like this :

<form headers ... >
...
Validation Code:
<img src="<?php echo base_url().'sig'; ?>" alt="CAPTCHA">
<input type="text" name="code" size="10">
...
</form>

top

How to check ?

To check the captcha agains the input form code, just add something like this :

if ($this->input->post('code') != $this->session->userdata('sig_key')) { echo 'error'; } else { echo 'success'; }

or like this :

if ($this->input->post('code') != $this->obj->db_session->userdata('sig_key')) { echo 'error'; } else { echo 'success'; }

on the controller/file that does your submit.

top

Some Samples

background image background color shadow text angle text
variable size text horizontal lines vertical lines grid
random horizontal lines random vertical lines random horizontal  angle lines random vertical angle lines
random horizontal and vertical angle lines ellipses lines rectangles lines polygonal lines
horizontal and vertical and ellipse lines ellipse and rectangle lines horizontal and vertical and polygonal lines all options
top

Download

Feel free to download it, use it and modify it like you want.

SecurityImageGenerator.zip

top

Thanks

Special thanks to Stupid Shrimp (Baka Ebi) who developped his captcha generator and on which this one is based.

top