Просмотр файла forum/top-themes.php

Размер файла: 1.58Kb
<?php

$title='Топ-тем';
require"../system/config.php";
require"../system/func.php";
require"../system/head.php";
require"../system/error.php";
echo'<div class="i">'.$title.'<br></div>';
$total=mysql_result(mysql_query("SELECT COUNT(*) `cn`, `id_them` FROM `forum_messages` GROUP BY `id_them` ORDER BY `cn`"),0);

$page = abs((int)$_GET['page']);

if($page < 0 || $page > $total) $page = 0;
if ($total < $page + 10) $end = $total;
else $end = $page + 10;
$qury=mysql_query("SELECT COUNT(*) `cn`, `id_them` FROM `forum_messages` GROUP BY `id_them` ORDER BY `cn` DESC LIMIT 20");
while($data=mysql_fetch_array($qury)){ $ofile=mysql_fetch_assoc(mysql_query("SELECT * FROM `forum_themes` WHERE `id_them`='".$data['id_them']."'"));
echo'<div class="p">Тема: <a href="/forum/theme/'.$ofile['id_kat'].'/'.$ofile['id_them'].'/">'.$ofile['ftname'].'</a> ';
 
 $messages=mysql_num_rows(mysql_query("SELECT * FROM `forum_messages` WHERE `id_them`='".$data['id_them']."'")); if($messages>10){ $stbud=round($messages,-1); $skcf=strlen($messages);
 $poslc=substr($messages,($skcf-1),$skcf);
 if($poslc>=5 or $poslc=='0'){$stbud=$stbud-10;}
 echo'[<a href="/forum/theme/'.$ofile['id_kat'].'/'.$ofile['id_them'].'/page='.$stbud.'"><b>&#187;</b></a>]';
 }
 echo' <br>Дата: '.date_fixed($ofile['timer']).'<br><b>Сообщений:</b> '.$data['cn'].'</div>';}
echo'<div class="p">';
strpage($page, 10, $total, "top-themes.php");
echo'</div><div class="p"><img src="'.$dirsite.'/design/default/act.gif" alt=""> <a href="index.php">в форум</a></div>';
require"../system/foot.php";
?>