LogicOpinion
04-15-2008, 11:34 AM
Hello,
using code below i am trying to make a random image which will display random Code using of 5 Digits.
Here is the code:
<?php
function anti_bot($lenght=6)
{
$number = "";
for ($i = 1; $i <= $lenght; $i++)
{
$number .= rand(0,9)."";
}
$width = 11*$lenght;
$height = 30;
$img = ImageCreate($width, $height);
$background = imagecolorallocate($img,255,255,255);
$color_black = imagecolorallocate($img,0,0,0);
$color_grey = imagecolorallocate($img,169,169,169);
imagerectangle($img,0, 0,$width-1,$height-1,$color_grey);
imagestring($img, 5, $lenght, 7, $number, $color_black);
imagepng($img);
imagedestroy($img);
}
anti_bot();
?>
In IE it works fine.. But in FF it displays something strange and i do not understand why?
And here is what it displays in FF and also in IE sometimes:
ЙPNG ��� IHDR���B������еv ч��� PLTE€€€���©©©x7”^���АIDATxЬЌТ1Д0„Е{ ІњІШВ~С»�о)‘ЉТM"!Оы�ЦЛЌ»^[Сq&_M«mzeџ–лµблюрIю.бwP<ЄЙ§T����IENDЃB`В
maybe someone has any suggestations about that.
Thanks
using code below i am trying to make a random image which will display random Code using of 5 Digits.
Here is the code:
<?php
function anti_bot($lenght=6)
{
$number = "";
for ($i = 1; $i <= $lenght; $i++)
{
$number .= rand(0,9)."";
}
$width = 11*$lenght;
$height = 30;
$img = ImageCreate($width, $height);
$background = imagecolorallocate($img,255,255,255);
$color_black = imagecolorallocate($img,0,0,0);
$color_grey = imagecolorallocate($img,169,169,169);
imagerectangle($img,0, 0,$width-1,$height-1,$color_grey);
imagestring($img, 5, $lenght, 7, $number, $color_black);
imagepng($img);
imagedestroy($img);
}
anti_bot();
?>
In IE it works fine.. But in FF it displays something strange and i do not understand why?
And here is what it displays in FF and also in IE sometimes:
ЙPNG ��� IHDR���B������еv ч��� PLTE€€€���©©©x7”^���АIDATxЬЌТ1Д0„Е{ ІњІШВ~С»�о)‘ЉТM"!Оы�ЦЛЌ»^[Сq&_M«mzeџ–лµблюрIю.бwP<ЄЙ§T����IENDЃB`В
maybe someone has any suggestations about that.
Thanks