ImageCode module Version: 1.1
NAME
ImageCode - Perl module for providing Turing test in online form proccessing.
SYNOPSIS
use ImageCode;
# create a new ImageCode object
my $imagecode = ImageCode->new();
# generate encrypted password
my ($icode,$hcode)=$imagecode -> generatepass();
# create form (see example.pl)
# You form code here
# parse form data and get $hcode and $vcode variables
# check for a valid submitted data
my $status = $imagecode -> checkpass($hcode,$vcode);
# variable $status can accept values :
# 1 - Passed
# 2 - Code was expired
# 3 - Invalid code
# that all !
|
DESCRIPTION
Allows you to protect online forms from abuse by carrying out on-the-fly Turing test (read more).
Does not require additional applications, including databases, sessions, folders with pictures and fonts etc.
Easily adaptable application allows you to change parameters of the picture such as the size, font, colors, degree of distortion, quantity of symbols, etc.
quickly.
METHODS
MAIN METHODS
$imagecode = ImageCode->new();
-
This creates a new ImageCode object. Optionally, you can pass in a hash with configuration information. See the method descriptions for more detail on what
they mean.
my $imagecode = ImageCode->new(
passlength =>8,
expires =>1,
chars => [0..9]
);
|
-
($icode,$hcode)=$imagecode -> generatepass();
-
Generate encrypted data for hidden field ($hcode) and for image script ($icode).
$status = $imagecode -> checkpass($hcode,$vcode);
-
Checks submitted data.
Variable $vcode is the submitted letter combination guess from the user.
For description $hcode see above.
Variable $status can accept values :
1 - Passed
2 - Code was expired
3 - Invalid code
CONFIGURATION
$imagecode -> chars(@array);
-
Sets the array of symbols or words available for picture generation.
Default array contains digits, lowercase and capital letters from a to z.
Examples :
$imagecode -> chars([0..9]); - use only digits.
$imagecode -> chars(['word','word1','word2']); use word sequence word, word1, word2.
$imagecode -> passlength($int);
-
Sets password length in symbols or words.
Can accept integer values from 1 to 9.
Default value is 5.
$imagecode -> expires($int);
-
Sets expiration period in minutes.
Default expiration period value is 30 minutes.
$imagecode -> encryptkey($anyword);
-
Sets the encryption/decryption key.
It is applied to increase security at use module for protection several online forms.
Do not forget to change this key in the module used by default.
IMAGE CONFIGURATION
$imagecode -> font('Generic.ttf');
-
Sets the font.
REMEMBER:Be sure what font file exist in the same folder.
Default font is ARIALNB.ttf.
$imagecode -> fontsize($int);
-
Sets the font size.
Default is 30.
$imagecode -> fontcolors(@array);
-
Sets the array of font colors used in picture generation.
Default font color is black.
Examples :
$imagecode -> fontcolors([qw{blue blueviolet brown olivedrab mediumorchid lightseagreen burlywood}]);
$imagecode -> fontcolors(['#800000','#008000', '#000080']);
$imagecode -> bgcolors(@array);
-
Sets the array of background colors available for picture generation.
Default background color is white.
$imagecode -> gridcolor($string);
-
Sets the grid color.
Default grid color is gray.
$imagecode -> addnoise($boolean);
-
Adds noise.
Can accept values 0 or 1.
Set 1 if you want to add noice in to you picture (CAPTCHA).
Default value is 0 (no noise).
$imagecode -> scatter($double);
-
Sets the range of scatter of symbols in picture.
Can accept values from 0 to 1.
Zerro means no scatter.
Default value is 0.5.
REQUIRES
Image::Magick Perl module: http://www.imagemagick.org/
SEE ALSO
The Captcha project: http://www.captcha.net/
Online documentation: http://www.progland.com/ImageCode.html
AUTHOR
Vadim N. Suvorov, <dimma@progland.com>
COPYRIGHT
Copyright (c) 2004, ProgLand, Inc.
Copyright (c) 2003 Vadim N. Suvorov
|