hey i have a verification script, and everytime i try it out, the picture is always different than the actual code. for example the image would be "amsk9832sf" however the actual code would have to equal "smkm090900"
verification.php
<?php
include ( "verification_rand.php" );
$image = imagecreate(120, 25);
$bgColor = imagecolorallocate ($image, 255, 255, 255);
$textColor = imagecolorallocate ($image, 0, 0, 0);
imagestring ($image, 10, 10, 8, $rand, $textColor);
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/jpeg');
imagejpeg($image);
imagedestroy($image);
?>
verification_rand.php
<?php
function rand_str($len = 10, $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789')
{
$num_chars = strlen($chars);
$ret = '';
for($i = 0; $i < $len; ++$i)
{
$ret .= $chars[mt_rand(0, $num_chars)];
}
return $ret;
}
$rand = rand_str();
?>
and then i would test it out by creating a test.php page with the following
<?php
include ( "verification_rand.php" );
echo $rand;
?>
<img src='/verification.jpeg'>
then, the image verification would be totally different from the echoed $rand!