Welcome Guest, Not a member yet? Register   Sign In
How to count the current number of users visiting the website?
#5

[eluser]mddd[/eluser]
I would say there is no other way then to somehow store something in the database each time you encounter a visitor. And then count the number and display it.
If you are already storing something (because of sessions) that is the logical way to go. You can use the "last updated" value of a session to make the relevant selection.

If you don't use the sessions, you could store something else, like the ip of the visitor, along with the time of visit. If you delete those entries when you don't want to count them anymore, you have a count of the number.

Of course, if you use ip's, multiple visitors from a single ip will count as one -- you could also use some kind of hash of the ip, browser agent, and other factors, trying to uniquely count the users.

I suggest you use the sessions class, even only for this purpose.. it's no use adding another layer of complexity if not neccessary.


Messages In This Thread
How to count the current number of users visiting the website? - by El Forum - 06-29-2010, 10:20 AM



Theme © iAndrew 2016 - Forum software by © MyBB