Parašė Soo-2· 2008 Lap. 15 13:11:22
#44
$result = dbquery("SELECT * FROM ".$db_prefix."users ORDER BY user_lastvisit DESC LIMIT 0,10");
echo "<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" class=\"\">";
if (dbrows($result) != 0) {
while ($data = dbarray($result)) {
// Check if user has ever logged in
if ($data['user_lastvisit'] != 0) {
$lastseen = time() - $data['user_lastvisit'];
$iW=sprintf("%2d",floor($lastseen/604800));
$iD=sprintf("%2d",floor($lastseen/(60*60*24)));
$iH=sprintf("%02d",floor((($lastseen%604800)%86400)/3600));
$iM=sprintf("%02d",floor(((($lastseen%604800)%86400)%3600)/60));
$iS=sprintf("%02d",floor((((($lastseen%604800)%86400)%3600)%60)));
if ($lastseen < 60){
$lastseen="<font size='1' color='#0a86cf'><nobr><b> Online </b></nobr>";
} elseif ($lastseen < 360){
$lastseen="<font size='1' color='#0a86cf'><nobr>Offline</nobr>";
} elseif ($iW > 0){
if ($iW == 1) {
$Text = "Savaite";
} else {
$Text = "Savaites";
}
$lastseen = "<nobr><font size='1' color='#0a86cf'>".$iW." ".$Text."</nobr>";
} elseif ($iD > 0){
if ($iD == 1) {
$Text = "Diena";
} else {
$Text = "Dienos";
}
$lastseen = "<nobr><font size='1' color='#0a86cf'>".$iD." ".$Text."</nobr>";
} else {
$lastseen = $iH.":".$iM.":".$iS;
}
} else {
$lastseen = "Nebuvo prisijunges";
}
echo "<tr>\n<td class=\"small\" align=\"left\"><font size='1' color'#0a86cf'> <a href=\"".BASEDIR."profile.php?lookup=".$data['user_id']."\">";
echo $data['user_name']."</a></td><td class=\"small2\" align=\"right\">".$lastseen." </td></tr>";
}
}