Did it slightly different...
In the main file (default/personal/etc) I just set the variable up:
<?
$FileName = "default"
?>
Then in the include file (tail.php) I included the following where I wanted the counter to display:
<?
$file = "counter-" . $FileName . ".txt";//file containing hit count
$open = fopen($file, "r");
$hits = filesize($file);
$counter = fread($open, $hits);
fclose($open);
$open = fopen($file, "w");
++$counter;//adds 1 to ammount and displays it, to display before adding amount, change to $counter++
fwrite($open, $counter);
fclose($open);
echo $counter;
?>
and it seems to work perfectly, got two counters working independently of each other... Only recording another 6 counters so it easy from here in!
Thanks for peoples help, much appreciated!
Rich |