First you need to create a table in your database (MySQL), we call it, for example "counter", its structure will look like this:
After you create a table directly proceed to write the script responsible for filling out and display the collected information.
First we need to have a "register" the user can use for this session:
When using this method requires that the script would have worked up to the counter output to the user's browser of any information, or this piece of code can be made
to the top of the main script, and the counter include'it in the desired location.
Now the user is registered and we have to get information about him and that he had visited pages.
To do this, PHP has many features:
The user information received, and now it needs to be added to the table, for this to start to connect to the database and select our table:
With MySQL connected, you now need to fill in the data table, this will create a few new features:
As a result, we have to add just a couple of lines and the script will be ready:
But not everyone is as good as it might seem a novice programmer, the fact that the script will be very hungry, and if you are the owner of the site with a lot of traffic, then this script may cause significant absorbed by the increase in traffic.
For those who may have failed to gather news of the script together, bring it full source code:
counter.php
To display the statistics you may need another script:
vizit_info.php
shabl.htm