Ok firstly the page must be PHP, it can be another language like Perl, ASP but thats beside the point its a PHP Forum 😃
Anyway as soon as the pages accessed you will need the Counter Code at Top. Or at least before you re-access the file to display the correct number of hits to that page.
Also if you are wanting to show unique hits by this i mean hits for each page you will need to organise your text file correctly so e.g.
index|1
news|10
From there you need to use file(); which you have it basically just opens the entire file for reading.
from there you need to explode it to
so
explode("|",$contents);
to get the index and 1 as seperate values.
From there you will need to just echo out the hit value in my example it will be one.