<?php
session_start();
$captcha = rand(10000,99999);
$code = $captcha;
$_SESSION['rand_code'] = $code; //SESIQTA CHREZ KOQTO SHTE RAZPOZNAVATE KODA
$width = 90;
$height = 25;
$image = imagecreate($width,$height);
$background = imagecolorallocate($image,120,55,145);
$foreground = imagecolorallocate($image,245,245,245);
imagestring($image,20,20,5, $captcha, $foreground);
header('Content-type: image/jpeg');
imagejpeg($image);
imagedestroy($image);
?>