0

Hey guys, this is my first post.
I'm having problems with a flat-file unique hits counter which I found online at in obscuro.

I installed everything properly, but whenever I try going to the "showcounter.php" file to display the total amount of hits I have received, the page freezes up and I get an error_log in my folder which displays this:

PHP Warning:  fread(): supplied argument is not a valid stream resource in /directory/showcounter.php on line 12
PHP Warning:  feof(): supplied argument is not a valid stream resource in /directory/showcounter.php on line 11

Now, I do not believe that I am allowed to post the code used, but in the link above I linked to the tutorial which I got the code from. The link is legit and you don't have to download anything, I promise.

Thank you in advance!

4
Contributors
10
Replies
11
Views
7 Years
Discussion Span
Last Post by vivi288
Featured Replies
  • As far as I could see, there does not exist a counter folder in which a count.db exists. So create a folder named "counter" and create a file in that named "count.db" ~G Read More

  • To grant a PHP write permissions in a directory owned by you, the only option you have is to set the directory's permissions to 0777 (world-writeable). Read More

  • try the php chmod() function [url]http://www.w3schools.com/php/func_filesystem_chmod.asp[/url] Read More

1

As far as I could see, there does not exist a counter folder in which a count.db exists. So create a folder named "counter" and create a file in that named "count.db"

~G

0

Thank you for the responses guys but...

I had a counter folder; I just removed it from the error lines because the directory was too long. The permissions for the folder is set to 755.
Also, the only files which were chmoded were ip.db and counter.db (to 666).

Each file works except for the showcounter.php file. Should I change the permissions?

Edited by vivi288: n/a

0

data folder should be set to 0777 and it is and the files inside should be 0666

Edited by rajarajan07: n/a

0

Setting the folder to 0777 and the files inside to 0666 causes a hiccup on the server, so it automatically rewrites them back to their original settings.

Edited by vivi288: n/a

1

To grant a PHP write permissions in a directory owned by you, the only option you have is to set the directory's permissions to 0777 (world-writeable).

0

rajarajan was right... it's all about file permission. You must edit it either through ftp or explicitly define it using php chmod() function. set the permission to 0775

0

Well, I have been trying your solution rajarajan07, but my server keeps changing the permissions to something "safer".

Is there any way I can bypass this?

0

Also tried that, it didn't work.

I think I give up on this; after researching it seems that my host doesn't allow anything higher than a 755.

php scripts run with super user privledges, so chmod 755 is effecitvely the same as 777

It's not working with a 0755 though and it keeps rewriting my files from 0666 to 0644, so I think my host is to blame here.

Thanks guys for your responses and time, I really appreciate it!

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.