Here goes (very quick, might mess up):
$file="./counter.dat";
$count=@file($file);
$count=trim($count[0]);
$count++;
$fp=fopen($file,"w");
fwrite($fp,$count);
fclose($fp);
echo 'You are visitor '.$count.'!';
works, provided you have write-access to the file on your server.