This may be a simple question, but how do you determine how many people are accessing a given page at a given time?
It's important that the number is accurate, so I don't want to set sessions that expire, and assume 30 minutes or something along those lines. But rather, the exact number of people that are accessing a particular file/page at a given time....
Any direction would be huge! Thank you.
How many people on page?
Moderator: General Moderators
Re: How many people on page?
The only real way is to use sessions. you can use javascript/ajax to run a php script that kills the session when the window closes... but that greatly determins on the browser settings.
Unfortunately there is no 100% accurate way... php is server side and the user leaving your site is client side. javascript is the only way to make the 2 sides talk.
Unfortunately there is no 100% accurate way... php is server side and the user leaving your site is client side. javascript is the only way to make the 2 sides talk.
-
cpetercarter
- Forum Contributor
- Posts: 474
- Joined: Sat Jul 25, 2009 2:00 am
Re: How many people on page?
A possible way is to keep a count (in a database) of unique IP addresses of visitors - deleting records more than, say, 1 hour old - and then make some heroic assumption such as that IP addresses which have requested one of your pages within the last 5 minutes are 'online'.