PDA

View Full Version : Counting users online from external PHP script


diesel08
03-10-2005, 04:02 AM
What i need to do is count the number of users online in m vbforum from outside the forum in an external PHP script

how could i do this?

sabret00the
03-10-2005, 09:01 AM
use erwin's hack https://vborg.vbsupport.ru/showthread.php?s=&threadid=59722

but change the conditonal to this
// people online on every page.
if (!$forumhome)
{
$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;
}
// people online on every page

and add at the top of your forums/index.php $forumhome = TRUE;

diesel08
03-10-2005, 10:50 AM
no...

what i wanted to do was feed the online users number to a script that has nothing to do with vbulletin.

i have a php webpage that is completely separate from vbulletin, but i want it to show number of users online (users online in vbulletin that is)

sabret00the
03-10-2005, 11:12 AM
a script that has nothing to do with vbulletin.

that's fine, the above information and the said hack still contain the queries required to gather the information.