Hey all, I'm havin some trouble with a hit counter I coded for myself... here's the code:
$filename = "hits.txt";
$fp = fopen($filename, "r");
$hits = fgets($fp, 5);
fclose($fp);
$hits = $hits + 1;
$fp = fopen($filename, "w");
fwrite ($fp, "$hits");
fclose($fp);
$fp = fopen ($filename, "r");
$hitsdisplay = fgets($fp, 5);
print $hitsdisplay;
And here's the error message I get from the server...
Warning: fopen("hits.txt", "w") - Permission denied in /mnt/datadisk/users/webs/dcvc.breezeland.com/TMPbbxcqiiw9a.php on line 9
Warning: fwrite(): supplied argument is not a valid File-Handle resource in /mnt/datadisk/users/webs/dcvc.breezeland.com/TMPbbxcqiiw9a.php on line 10
Warning: fclose(): supplied argument is not a valid File-Handle resource in /mnt/datadisk/users/webs/dcvc.breezeland.com/TMPbbxcqiiw9a.php on line 11
1200
The 1200 refers to the content of the hits.txt file.
Any ideas?