Copy & paste the proceding PHP code into your file:
<? if(file_exists("counter.dat")) { $exist_file = fopen("counter.dat", "r"); $new_count = fgets($exist_file, 255); $new_count++; fclose($exist_file); print("$new_count people have visited this page"); $exist_count = fopen("counter.dat", "w"); fputs($exist_count, $new_count); fclose($exist_count); } else { $new_file = fopen("counter.dat", "w"); fputs($new_file, "1"); print("1 person have visited this page"); fclose($new_file); } ?>
Create a text file called counter.dat with "0" as the only content. Upload this file into your directory and make sure it has permission of 777 (CHMOD 777).