Parašė Narysx· 2009 Vas. 11 18:02:03
#1
Kodas:
<?php
openside("Mano draugų sąrašas");
$fv = mysql_query("SELECT friend_id from prefix_friends WHERE user_id='".$userdata[user_id]."'");
while ($q = mysql_fetch_array($fv))
{
$draugo_id = $q['friend_id'];
$result = dbquery("SELECT * FROM ".$db_prefix."users WHERE user_lastvisit>'0' AND user_status='0' AND user_id='$draugo_id' ORDER BY user_lastvisit DESC LIMIT 0,7");
if (dbrows($result) != 0) {
while ($data = dbarray($result)) {
$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= "<img src='http://ww/images/online.gif'>";
} elseif ($lastseen < 360){
$lastseen= "<img src='http://www.es/offline.gif'>";
} elseif ($iW > 0){
if ($iW == 1) { $text = Savaitė; } else { $text = Savaitės; }
$lastseen = $iW." ".$text;
} elseif ($iD > 0){
if ($iD == 1) { $text = Diena; } else { $text = Dienos; }
$lastseen = $iD." ".$text;
} else {
$lastseen = "prieš ".$iH."val., ".$iM."min., ".$iS."s.";
}
echo "<center><a href='".BASEDIR."profile.php?lookup=".$data['user_id']."' title='".$data['user_name']."'>".$data['user_name']."</a></center>
<center>".$lastseen."</center>\n";
echo "<center>
<table border='0' width='100' height='100' background='".IMAGES."avatars/"; if($data['user_avatar']) {echo $data['user_avatar'];} else { echo "noavatar.gif";} echo"'>";
$user_mood = mysql_query("SELECT * from prefix_user_status WHERE user_id='".$data[user_id]."'");
while ($d = mysql_fetch_array($user_mood))
{
$user_moodas = $d['mood'];
}
echo "<tr><td valign='top'><img src='http://www.et/images/mood/$user_moodas.gif' alt='nuotaika: $user_moodas'></td>
</table>
</center><br><br>";
}
}
}
echo "<img src='".THEME."images/bullet.gif' alt=''> Viso draugų : na.<br>
<img src='".THEME."images/bullet.gif' alt=''> <a href='".BASEDIR."infusions/friends_and_visiters_panel/visi_mano_draugai.php'><b>Rodyti visus draugus</b></a>";
closeside();
?>
Kodėl man visus draugus surikiuoja ne pagal user_lastvisit kaip nurodyta užklausoje, o padrikai? Bet kas betkur...