Here is the code for a very simple counter that you can add to your site : <?php if(file_exists("hits.txt")) { $hits = file_get_contents("hits.txt"); }else{ $hits=0; } $hits++; $ha = fopen("hits.txt", "w"); fwrite($ha, $hits); fclose($ha); ?> PHP: You can add it to the .php page that you want to count, plus you can add this code if you want it to be visible : <?php echo $hits." visitors"; ?> PHP:
But if your writing you should be locking... I think it would also be better to use single IO handle than to use (2). This ways you open, update then close. jb