WEB COUNTER 2 - found a script, won't work :)

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
CMG
Forum Newbie
Posts: 10
Joined: Sat Oct 08, 2005 10:15 am

WEB COUNTER 2 - found a script, won't work :)

Post by CMG »

Hi,
I have found a great hit counter script at http://www.phpjunkyard.com/php-text-hit-counter.php

Code: Select all

>> Quick installation

Upload counter.php file into a folder in your public directory (where the rest of your website is; usually "public_html", "www" or "site").
Example: /public_html/counter
Corresponding URL: http://www.yourdomain.com/counter/counter.php

Within the same folder create a new folder called "logs" (on many servers names are CaSe SeNsiTiVE). Make sure this folder is world-writable (on UNIX servers issue command CHMOD 777 (rwx-rwx-rwx))
Example: public_html/counter/logs

Now to make your counter work just use this piece of code on your site:

<SCRIPT LANGUAGE="Javascript" SRC="http://www.domain.com/counter/counter.php?page=PAGENAME"><!--
//--></SCRIPT>

Change the SRC parameter accordingly (to your counter.php URL)! Change PAGENAME to a unique name for each page you want track hits on (use numbers and letter only, no spaces or other chars).
Example:
On index.html you would use http://www.domain.com/counter/counter.php?page=index
On someotherpage.html you would use http://www.domain.com/counter/counter.php?page=otherpage
etc...
Ok, so I did as it says. I've got my hands on a domain, made a subfolder in it called "ps", and another folder in it called "logs".

http://www.elena-antimonova.com/ps/

copied the counter.php into the ps folder and made an index.html file

Code: Select all

<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
</head>

<body>

<p>*******************************</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
TEST</p>
<p>&nbsp;


<SCRIPT LANGUAGE="Javascript" SRC="http://www.elena-antimonova.com/ps/counter.php?page=index"><!--
//--></SCRIPT>


</p>
<p>*******************************</p>

</body>

</html>

The line
<SCRIPT LANGUAGE="Javascript" SRC="http://www.elena-antimonova.com/ps/coun ... ndex"><!--
//--></SCRIPT>

seems correct, yet it won't work! 8O

See http://www.elena-antimonova.com/ps/

And if I try to access the http://www.elena-antimonova.com/ps/counter.php file, it says

Warning: fopen(logs/.log): failed to open stream: Permission denied in /home/elenaant/public_html/ps/counter.php on line 66
Can't open/write the log file, please CHMOD logs folder to 777 (rwx-rwx-rwx)!



What would you suggest?
Thanx! :D
CMG
Forum Newbie
Posts: 10
Joined: Sat Oct 08, 2005 10:15 am

Post by CMG »

Geat! Got it working! Yet...

When I insert it into the big webpage, it makes it load rather wiered, jumping. Do you think it could be somehow possible to make it load last ( only after everything else has loaded ) ?

Thanx!
CMG
Forum Newbie
Posts: 10
Joined: Sat Oct 08, 2005 10:15 am

Post by CMG »

Figured it out, never mind :)
Post Reply