The way this counter works is it creates a cookie on the user's computer with their IP and it updates the count according to the status of that cookie. If the cookie is present and the IP in the cookie is the same as the user's current IP then the script knows the user has already been there and it does nothing or if it is present, but has an IP different than the user's current IP or is not present the script knows that the user is either new or was there before, but the cookie has expired so it then updates the count.
For this hit counter we are going to use MySQL, PHP and PHP's awesome built in support for sessions. I want to stress the avoidance of cookies for something like this because you are going to be forcing this upon each user's browser and the world of Microsoft users are shifting towards Internet Explorer 6 which has created some great headaches for webmasters that like to use cookies. With PHP's sessions the cookie is stored on the web server and not the user's computer which is a benefit because now the webmaster has control, not the user's finicky web browser.
Site counter is one of the earliest script I ever created. Most books and sites on PHP always teach site counter. So not to miss this trend, PhpMagix will also discuss on site counter, but since PhpMagix 'is Magix', I will not only discuss on simple counter, but also on visits counter, and image counter (a la bravenet).
Joining mailing list will entitle you
to receive occasional emails informing you of news and
updates to the site and any special offers that may be
of interest to you.