PHP Code:
$datecut = TIMENOW - $vboptions['cookietimeout'];
$headerguests = $DB_site->query_first("
SELECT COUNT(*) AS count
FROM session
WHERE userid = 0 AND lastactivity > $datecut
");
$headerusers = $DB_site->query_first("
SELECT COUNT(DISTINCT(userid)) AS count
FROM session
WHERE session.userid > 0 AND session.lastactivity > $datecut
");
$headerguests = $headerguests['count'];
$headerusers = $headerusers['count'];
$totalonline = $headerguests + $headerusers;