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
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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.