I have this counter script:
<?php
Header("Content-type: image/png");
if (file_exists("counter.txt"))
{
$fp = fopen("counter.txt", "r");
$counter = fgets($fp, 999);
$tmp = $counter;
fclose($fp);
$fp = fopen("counter.txt", "w");
fwrite($fp, $tmp+=1);
fclose($fp);
}
$counter = number_format($counter);
$color = 'yellow';
header('Content-Type: image/png\n\n');
set_time_limit(250);
$dx = strlen($counter) * 16;
$dy = 22;
$im = @imagecreate($dx,$dy);
for ($count = 0; $count < strlen($counter); $count++)
{
$imgstr = 'images/digits/sm'.ord($counter[$count]).$color.'.png';
if (isset($test)) {
echo $imgstr.'<br>';
} else {
$im_tmp = @imagecreatefrompng($imgstr);
imagecopy($im, $im_tmp, $count*16, 0, 0, 0, 16, 22);
imagedestroy($im_tmp);
}
}
imagepng($im);
imagedestroy($im);
?>
Only thing is, it doesn't count unique visitors and it increments on
each page I have the script. 😕
What do I need to do to fix this where it won't update for a visitor
if he's on a subsequent page?