Parašė newlifeboy· 2009 Sau. 11 14:01:34
#5
opentable("Paskutiniai Komentarai");
$limit = 10;
$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'];
} elseif ($data['comment_type'] == "C") {
$place = BASEDIR."viewpage.php?page_id=".$data['comment_item_id'];
}
echo "<table style='border:1px solid #000;' width='50%'>
<tr>
<td><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']."'>Keisti</a> - " : "")."<a href='$place'>Žiūrėti</a></td>
</tr>
</table><br>\n";
}
} else {
echo "<center>Komentarų nėra</center>\n";
}
closetable();