Home > PHP > create you own captcha

create you own captcha

Somedays ago i’ve found a php captcha script from one of my php boss bhaia.But i don’t understand why his script does not work in my local server.But whatever i’ve made one of my own with the help of his script.
You can say it,2nd version of his script for me.

here what i’ve got.

$im = imagecreate(60, 30);
$RandomStr = md5(microtime());

$ResultStr = substr($RandomStr,0,5);
$bg = imagecolorallocate($im, 200, 255, 255);
$textcolor = imagecolorallocate($im, 200, 0, 255);
imagestring($im, 5, 6, 6, $ResultStr, $textcolor);

header("Content-type: image/jpg");

now name it captcha.php
now if you want to use it in a form or somwhere else you just write this:

<img src="captcha.php"/>


Categories: PHP
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s

%d bloggers like this: