PHP: About Active Users Counter


Simple Active Users Counter is a service to record and show number of recent active/online users. The procedure used by this service is different to other services used for the same purposes:
  • Active User Counters in PHP are often associated to a database where user’s information is saved. The database allows to save a lot of information related to each visitor to our website, and retrieval of all this data from the database allows to show not only the number of visitors in the last minutes (the active/online visitors), but also the number of visitors during the day and the day before, or number of visitors during the week, month or year. Of course, saving data to large databases and searching them requires quite a lot computing and read/write activity (the more visitors to the website, the more "expensive" is to retrieve the data).
  • More modest Active Users Counters do not use databases. The data is stored in a text file. Often, only the IP address and the last date of activity of each user is stored in the file. Consequently, the structure of the files is simple, and the amount of data available is limited. Unfortunately, in most cases, the files must be completely read each time a new data is added to the file, and the complete information must be re-saved. So computing and read/write activity may be important.
Get code for Simple Active Users Counter.
 

PHPTutorial.info.