Файл: public_html/includes/comm.php
Строк: 24
<?php
$ctype = mysql_fetch_assoc(mysql_query("SELECT `name` FROM `$type` WHERE `id` = '$id'"));
if ($ctype['name']) {
echo '<div class="title"><a href="?act=view&id='.$id.'">'.$ctype['name'].'</a>» комментарии</div>';
$total = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `".$type."_comm` WHERE `id_".$type."` = '$id'"), 0);
if ($total > 0) {
$pages = ceil($total / $config['onpage']);
if ($page > $pages or $page == 0) {
$page = 1;
}
$begin = ($page - 1) * $config['onpage'];
$comm_r = mysql_query("SELECT * FROM `".$type."_comm` WHERE `id_$type` = '$id' ORDER BY `time` DESC LIMIT $begin, $config[onpage]");
while ($comm = mysql_fetch_assoc($comm_r)) {
echo '<div class="raz"><a href="/other/profile.php?id='.$comm['id_user'].'">'.username($comm['id_user'], 2).'</a> '.ccdate($comm['time'], $comm['id_user']).' [<a href="?act=comm_reply&id='.$comm['id'].'">Отв</a>]';
if ($u['access'] > 0 or $u['id'] and $u['id'] == $comm['id_user'] and TIME - $comm['time'] < $config['edit_time']) echo '[<a href="?act=comm_edit&id='.$comm['id'].'">Ред</a>]';
if ($u['access'] > 0) echo '[<a href="?act=comm_del&id='.$comm['id'].'">Удл.</a>]';
echo '<br />'.bb($comm['text']);
if ($comm['edit_by']) echo '<br/>----------<br/><b>Измененно:</b> '.username($comm['edit_by'], 0).' ('.date('d.m.y, H:i', $comm['edit_time']).' )</span>';
echo '</div>';
}
navig($page, '?act=comm&id='.$id.'&', $pages);
} else {
echo '<div class="error">Пока нет комментариев</div>';
}
if ($u['id']) {
echo '</div><div class="body">
<form name="form" action="?act=comm_add&id='.$id.'" method="post">
<textarea name="text" cols="" rows="3"></textarea>
<br/><br /><input name="" type="submit" value="Написать">
</form></div>';
}
} else {
redirect('?');
}
?>