Warning: Undefined array key "HTTP_ACCEPT_ENCODING" in /home/freeguppyorg/sites/ghc.freeguppy.org/inc/hpage.inc on line 45
GuppY Help Center - Add a visitor counter

Add a visitor counter

To add a visitor counter (number of time different visitors viewed the page), you need 2 files, one for the counter data, and the other to manage the visitors. You also need to add a few lines of php code to the sample.php file toincrement the counter.

> Find the following line :
include(CHEMIN."inc/includes.inc");

>Below this line add the following :
$­­­­­­­cpt = ReadCounter("compteur.dtb");
$­­­­­­­new = DejaVote("ipcompteur.dtb");
if ($­­­­­­­new[0] == false) ­{­ WriteCounter("compteur.dtb", ++$­­­­­­­cpt); }


Replace the name of the file "compteur.dtb" by the name of your data file.

Replace the name of the file "ipcompteur.dtb" by the name of your unique visitor history file.

Use the $­­­cpt variable to display the counter value (for example: echo $­­­cpt; )

Creation date : 26/10/2006 @ 16:04
Category : - Sample PHP
Page read 41279 times