View file funin/captcha.php
<?php
define('WIDTH',65);
define('HEIGHT',30);
$img=imagecreate(WIDTH,HEIGHT);
$clr=imagecolorallocate($img,250,225,225);
$clr=imagecolorallocate($img,20,0,0);
$text="";
for($i=1;$i<6;$i++)
{
$text=(rand(1000,9955));
}
imagestring($img,5,14,6,$text,$clr);
header("content-type:image/png");
imagepng($img);
session_start();
$_SESSION["captcha"]=sha1($text);
imagedestroy($img);
?>