THis script is SUPPOSED to genereate numbers in png format for verification on a form, but whenever I try to use it I get:
In fact, when I load the file into my browser, I get:
The image “http://xxxxxxxxxxxx.com/forum/rand.php” cannot be displayed, because it contains errors.
Well, here's the rand.php file, too:
<?php
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Content-Type: image/png");
session_start();
$im = ImageCreate(80, 25);
$white = ImageColorAllocate($im, 255, 255, 255);
$black = ImageColorAllocate($im, 0, 0, 0);
$string = md5(rand(0,9999));
$_SESSION["new_string"] = substr($string, 17, 5);
ImageFill($im, 0, 0, $black);
ImageString($im, 4, 15, 5, $_SESSION["new_string"], $white);
ImagePNG($im);
ImageDestroy($im);
?>
Any and all help is appreciated!!