View Full Version : online qustion
hmm how i can get user online info ?
like i want to give for exsample
userid = 50
and to get his status.... like on postbit (this icon that says if user is online or not)
i have found the answer
here it is for who wants it
$userid = $user['userid']; // replace this to wanted id
// online part
$datecut = TIMENOW - $vboptions['cookietimeout'];
$useronoff=$DB_site->query_first("SELECT COUNT(*) AS count FROM session WHERE userid='$userid' AND lastactivity>$datecut");
$useronline=$useronoff[count];
if ($useronline) {
//mean user online
$user['online'] ="1";
} else {
$user['online'] ="0";
}
switch ($user['online']) {
case 0:
$user['online'] = "<img src=images/statusicon/user_offline.gif alt=offline>";
break;
case 1:
$user['online'] = "<img src=images/statusicon/user_online.gif alt=online>";
break;
}
MiZ.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.