<?php
session_start();
if(!isset($_SESSION['captcha']))
$_SESSION['captcha']=rand(1000,9999);
$captcha = strtoupper($_SESSION['captcha']);
$im = imagecreatetruecolor(96, 48);
$fil=imagecreatefrompng('b'.rand(1,8).'.png');
$bg = imagecolorallocate($im, rand(10,255),rand(10,255),rand(10,255));
$fg = imagecolorallocate($im, 255, 255, 255);
imagefill($im,0,0,$bg);
//imagestring($im,5, 32, 18,$captcha,$fg);
imagettftext($im,26,0,26,36,$fg,"font.ttf",$captcha);
imagecopy($im,$fil,0,0,0,0,96,48);
// VERY IMPORTANT: Prevent any Browser Cache!!
header("Cache-Control: no-store,no-cache, must-revalidate");
header('Content-type: image/png');
imagepng($im);
imagedestroy($im);
?>
//CODED BY @MD0TM