How can I filter out online users, if I have a column “lastaccess” that have a unix time() stamp. Then I usually have this function:
function showStatus($userid) {
$timeoutIdle = 80;
$timeoutOffline = 150;
$row = mysql_query("select last_access from users where id='$userid'");
$read = mysql_fetch_array($row);
$last_access = $read["last_access"];
$thetime = time();
if ($thetime - $last_access > $timeoutOffline) {
echo "";
}
else if ($thetime - $last_access > $timeoutIdle) {
echo "<span class='statusIdle'>Idle</span>";
} else {
echo "<span class='statusOnline'>Online</span>";
}
}
How do I make a query, where it displays if you’re online?
1 Answer