stat hit counter HELP

Reply

Join Date: Jul 2008
Posts: 5
Reputation: kheikhei is an unknown quantity at this point 
Solved Threads: 0
kheikhei kheikhei is offline Offline
Newbie Poster

stat hit counter HELP

 
0
  #1
Jul 31st, 2008
how to create a stat counter for the hits,output it everyday
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 1,072
Reputation: Shanti Chepuru is on a distinguished road 
Solved Threads: 98
Shanti Chepuru's Avatar
Shanti Chepuru Shanti Chepuru is offline Offline
Veteran Poster

Re: stat hit counter HELP

 
0
  #2
Jul 31st, 2008
Here is a neat and helpful PHP script that can count unique page views on your website. First you need to open up a new page in your text editor and paste in this code.
  1. <?php
  2. $filename = "hits.txt";
  3.  
  4. $file = file($filename);
  5. $file = array_unique($file);
  6. $hits = count($file);
  7. echo $hits;
  8.  
  9. $fd = fopen ($filename , "r");
  10. $fstring = fread ($fd , filesize ($filename));
  11. fclose($fd);
  12. $fd = fopen ($filename , "w");
  13. $fcounted = $fstring."\n".getenv("REMOTE_ADDR");
then save the page as counter.php

Next open up another new page in your text editor and just save it as hits.txt
Then upload all of the files onto your server and CHMOD hits.txt to 0777 or just 777.
After that open up your main page or the page you will be placing the counter on and pste in the following code.
  1. <?php
  2. include ('counter.php');
  3. ?>
then save and close that page. If needed, re-upload the file(s) to your server. Very simple and easy to use.


check this for reference:
http://www.doheth.co.uk/codelair/php-mysql/hit-counter
Last edited by Shanti Chepuru; Jul 31st, 2008 at 6:00 am. Reason: add
Be intelligent, But Don't try to cheat.. Be innocent But Don't get cheated..
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC