Файл: forum_cat.php
Строк: 53
<?
define('PROTECTOR', 1);
$textl='Форум';
include('files/db.php');
include($path.'files/auth.php');
if ($user_id==0){
header('location: index.php');exit;
}
include($path.'files/head.php');
include($path.'files/zag.php');
$cha=mysql_query("SELECT * FROM `forum_cat` WHERE `id`='".mysql_real_escape_string($_GET['cat'])."'");
$chatqs=mysql_fetch_array($cha);
echo '<table width=100%>
<tr>
<td width=35%>
<a href=game.php><div style="background: #882222; border-radius: 7px 0 0 7px" class="m p bts bbs brs bls" align=center>Главная</div></a>
</td><td>';
echo '<a href=forum.php><div class="line bts brs bls bbs p m" style="border-radius: 0 7px 7px 0">
<font color=#ffffff>Форум ['.$chatqs['cat'].']
</font>
</div></a></td></tr></table>';
echo '<div class="bat bts brs bls bbs p">';
if ($_GET['page'] == "" || $_GET['page'] < 0 || $_GET['page'] == "0")
{
$_GET['page'] = 0;
}
$next = $_GET['page'] + 1;
$back = $_GET['page'] - 1;
$num = $_GET['page'] * 10;
if($_GET['page'] == "0")
{$i = 1;}
else{$i = ($_GET['page']*10)+1;}
$viso = mysql_num_rows(mysql_query("SELECT * FROM forum_top"));
$puslap = floor($viso/10);
$chq=mysql_query("SELECT * FROM `forum_top` WHERE `cat`='".$chatqs['id']."' ORDER BY `pri` DESC, `time` DESC LIMIT $num,10");
while($chatq=mysql_fetch_array($chq))
{
$chqz=mysql_query("SELECT * FROM `forum_com` WHERE `top`='".$chatq['id']."'");
$chatqsz=mysql_num_rows($chqz);
if($chatq['pri']==0)
{
echo '<img src=img/main/p21.png><a href=forum_top.php?top='.$chatq['id'].'> '.$chatq['name'].'</a> ('.$chatqsz.')<br>';
}
else
{
echo '<img src=img/main/p21.png> <a href=forum_top.php?top='.$chatq['id'].'><b><font color=#ff0000>'.$chatq['name'].'</font></b></a> ('.$chatqsz.')<br>';
}
}
$kol_us=mysql_num_rows(mysql_query("SELECT * FROM `forum_top` WHERE `cat`='".mysql_real_escape_string($_GET['cat'])."'"));
$pag=ceil($kol_us/10);
$m_p=$_GET['page']-2;
$mx_p=$_GET['page']+6;
echo '<table width=100%><tr>';
for($k=0; $k<=$pag; $k++)
{
if($k>=$m_p and $k<=$mx_p and $k>0)
{
$i=$k-1;
if($_GET['page']==''){$_GET['page']=0;}
if($_GET['page']!=$i)
{
echo '<td><a href=?cat='.$_GET['cat'].'&page='.$i.'><div style="background: #000044; padding: 3px; margin-top: 3px;" class="bts bbs brs bls" align=center>'.$k.'</div></a></td>';
}
else
{
echo '<td><a href=?cat='.$_GET['cat'].'&page='.$i.'><div style="background: #044440; padding: 3px; margin-top: 3px;" class="bts bbs brs bls" align=center>'.$k.'</div></a></td>';
}
}
}
echo'</tr></table>';
echo '<br>';
if($chatqs['close']!=1)
{
echo '<img src=img/main/p21.png> <a href=top.php?cat='.$chatqs['id'].'>Создать топ</a>';
if($udata['lvl']<5)
{
echo ' <img src=img/main/zamok.png> <font color=#ff0000>с 5 уровня!</font>';
}
}
else
{
if($udata['admin']==6)
{
echo '<img src=img/main/p21.png> <a href=top.php?cat='.$chatqs['id'].'>Создать топ</a>';
}
}
echo '</div></div>';
include($path.'files/down.php');
?>