Файл: spuff.ru/includes/comm_new.php
Строк: 21
<?php
switch ($type) {
case 'blogs': $index = 'Полезные коды'; break;
case 'loads': $index = 'ЗЦ'; break;
case 'photos': $index = 'Фото'; break;
}
echo '<div class="title"><a href="index.php">'.$index.'</a>» новые комментарии</div>';
$total = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `".$type."_comm` WHERE `time` > '".(time()-86400)."'"), 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 `time` > '".(time()-86400)."' ORDER BY `time` DESC LIMIT $begin, $config[onpage]");
while ($comm = mysql_fetch_assoc($comm_r)) {
$typen = mysql_fetch_assoc(mysql_query("select `name` from $type where `id` = '".$comm['id_'.$type]."'"));
$comms = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `".$type."_comm` WHERE `id_".$type."` = '".$comm['id_'.$type]."'"), 0);
echo '<div class="row"><a href="index.php?act=comm&id='.$comm['id_'.$type].'"><b>'.$typen['name'].'</b> ('.$comms.')</a><br />'.bb($comm['text']).' ('.ccdate($comm['time'], 0).')</div>';
}
} else {
echo '<div class="error">Нет новых комментариев</div>';
}
navig($page, '?act=comm_new&', $pages);
?>