Closed Thread Icon

Topic awaiting preservation: counter doesn't work (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=22286" title="Pages that link to Topic awaiting preservation: counter doesn&amp;#039;t work (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: counter doesn&#039;t work <span class="small">(Page 1 of 1)</span>\

 
kronk
Nervous Wreck (II) Inmate

From:
Insane since: Jun 2004

posted posted 06-23-2004 01:33

hi, im making a counter using php. this is my script

<?
if(file_exists("counter.dat"))
{
$exist_file = fopen("counter.dat", "r");
$new_count = fgets($exist_file, 255);
$new_count++;
fclose($exist_file);
print("$new_count people have visited this page");
$exist_count = fopen("counter.dat", "w");
fputs($exist_count, $new_count);
fclose($exist_count);

}

else
{
$new_file = fopen("counter.dat", "w");

fputs($new_file, "1");
print("1 person have visited this page");
fclose($new_file);

}

?>


the problem i have is when i run it on my home server it works just fine, bit when i run it online, it returns 3 errors, 1 stating permission denied and 2 more saying that it cannot 'getss or 'puts' to the file. any suggestions?????

butcher
Paranoid (IV) Inmate

From: New Jersey, USA
Insane since: Oct 2000

posted posted 06-24-2004 03:03

Make sure you have the proper permissions set on the counter.dat file or the PHP script won't be allowed to access it.

-Butcher-

kronk
Nervous Wreck (II) Inmate

From:
Insane since: Jun 2004

posted posted 06-24-2004 12:08

i know close to nothing about permissions, could you extend on your suggestion and tell me how to do that or where i can find out, thanks

Tyberius Prime
Paranoid (IV) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

posted posted 06-24-2004 12:58

read http://www.dartmouth.edu/~rc/help/faq/permissions.html .

and learn to use the [code] tag...

and you should also investigate php->flock - or your counter will break once more than one person is accessing your page.

kronk
Nervous Wreck (II) Inmate

From: Sydney, Australia
Insane since: Jun 2004

posted posted 07-19-2004 16:47

thanks for the help guys,

i finally figured out how to change the permission settings for files and folders on my web server

« BackwardsOnwards »

Show Forum Drop Down Menu