Riboflavin
01-12-2005, 12:35 AM
I just started looking into PHP today but anyways here the short code im trying to write for basically a hit counter.
This is uploaded in a file called count.php
<?php
$name = file("hits.txt");
$add ++;
$write = fopen("hits.txt", "w");
fputs($write , "$add");
fclose($write);
readfile("hits.txt");
?>
Then I uploaded a file called hits.txt with just "0" written in it.
In the index file I have include(count.php)
The first time it loads it displays nothing the second time it displays a '1' then it just keeps at '1' no matter how many times it loads.
Thanks for any help
This is uploaded in a file called count.php
<?php
$name = file("hits.txt");
$add ++;
$write = fopen("hits.txt", "w");
fputs($write , "$add");
fclose($write);
readfile("hits.txt");
?>
Then I uploaded a file called hits.txt with just "0" written in it.
In the index file I have include(count.php)
The first time it loads it displays nothing the second time it displays a '1' then it just keeps at '1' no matter how many times it loads.
Thanks for any help