File size: 682B
<?php
# author Drk in
session_start();
$width = 73;
$height = 38;
$im = imagecreatetruecolor($width, $height);
imagefill($im, 0, 0, imagecolorallocate($im, 255, 255, 255));
$captcha = NULL;
for($i=0; $i<5; $i++):
$y = rand(2, 5);
$x += rand(8, 14);
$captcha .= rand(1, 9);
imagestring($im, rand(1, 10), $x, $y, $captcha[$i],
imagecolorallocate($im, rand(90, 150), rand(90, 150), rand(90, 150)));
endfor;
$_SESSION['captcha'] = $captcha;
header('Content-type: image/jpeg');
imagepng($im);
imagedestroy($im);
?>