CODE
<?php
$logfile="counter.txt";
$returnpage = htmlentities($_GET['count']);
if (! @$file = fopen($logfile,"r+"))
{
$count="1";
}
else
{
$count = @fread($file, filesize($logfile)) or $count=0;
fclose($file);
$count++;
}
$file = fopen($logfile,"w+");
fputs($file, $count);
fclose($file);
?>
$logfile="counter.txt";
$returnpage = htmlentities($_GET['count']);
if (! @$file = fopen($logfile,"r+"))
{
$count="1";
}
else
{
$count = @fread($file, filesize($logfile)) or $count=0;
fclose($file);
$count++;
}
$file = fopen($logfile,"w+");
fputs($file, $count);
fclose($file);
?>
The link to the page you want to count the visitors should be www.yoursite.com/yourpage.php?count
The visitors numbers will be saved in counter.txt
Add this to the page where you want to show how many visitors the page have had:
CODE
<?php
$logfile="counter.txt";
if (! @$file = fopen($logfile,"r+"))
{
$count="0";
}
else
{
$count = @fread($file, filesize($logfile)) or $count=0;
fclose($file);
}
echo 'Visitors: <font color="#FF6600">'.$count.'</font>.';
?>
$logfile="counter.txt";
if (! @$file = fopen($logfile,"r+"))
{
$count="0";
}
else
{
$count = @fread($file, filesize($logfile)) or $count=0;
fclose($file);
}
echo 'Visitors: <font color="#FF6600">'.$count.'</font>.';
?>

