<?
echo "<div class='block'>";
$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']))
{
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'])."'");
header("Location:?jalob");
}
echo "Автор: ";
echo on_k($jalob['id_user']);
echo " <a href='?user=$jalob[id_user]'>".nc($jalob['id_user'])."</a><br>";
echo "Жалоба на ";
echo on_k($jalob['id_jalob']);
echo " <a href='?user=$jalob[id_jalob]'>".nc($jalob['id_jalob'])."</a><br>";
echo "<b>Жалоба на сообщение:<br></b> $jalob[msg_jalob]<br><b>Комментарий к жалобе:<br></b> $jalob[msg]<br><b>Прочитал:</b> ".nc($jalob['id_who'])."<br><a href='?jalob&go=$jalob[id]&deletejalob=$jalob[id]'>Удалить</a><br><br><a href='?jalob'>Жалобы</a>";
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';
}
}
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_jalob`"),0);
if ($k_post==0)
{
echo "Пусто...";
}
$k_page=k_page($k_post,$set['p_str']);
$page=page($k_page);
$start=$set['p_str']*$page-$set['p_str'];
$xx=mysql_query("SELECT * FROM `kolhoz_jalob`  ORDER BY `id` DESC LIMIT $start,$set[p_str]");
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 "<div class='block'>";
echo "<a href='?jalob&go=$jalob[id]'>Жалоба на ";
echo on_k($jalob['id_jalob']);
echo "<span class='epic'> ".nc($jalob['id_jalob'])."</span></a> ".($jalob['read']==1?"(прочитано)":"<font color='red'>(не прочитанно)</font>")."<br>Автор: ".nc($jalob['id_user'])."<br>Причина:<br>$jalob[msg]<br><a href='?jalob&deletej=$jalob[id]'>Удалить</a></div>";
}
if ($k_page>1)str("?jalob&",$k_page,$page); // Вывод страниц
include_once 'inc/foot.php';
?>