Security Image (captcha)

I have created a class to easy the pain of generating captcha functionality on your registration (and what ever else) pages. Its a simple class and easy to use.

You can download here: Download Page

– Php5+ (with GD enabled)
– GD


$width = 100;
$height = 80;
$Chars = 8; //number of characters.
$lines = 100; //number of background lines.
$SecurityImage = new SecImg($width, $height, $Chars, $lines);
Here is an example setup for complete usage:


<img src=”securityImage.php”>
<input type=”text” name=”securityCode”>

<input type=”submit” value=”submit”>


:::::::::: Now for SecurityImage.php


$img = new SecImg(100,40);

$_SESSION[‘securityCode’] = $img->code;


:::::::::: Then you can validate in your registration page processing script like



if($_POST[‘securityCode’] != $_SESSION[‘securityCode’])
die(“Security Code does not match”);


Like I said, that is an example, there are many ways to do it. Well I hope you find this useful and I look forward to contributing more in the future.



3 responses to “Security Image (captcha)

  1. cant see sucurity code

  2. Not able to create an image. Does it requires something more?

  3. Its actually a nice and helpful piece of information. Im glad that you shared this useful information with us. Please keep us up to date like this. Thanks for sharing. ebfeeegeadck

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s