<?php
$sql = "SELECT
comments.id,
comments.id2,
comments.author,
comments.comment,
comments.date AS comDATE,
members.id AS memID,
members.name,
members.avatar
FROM
comments
LEFT JOIN
members
ON
comments.author = members.id
WHERE
id2 = '" . $id . "'
ORDER BY
comDATE DESC";
$result = mysql_query($sql) OR die(mysql_error());
if(!$result) {
echo '<p class="false">' . $lang['no_comments'] . '</p>';
}else{
if(intval(mysql_num_rows($result)) == 0) {
echo '<p class="false">' . $lang['no_comments'] . '</p>';
}else{
include_once('framework/filter.php');
include_once('framework/functions/badwords.php');
include_once('framework/functions/smileys.php');
while($row = mysql_fetch_assoc($result)) {
echo '<table width="100%" cellpadding="5" cellspacing="0" class="guestbook">
<tr>
<td><div class="left"><img src="' . htmlentities($row['avatar']) . '" border="0" alt="Avatar"></div>';
echo '<div class="pics_right"><a href="member.php?id=' . (int)$row['memID'] . '">' . htmlentities($row['name'], ENT_QUOTES) . '</a> <small>' . date('d.m.Y - H:i', strtotime($row['comDATE'])) . ' ' . $lang['o_clock'] . '</small></div>';
echo '<div class="clear"></div>';
echo '<p>' . mysql_filter(filter_html(badwords(smileys(stripslashes(nl2br($row['comment'])))))) . '</p></td>
</tr>
</table>';
}
echo '<div class="head_spacer"></div>';
}
}
?>