Help
Posted: Sat Jun 19, 2004 5:03 pm
When I try to run my script on my website I get these errors.
Warning: fopen(count.txt): failed to open stream: Permission denied in /home/noah0504/public_html/index.php on line 39
Warning: fgets(): supplied argument is not a valid stream resource in /home/noah0504/public_html/index.php on line 40
Warning: fclose(): supplied argument is not a valid stream resource in /home/noah0504/public_html/index.php on line 46
When I run the script on my local machine, It runs just fine. What's the problem?
Here's my code.
[edit=Weirdan] Noah, use
Warning: fopen(count.txt): failed to open stream: Permission denied in /home/noah0504/public_html/index.php on line 39
Warning: fgets(): supplied argument is not a valid stream resource in /home/noah0504/public_html/index.php on line 40
Warning: fclose(): supplied argument is not a valid stream resource in /home/noah0504/public_html/index.php on line 46
When I run the script on my local machine, It runs just fine. What's the problem?
Here's my code.
Code: Select all
<?php
session_start();
$fp = fopen("count.txt", "r+");
$count = fgets($fp);
if ( !session_is_registered("counted") ) {
fseek($fp, 0, SEEK_SET);
fwrite($fp, ++$count);
session_register("counted");
}
fclose($fp);
echo $count;
?>Code: Select all
tags! [/edit] [/color]