Размер файла: 1.84Kb
<?php
include 'includes/config.php';
include 'includes/connect.php';
include 'includes/admin.valid.php';
include 'includes/navigator.class.php';
include 'includes/function.php';
$title .= ' - Комментарии';
$news_id = mysql_escape_string(trim(intval($_GET['news_id'])));
$sql = mysql_query("SELECT * FROM `".$db_pref."news` WHERE `id` = '$news_id'");
if (mysql_num_rows($sql) < '1') {
header("Location: $home_url");
}
include 'themes/head.php';
$sql = mysql_query("SELECT COUNT(*) FROM `".$db_pref."comment` WHERE `news_id` = '$news_id'");
$all = mysql_result($sql, 0, 0);
if ($all == '0') {
echo <<<HTML
<br />
<div class="m"><div class="t">
Комментариев нет!
</div></div>
<br />
HTML;
}
if ($all) {
$n = new Navigator($all,$pnumber);
$sql = mysql_query("SELECT * FROM `".$db_pref."comment` WHERE `news_id` = '$news_id' ORDER BY `id` DESC LIMIT {$n->start()},$pnumber ");
while ($row = mysql_fetch_assoc($sql)) {
$id = $row['id'];
$user = $row['user'];
$date = $row['date'];
$text = smile(antirek(antimat(stripslashes(nl2br(htmlspecialchars($row['text']))))));
if (!empty($_USER['login'])) {
$moded = "[<a href=\"$home_url/comm.del.php?id=$id\"><font color=\"red\">del</font></a>] [<a href=\"$home_url/comm.ans.php?id=$id\"><font color=\"yellow\">ans</font></a>]";
}
if (!empty($row['ans'])) {
$ans = smile(stripslashes(nl2br(htmlspecialchars($row['ans']))));
$ans = 'Ответ: <br /><div class="menu2">'.$ans.'</div>';
} else {
$ans = '';
}
echo <<<HTML
<div class="t">$user <small>[$date]</small> $moded</div>
<div class="m">
<div class="menu2">
$text
</div>
$ans</div>
HTML;
}
echo $n->navi();
}
echo <<<HTML
<div class="m"><div class="top">
<a href="comm.add.php?news_id=$news_id">Добавить</a>
</div></div>
HTML;
include 'themes/foot.php';
?>