could someone help me tidy the MOD, he is showing his friends online.
Please help me.
<?php
begin_block("Amigos");
$sql = "SELECT id, friendid FROM friends WHERE userid = '$CURUSER[id]'";
$mysql_result=mysql_query($sql) or die (mysql_error());
$res = mysql_fetch_assoc($mysql_result);
$id = $res['friendid'];
$dt = get_date_time(gmtime() - 180);
$contagem = mysql_query("SELECT count(*) FROM users WHERE id = '$id' AND last_access > $dt");
if ( $contagem > 0 ) {
echo"<table widt=100%>";
echo"<tr>";
while ($row=mysql_fetch_array($mysql_result)){
$idami = $row['friendid'];
$sql2 = mysql_query("SELECT id, username, last_access, avatar FROM users WHERE id = '$idami'");
$res2= mysql_fetch_array($sql2) or die (mysql_error());
$ami = $res2['username'];
$avatar = htmlspecialchars($res2["avatar"]);
if (!$avatar) {
$avatar = "".$site_config["SITEURL"]."/images/semimagem.gif";
}
echo "<td><a href=account-details.php?id=$id><b><font size=2>".$ami."</font></b></a></td>";
echo "<td><a href=mailbox.php?compose&id=$res2[id]>". "Enviar MP</a> <img src=$avatar width=60 height=75 border=0></td><br><br>";
}
echo"</tr>";
echo "</table>";
print ("<center><a href=friend.php>V