<?
include_once '../sys/inc/start.php';
include_once '../sys/inc/compress.php';
include_once '../sys/inc/sess.php';
include_once '../sys/inc/home.php';
include_once '../sys/inc/settings.php';
include_once '../sys/inc/db_connect.php';
include_once '../sys/inc/ipua.php';
include_once '../sys/inc/fnc.php';
include_once '../sys/inc/user.php';


$set['title']='Форум - Жалобы';
include_once '../sys/inc/thead.php';
title();
aut(); // форма авторизации



$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_zhal`"),0);
$k_page=k_page($k_post,$set['p_str']);
$page=page($k_page);
$start=$set['p_str']*$page-$set['p_str'];
echo "<table class='post'>\n";
$q=mysql_query("SELECT * FROM `forum_zhal` ORDER BY `id` DESC  LIMIT $start, $set[p_str]");
if (mysql_num_rows($q)==0) {
echo "   <tr>\n";
echo "  <td class='p_t'>\n";
echo "Нет жалоб\n";
echo "  </td>\n";
echo "   </tr>\n";
}
while ($them = mysql_fetch_assoc($q))
{


$forum=mysql_fetch_assoc(mysql_query("SELECT * FROM `forum_f` WHERE `id` = '$them[id_forum]' LIMIT 1"));
$id_post=mysql_fetch_assoc(mysql_query("SELECT * FROM `forum_p` WHERE `id` = '$them[id_post]' LIMIT 1"));
$razdel=mysql_fetch_assoc(mysql_query("SELECT * FROM `forum_r` WHERE `id` = '$them[id_razdel]' LIMIT 1"));
$them=mysql_fetch_assoc(mysql_query("SELECT * FROM `forum_t` WHERE `id` = '$them[id_them]' LIMIT 1"));

$ank=mysql_fetch_assoc(mysql_query("SELECT * FROM `user` WHERE `id` = $id_post[id_user] LIMIT 1"));
$ank2=mysql_fetch_assoc(mysql_query("SELECT * FROM `user` WHERE `id` = $them[id_user] LIMIT 1"));


echo "   <tr>\n";
if ($set['set_show_icon']==2){
echo "  <td class='icon48' rowspan='2'>\n";
echo "<img src='/style/themes/$set[set_them]/forum/48/them_$them[up]$them[close].png' />";
echo "  </td>\n";
}
elseif ($set['set_show_icon']==1)
{
echo "  <td class='icon14'>\n";
echo "<img src='/style/themes/$set[set_them]/forum/14/them_$them[up]$them[close].png' alt='' />";
echo "  </td>\n";
}


echo "  <td class='p_t'>\n";
echo "Жалоба на:<a href='/info.php?id=$ank[id]/'> $ank[nick]</a>\n";
if ($ank['level'] < $user['level'])echo " | <a href='/adm_panel/banf.php?f=$forum[id]&amp;r=$razdel[id]&amp;t=$them[id]&amp;p=$id_post[id]&amp;id=$ank[id]'>Бан</a>\n";


echo "  </td>\n";
echo "   </tr>\n";


echo "   <tr>\n";
if ($set['set_show_icon']==1)echo "  <td class='p_m' colspan='2'>\n"; else echo "  <td class='p_m'>\n";

echo output_text($id_post['msg'])."<br />\n";
echo "Жалоба от:<a href='/indo.php?id=$ank2'> $ank2[nick]</a><br/>";
echo "&raquo;<a href='/forum/$forum[id]/$razdel[id]/$them[id]/'>в тему</a> \n";

echo "  </td>\n";
echo "   </tr>\n";

}
echo "</table>\n";
if ($k_page>1)str("?",$k_page,$page); // Вывод страниц




echo "<div class=\"foot\">\n";
echo "&raquo;<a href='new_p.php'>Темы с новыми сообщениями</a><br />\n";
echo "&laquo;<a href=\"index.php\" title=\"Вернуться к подфорумам\">Форум</a><br />\n";
echo "</div>\n";

include_once '../sys/inc/tfoot.php';
?>