I'm currently tracking users on my site using sessions. It counts how many sessions are active and then returns the value. At the moment, every person who accesses the site starts a session automatically. What i need to do is just count the sessions that have a filesize, i.e. are above 1k. This is the function i am currently using to count the sessions active.
function getUsersOnline() {
$count = 0;
$handle = opendir(session_save_path());
if ($handle == false) return -1;
while (($file = readdir($handle)) != false)
{
if (ereg("^sess", $file)) $count++;
}
closedir($handle);
return $count;
}
This returns all sessions but ost have no size value indicating that these users are not logged in but browsing the site. When users log in and use the facilities, the size of file increases.
I am looking to just count the number of users logged in.
Could i modify this function or is there a more appropriate way of finding this info
thanks in advance
andy