I have had to insert a counter in a page for a client but...
i have used this code before, but for some reason i get this error
Warning: fopen(counter.txt) [function.fopen]: failed to open stream: Permission denied in /counter.php on line 14
301
Warning: fputs(): supplied argument is not a valid stream resource in /counter.php on line 20
Warning: fclose(): supplied argument is not a valid stream resource in /counter.php on line 22
PHP Code:
<?php
$counter = "counter.txt"; function displayCounter($counter) {
$fp = fopen($counter,rw);
$num = fgets($fp,9999);
fclose($fp);
$fp = fopen($counter,w);
$num += 1;
print "$num";
fputs($fp, $num);
fclose($fp);
} displayCounter($counter);
?>
Its got me stumped! Any ideas??
p.s the site has PHP enabled and the counter.txt just has a number in there so i didnt post it
Thanks guys and gals 
|