<?php
session_start();
$rand=rand('1000000', '9999999'); 
$_SESSION['rand']=$rand;
header("Content-type: image/png");
$im=imagecreate('70', '20');
$background_color = imagecolorallocate($im, '255', '255', '255');
$text_color = imagecolorallocate($im,'0', '0', '0');
$rand=$_SESSION['rand'];
imagestring($im, '3', '4', '3', "$rand", $text_color);
imagepng($im);
imagedestroy($im);

?>