function checkUserIsOnline($userid){ $online = false; $res = $GLOBALS['TYPO3_DB']->sql_query('SELECT DISTINCT ses_userid, username, name FROM fe_sessions LEFT JOIN fe_users ON (ses_userid=uid) WHERE ses_tstamp+3600 > unix_timestamp() OR is_online+3600 > unix_timestamp() and ses_userid='.$userid); while(false!==($row=$GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))){ if($row['ses_userid']==$userid)$online=true; } return $online; }