File size: 1.43Kb
<?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.')<br />'.bb($comm['text']).'<br />Написано: '.ccdate($comm['time'], 0).'</a></div>';
}
} else {
echo '<div class="body">Нет ни одного еще</div>';
}
echo '<div class="body">';
navig($page, '?act=comm_new&', $pages);
echo '<a href="index.php">'.$index.'</a>» новые комментарии</div>';
?>