<?php
session_start();
$_SESSION['captcha'] = rand(1000, 9999);
$image = imagecreatetruecolor(120, 40);
$black = imagecolorallocate($image, 0, 0, 0);
$color = imagecolorallocate($image, 200, 100, 90);
$white = imagecolorallocate($image, 255, 255, 255);
imagefilledrectangle($image,0,0,399,99,$white);
imagettftext ($image, 30, 0, 10, 40, $color, __DIR__."/verdana.ttf", $_SESSION['captcha']);
header("Content-type: image/png");
imagepng($image);
?>