Re: Counting the number of hits on a webpage

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



write following code in your "index.php"

      $file = "log/counter.txt";
      $open = fopen($file, "r");
      $size = filesize($file);
      $count = (int)fread($open, $size);
      fclose($open);
      $count++;
      $string = (string)($count*1);
      $open = fopen($file, "w");
      fwrite($open,$string);
      fclose($open);

make a file "counter.txt" in folder log (if not exist than make it). give
read/write rights to it. Put any number in "counter.txt" from where you want
to start the counter.

SIMPLE

On Thu, Jul 10, 2008 at 6:54 AM, José Miguel Santibáñez A. <jms@xxxxxxxxx>
wrote:

>
> > Hi I would like to know how do we count the number of hits on a
> > webpage. Is this possible to implement within PHP and if so then how?
> >
> > Also are there any reliable programs that do the above in a more
> > efficient way for example any webpage?
> >
> > I have an existing page on the server and I would like to check the
> > above for the same. Maybe handy would also be a graphical analysis in
> > the form of a bar/pie chart diagram.
> >
>
> like bbclone???
> http://bbclone.de/
>
> --
> José Miguel Santibáñez
> jms@xxxxxxxxx <jms%40nivel5.cl>
>  
>


[Non-text portions of this message have been removed]


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux