Jump to content

hit counter does not work


James60

Recommended Posts

 

hello php freaks,

 

i am not a savy php coder. this snippit was given to me & is supposted to create a text file that is automatically updated when someone comes to my site. (www.orehealthquotes.com) but it does not work. what do i need to change to make it work? i have limited knowledge of javascript.

 

thanks

james

 

 

<!-- Add this at the end of the html document

just before the </html> tag -->

 

<?php

 

$message = "Visitors";

 

if(!file_exists("counter.txt")

{

$fp = fopen("counter.txt", "a");

fclose($fp);

}

 

$fp = fopen("counter.txt", "r+");

$str = fread($fp, 1024);

$str += 1;

echo("<br>" . $message . ": " . $str);

fwrite($fp, $str);

fclose($fp);

 

?>

Link to comment
https://forums.phpfreaks.com/topic/86499-hit-counter-does-not-work/
Share on other sites

You probably have it in the wrong area since I dont even see the Visitors echo on your page.

 

Try putting it right under your Last Update instead.

 

Also, your page name has to be .php for it to work and your server needs to support .php code.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.