Let’s say I have a website, www.someweb.com, and there I have the file index.php that contains index code, etc.
Then I have two folders: f1 and f2 at www.someweb.com/f1/ and www.someweb.com/f2/. Now if the user requests www.someweb.com/f1/somefile.abcd I want to increment a counter. If the user visits www.someweb.com/f2/somefile2.abcd some other file in other folder with the same extension I want that counter to be incremented again.
Whenever user requests that page, I want to print the current counter value. Example:
www.someweb.com/f1/somefile.abcd // counter = 1
www.someweb.com/f2/somefile2.abcd // counter = 2
www.someweb.com/f1/somefile.abcd // counter = 3
etc.
How do I do it?
This is what server log information is for. Use any freely available server log analysis tool.
You could also define a global server environmental variable on you web server and increment it with each request server. This would in essence be a little script running in your web server environment.