Parašė gintulys· 2009 Rugs. 20 19:09:32
#3
Imk ;)
opentable("Paskutiniai Komentarai");
$limit = 5;
$result = dbquery("SELECT * FROM ".$db_prefix."comments LEFT JOIN ".$db_prefix."users ON comment_name = user_id ORDER BY comment_datestamp DESC LIMIT 0,$limit");
if (dbrows($result)) {
while ($data = dbarray($result)) {
if ($data['comment_type'] == "U") {
$place = BASEDIR."profile.php?lookup=".$data['comment_item_id'];
} elseif ($data['comment_type'] == "N") {
$place = BASEDIR."news.php?readmore=".$data['comment_item_id'];
} elseif ($data['comment_type'] == "A") {
$place = BASEDIR."readarticle.php?article_id=".$data['comment_item_id'];
} elseif ($data['comment_type'] == "P") {
$place = BASEDIR."photogallery.php?photo_id=".$data['comment_item_id'];
}
echo "<table style='border:1px solid #000;' width='100%'>
<tr>
<td><img src='".THEME."images/bullet.gif'> <a href='".BASEDIR."profile.php?lookup=".$data['user_id']."'>".$data['user_name']."</a> ".(iADMIN && eregi("C",$userdata['user_rights']) ? " <b>IP:</b> ".$data['comment_ip'] : "")."</td>
</tr>
<tr>
<td>".($data['comment_smileys'] == "1" ? parseubb(parsesmileys(nl2br($data['comment_message']))) : parseubb(nl2br($data['comment_message'])))."</td>
</tr>
<tr>
<td>".(iADMIN && eregi("C",$userdata['user_rights']) ? "<a href='".ADMIN."comments.php$aidlink&step=delete&comment_id=".$data['comment_id']."&ctype=".$data['comment_type']."&cid=".$data['comment_item_id']."'>Trinti</a> - <a href='".ADMIN."comments.php$aidlink&step=edit&comment_id=".$data['comment_id']."&ctype=".$data['comment_type']."&cid=".$data['comment_item_id']."'>Taisyti</a> - " : "")."<a href='$place'>Skaityti</a></td>
</tr>
</table><br>\n";
}
} else {
echo "<center>Komentarų nėra</center>\n";
}
closetable();