Файл: BlogExl_v_3/modules/pages/top.php
Строк: 23
<?
head('Самые читаемые статьи');
info();
$ram = $dbs->query("SELECT * FROM `blog`")->num_rows;
$num = 10;
$total = intval(($ram - 1) / $num) + 1;
$page = abs(intval($_GET['page']));
if(empty($page) or $page < 0) $page = 1;
if($page > $total) $page = $total;
$start = $page * $num - $num;
$q = $dbs->query("SELECT * FROM `blog` order by `look` desc limit $start,$num");
if(!$q->num_rows){echo '<div class="post2">Статей нет!</div>';}
while($a = $q->fetch_assoc()){
$raz = $dbs->query("SELECT * FROM `cat` where `id` = '$a[id_cat]' limit 1")->fetch_assoc();
echo '<div class="razd"><img
src="/design/044.png" alt="*"/> <a
href="/read'.$a['id'].'" style="text-
decoration:none;">'.$a['name'].'</a></div><div class="pod_razd">'.mb_substr($a['msg'],0,50).'....<a
href="/read'.$a['id'].'"><img src="/design/020.png"
alt="*" align="middle" />читать далее</a><br/>Раздел: <a href="cat.php?id='.$raz['id'].'">'.$raz['name'].'</a><br/><a href="/komm'.$a['id'].'">Комментарии </a>('.$dbs->query("SELECT * FROM `komm` where ".($user['level']>=2?NULL:'type = 0 and')." `id_blog` = '$a[id]'")->num_rows.')</div>';
}
str('?&');
foot();
?>