";
$result = dbquery("SELECT user_id, user_name, user_status, user_lastvisit, user_level, user_avatar FROM ".DB_USERS." WHERE user_lastvisit>'0' AND user_status='0' ORDER BY user_lastvisit DESC LIMIT 6");
if (dbrows($result) != 0) {
$hou_count = 0;
while ($data = dbarray($result)) {
$lastseen = time() - $data['user_lastvisit'];
$week = sprintf("%2d", floor($lastseen / 604800));
$day = sprintf("%2d", floor($lastseen / (60 * 60 * 24)));
$hour = sprintf("%02d", floor((($lastseen % 604800) % 86400) / 3600));
$minute = sprintf("%02d", floor(((($lastseen % 604800) % 86400) % 3600) / 60));
$second = sprintf("%02d", floor((((($lastseen % 604800) % 86400) % 3600) % 60)));
if ($week > 0){
if ($week == 1) {
$text = "Week";
}
else {
$text = "Weeks";
}
$lastseen = $week." ".$text;
}
else if ($day > 0){
if ($day == 1) {
$text = "Day";
} else {
$text = "Days";
}
$lastseen = $day." ".$text;
} else {
$lastseen = $hour.":".$minute.":".$second ;
}
if ($data['user_avatar'] && file_exists(IMAGES."avatars/".$data['user_avatar']) && $data['user_status']!=6 && $data['user_status']!=5) {
$houa = "";
} else {
$houa = "";
}
echo "".$houa." ".profile_link($data['user_id'], $data['user_name'], $data['user_status'])."
".$lastseen." | ";
$hou_count ++;
}
}
echo "