<?
if(isset($_GET['deletejalob']) && mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_jalob` WHERE `id` = '".intval($_GET['deletejalob'])."'"),0)!=0)
{
mysql_query("DELETE FROM `kolhoz_jalob` WHERE `id` = '".intval($_GET['deletejalob'])."'");
echo "<div class='feedback'><ul class='feedbackPanel'><li class='feedbackPanelINFO'><span class='feedbackPanelINFO'>Жалоба удалена!</span></li></ul></div>";
header("Location:?jalob");
}
$x=mysql_query("SELECT * FROM `kolhoz_jalob` WHERE `id` = '".intval($_GET['go'])."' ORDER BY `id` DESC");
while($jalob=mysql_fetch_assoc($x))
{
if(isset($_GET['go']))
{
echo "<div class='event'><h1>Жалобы ".nc($jalob['id_user'])."</h1></div>";
echo '<div class="content"><div class="block">';
echo "<span style='color:#FFFF00'>Автор:</span> ";
echo on_k($jalob['id_user']);
echo " <a href='?user=$jalob[id_user]'>".nc($jalob['id_user'])."</a><br>";
echo "<span style='color:#00FF00'>Жалоба на:</span><br><li><div class='block'> ";
echo on_k($jalob['id_jalob']);
echo " <a href='?user=$jalob[id_jalob]'>".nc($jalob['id_jalob'])." </a>:";
echo "<span class='title'> $jalob[msg_jalob]</span></div></li>
<span style='color:#ADD8E6'>Комментарий к жалобе:</span> $jalob[msg]<br>
<span style='color:#D2B48C'>Просмотрел:</span> ".nc($jalob['id_who'])."<br>
<a href='?jalob&go=$jalob[id]&deletejalob=$jalob[id]'><small>[Удалить]</small></a><br>
<br><a href='?jalob'>Жалобы</a></div>";
mysql_query("UPDATE `kolhoz_jalob` SET `read` = '1' WHERE `id` = '$jalob[id]'");
if($jalob['id_who']==NULL)
{
mysql_query("UPDATE `kolhoz_jalob` SET `id_who` = '$ku[id]' WHERE `id` = '$jalob[id]'");
}
include_once 'inc/foot.php';
}
}
echo "<div class='event'><h1>Жалобы</h1></div>";
echo '<div class="content"><div class="block">';

$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_jalob`"),0);
if ($k_post==0)
{
echo "Пусто...";
}
$k_page=k_page($k_post,5);
$page=page($k_page);
$start=5*$page-5;
$xx=mysql_query("SELECT * FROM `kolhoz_jalob`  ORDER BY `id` DESC LIMIT $start, 5");
while($jalob=mysql_fetch_assoc($xx))
{
if(isset($_GET['deletej']) && mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_jalob` WHERE `id` = '".intval($_GET['deletej'])."'"),0)!=0){
mysql_query("DELETE FROM `kolhoz_jalob` WHERE `id` = '".intval($_GET['deletej'])."'");
header("Location:?jalob");
}
echo "<li><div class='block'><span style='color:#00FF00'>Жалоба на </span>";
echo on_k($jalob['id_jalob']);
echo "<a href='?user=$jalob[id_jalob]'>".nc($jalob['id_jalob'])."</a> <span class='title'><small>".($jalob['read']==1?"(прочитано)</span>":"<font color='red'>(не прочитанно)</font>")."</small>
<br><span style='color:#FFFF00'>Автор:</span> ".nc($jalob['id_user'])."<br>
<span style='color:#ADD8E6'>Причина:</span> $jalob[msg]<br><img width='16' height='16' src='images/icons/arrow.png' alt='o'> <a href='?jalob&go=$jalob[id]'>Читать</a> 
<a href='?jalob&deletej=$jalob[id]'><small>[Удалить]</small></a></div></li>";
}
if ($k_page>1)str("?jalob&",$k_page,$page); // Вывод страниц
echo "</div>";
include_once 'inc/foot.php';
?>