<?php 
include("require.php");
session_start();
$authnum=random(4); 
$_SESSION['auth']=$authnum;
Header("Content-type: image/PNG"); 
$im = imagecreate(50,18);
$red = ImageColorAllocate($im, 255,255,255); //设置背景颜色 
$white = ImageColorAllocate($im, 0,0,0);//设置文字颜色 
$gray = ImageColorAllocate($im, 255,255,255); //设置杂点颜色 
imagefill($im,50,18,$red); 
imagestring($im, 6,4,1,$authnum,$white);
ImagePNG($im); 
ImageDestroy($im);
?>