<?php
// counter.php
$count_file = 'visitor_count.txt'; // file for save
$count = file_exists($count_file) ? (int)file_get_contents($count_file) : 0; // read counter
$count++; // increase counter
file_put_contents($count_file, $count); // save new

// generate image
header('Content-Type: image/png');
$im = imagecreate(100, 20); // size
$bg = imagecolorallocate($im, 0, 0, 0); // black bg
$text = imagecolorallocate($im, 0, 255, 0); // Green text
imagestring($im, 5, 10, 2, "$count", $text); // disc
imagepng($im); // Output afbeelding
imagedestroy($im); // clean
?>