php counter
| From: | Anthony Ritter | Date: | Tue, 06 Aug 2002 21:13:22 +0000 |
| Subject: | php counter | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-111427@lists.php.net to get a copy of this message | ||
Trying to test a counter using php / MS Windows 98 / Apache with three .jpg
files.
They are named:
1.jpg
2.jpg
3.jpg
and are stored in a folder called:
images
which is in the same directory as Counter.txt
within
htdocs.
I run the following script but the images do not appear.
Thanking all in advance.
Tony Ritter
............................................................
<?
$counter_file="./Counter.txt";
$image_dir="./images";
if(!($fp=fopen($counter_file, "r")))die("Couldn't open the file");
$counter=(int)fread($fp, 20);
fclose($fp);
$counter++;
for($i=0; $i<strlen($counter); $i++)
{
$image_scr=$image_dir."/".substr($counter, $i, 1).".jpg";
$image_tag_str.="<IMG SCR=\"$image_src\" BORDER=\"0\">";
}
echo "You are visitor $image_tag_str";
$fp=fopen($counter_file, "w");
fwrite($fp,$counter);
fclose($fp);
?>