GuppY Help Center, help online, documentation and tutorials

telecharger.png

You are here :   Welcome » Add a visitor counter
    Print this page...

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 39813 times