جرب كذا اخوي
كود PHP:
Header("Content-Type: image/png");
if (isset($_POST['test']))
{
$random = trim($_POST['random']);
if ($new_string == $random)
{
print 'الكود صحيح';
$new_string;
$im = ImageCreate(200, 40);
$white = ImageColorAllocate($im, 255, 255, 255);
$black = ImageColorAllocate($im, 0, 0, 0);
srand((double)microtime()*1000000);
$string = md5(rand(0,9999));
$new_string = substr($string, 17, 5);
ImageFill($im, 0, 0, $black);
ImageString($im, 5, 80, 10, $new_string, $white);
ImagePNG($im, "verify.png");
ImageDestroy($im);
}else{
print 'الكود خطأ';
}
}