<?
$_SESSION['codes'] = $rand = mt_rand(100000, 999999);
$image = imagecreate(50, 15);
$background_color = imagecolorallocate($image, 250, 250, 250);
$color = imagecolorallocate($image, 122, 142, 184);
imagestring($image, 3, 2, 1, $rand, $color);
header('Content-Type: image/gif');
imagegif($image);
imagedestroy($image);
?>