Hi, I have an image-based PHP counter with 10 integer GIFs and 1 comma GIF. The counter works fine, and indexes to a flat dat file called PIE.dat in (where else) my /PIZZA directory heh. The problem is, try as I might I cannot get the COMMA GIF to activate.
I set PIE.dat to begin counting at 995.
The PHP counter needs to be able to negotiate the comma-positions (1,000 and 100,000 for example) independent of PIE.dat's absence of commas. Right now it's just outputting "1000". Here is the script; any help would be greatly appreciated!
Skye
— — — — — — — — — — — — — — — — — — — — — — — — — —
<?php
function Use_Pictures ($pc)
{
$site=".";
$new1="<img src=\"$site/one.gif\">";
$new2="<img src=\"$site/two.gif\">";
$new3="<img src=\"$site/three.gif\">";
$new4="<img src=\"$site/four.gif\">";
$new5="<img src=\"$site/five.gif\">";
$new6="<img src=\"$site/six.gif\">";
$new7="<img src=\"$site/seven.gif\">";
$new8="<img src=\"$site/eight.gif\">";
$new9="<img src=\"$site/nine.gif\">";
$new0="<img src=\"$site/zero.gif\">";
$comma="<img src='$site/comma.gif'>";
$count=$pc;
$count = ereg_replace ("1","$new1","$count");
$count = ereg_replace ("2","$new2","$count");
$count = ereg_replace ("3","$new3","$count");
$count = ereg_replace ("4","$new4","$count");
$count = ereg_replace ("5","$new5","$count");
$count = ereg_replace ("6","$new6","$count");
$count = ereg_replace ("7","$new7","$count");
$count = ereg_replace ("8","$new8","$count");
$count = ereg_replace ("9","$new9","$count");
$count = ereg_replace ("0","$new0","$count");
$count = ereg_replace (",","$comma","$count");
return $count;
}
if ($hitflag != 1) {
$hitflag = 1;
$filename = "./PIZZA/PIE.dat";
$filesize = filesize("$filename");
$result = file_exists("$filename");
if ($result != "") {
$fd = fopen( $filename, "r" );
$contents = fread($fd, filesize($filename));
// echo "Contents before = $contents <br> \n";
fclose($fd);
}
else {
$contents = 0;
}
if ($filesize < 5000) {
$fd = fopen( $filename, "w" );
$contents = $contents + 1;
// echo "Contents after = $contents <br> \n";
fputs($fd, "$contents");
number_format($contents);
$contents1=Use_Pictures($contents);
echo $contents1;
}
}
?>
— — — — — — — — — — — — — — — — — — — — — — — — — —