Quote:
Originally Posted by sonata
Have you implemented your idea. Do you mind to sharing some of your codes like how to check lastactivity and the session time out? I don't know how lastactivity is computed and saved in vbulletin. Thanks in advance.
|
Afraid not...
The variables of interest in the session table are:-
session.lastactivity
session.userid
Not sure what the session id field is called in the session file off the top of my head...
This following code returns all users currently online (ie: last activity > a cut off date)
Code:
$datecut = TIMENOW - *expiry age (eg: 300 secs?)*;
$UsersOnline = $db->query("
SELECT
user.username, (user.options) AS invisible, user.usergroupid,
session.userid,
IF(displaygroupid=0, user.usergroupid, displaygroupid) AS displaygroupid
FROM " . TABLE_PREFIX . "session AS session
LEFT JOIN " . TABLE_PREFIX . "user AS user ON(user.userid = session.userid)
WHERE session.lastactivity > $datecut and user.userid > 0
" . iif($vbulletin->options['displayloggedin'] == 1, "ORDER BY username ASC") . "
");