++ed by:
STAUGAARD

1 PAUSE user
1 non-PAUSE user.

Burak Gürsoy

NAME

demo.pl - GD::SecurityImage demo program.

SYNOPSIS

This is a CGI program. Run from web.

DESCRIPTION

This program demonstrates the abilities of GD::SecurityImage. It needs these CPAN modules:

   DBI
   DBD::mysql
   Apache::Session::MySQL
   String::Random
   GD::SecurityImage    (with GD or Image::Magick)

and these CORE modules:

   CGI
   Cwd
   Time::HiRes

Also, be sure to use recent versions of GD. This demo needs at least version 1.31 of GD. And if you want to use Image::Magick it must be 6.0.4 or newer.

You'll also need a MySQL server to run the program. You must create a table with this SQL code:

   CREATE TABLE sessions (
      id char(32) not null primary key,
      a_session text
   );

If you want to use another table name (not sessions), set the $config{table_name} to the value you want and also modify the SQL code above. With the default configuration option, this program assumes that you have a database named gdsi. Change this option to the database name you want to use.

Security images are generated with the sample ttf font "StayPuft.ttf". Put it into the same folder as this program or alter $config{font} value. If you want to use another font file, you may need to alter the image generation options (see the %config hash on top of the program code).

DEMO SCREENSHOTS

Here are some sample screen shots showing this demo in action.


Enter demo.pl


Validation Failed


Validation Succeeded

All images in this document are generously hosted by ImageShack

CAVEAT EMPTOR

Note that, this is only a demo. Use at your own risk!

  • No security checks are performed.

  • This demo may not be secure or memory friendly.

  • You don't have to use the bundled sample font. If you don't like it, just use some other font that you like, but be sure to adjust several parameters for a human readable graphic.

  • There are several pre-defined "styles" for generating images. You can create your own style(s) playing with the parameters.

  • Do not use this demo's code as a base for your application. Your own implementation will probably be much more cleaner and shorter. This demo includes dirty and undocumented code!

SEE ALSO

GD::SecurityImage.

AUTHOR

Burak Gürsoy, <burak@cpan.org>

COPYRIGHT

Copyright 2004-2007 Burak Gürsoy. All rights reserved.

LICENSE

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.