10
Quote:
hervet wrote:
Quote:
trabis wrote:
You can use the 'online' handler to ger all logged users
I believe that it will "run" only if the block is visible.
I guess you we need to have the "who´s online block"(or similar) visible so it keeps database updated.
This would update the table
/*global $xoopsUser, $xoopsModule, $_SERVER;*/
$online_handler =& xoops_gethandler('online');
mt_srand((double)microtime()*1000000);
// set gc probabillity to 10% for now..
if (mt_rand(1, 100) < 70) {
$online_handler->gc(300);
}
if (is_object($xoopsUser)) {
$uid = $xoopsUser->getVar('uid');
$uname = $xoopsUser->getVar('uname');
} else {
$uid = 0;
$uname = '';
}
if (is_object($xoopsModule)) {
$online_handler->write($uid, $uname, time(), $xoopsModule->getVar('mid'), $_SERVER['REMOTE_ADDR']);
} else {
$online_handler->write($uid, $uname, time(), 0, $_SERVER['REMOTE_ADDR']);
}