<?
session_start();
require_once('../connect/connect.php');
include_once('../lib/lib.php');
require('pdk.php');
$base_path="../";


if($_POST['del_zhaloba'] && $_POST['del'])
	{
	mysql_query ("DELETE FROM zhaloba WHERE id_zhaloba IN (".$_POST['del_zhaloba'].")") or die(mysql_error());
	}


$maxRows_Recordset1 = $rru['ob_na_str'];
$pn = 0;
if (isset($_GET['pn'])) 
$pn = $_GET['pn'];

$startRow_Recordset1 = $pn * $maxRows_Recordset1;

$query_Recordset1 = "SELECT * FROM zhaloba ORDER BY id_zhaloba DESC";
$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
$Recordset1 = mysql_query($query_limit_Recordset1, $connect) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);

$all_Recordset1 = mysql_query($query_Recordset1);
$totalRows_Recordset1 = mysql_num_rows($all_Recordset1);

$totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;


$titl="Жалобы";
require ('top.php'); 

if($_POST['submit'] && $_POST['arr'])
	{
	$zh=implode(",",$_POST['arr']);
	echo '<table width=300 bordercolor=red border=3 cellSpacing=0 cellPadding=5><tr><td>
	<p>Вы действительно хотите удалить жалобы под номерами <b>'.$zh.'</b> ?</p>';
	?>
	<form action="<? echo $Action; ?>" method="post" name="form_del" >
 	<input name="del_zhaloba" type="hidden" value="<? echo $zh; ?>">
 	<input class="submit" type="submit" name="del" value="ДА">
 	<input class="submit" type="submit" name="not" value="НЕТ">
	</form>
	<?
	echo '</td></tr></table>';
	}  
?>

<p><a href="zhaloba_pr.php">Перечень причин для жалоб &#8594;</a></p>
   <form name="form" method="post" action="">
   
    <TABLE width="100%" style="BORDER-COLLAPSE: collapse" cellpadding="1" cellspacing="1" border="1" bordercolor="#999999">
    <tr align="center" valign="middle" >
	
	<td width="2%" scope="col"></td>
	
	<td width="12%" scope="col">
	Дата
	</td>
	
	<td width="8%" scope="col">
	Объявление
	</td>
	
	<td width="20%" scope="col">
	Причина
	</td>
	
	<td scope="col">
	Обоснование
	</td>
	
	<td width="10%" scope="col">
	IP
	</td>
	
	<td width="7%" scope="col">
	Аккаунт
	</td>
   <?
///////////////// 
$r=mysql_query("SELECT * FROM prichina"); 
while($rr=mysql_fetch_array($r))
	{
	$arr_pr[$rr['id_prichina']]=$rr['prichina'];
	}
  
do 
	{
	if($row_Recordset1['id_zhaloba']) 
		{
		echo '<tr>';

		echo '<td>';
		echo '<input type="checkbox" name=arr[] value="'.$row_Recordset1['id_zhaloba'].'">';

		echo '<td>';
		echo dat_rus($row_Recordset1['data'],2);

		echo '<td align=center>';
		echo '<a target=_blank href="b_user.php?number_ob='.$row_Recordset1['id'].'"><font color=red>'.$row_Recordset1['id'].'</font></a><br>';

		echo '<td>';
		echo $arr_pr[intval($row_Recordset1['id_prichina'])];

		echo '<td>';
		echo $row_Recordset1['obosn'];
		
		echo '<td align=center>';
		echo $row_Recordset1['ip'];

		echo '<td align=center>';
		if($row_Recordset1['id_akk'])
		echo $row_Recordset1['id_akk'];
		} 
	} while($row_Recordset1 = mysql_fetch_array($Recordset1));

   ?>

   </TABLE>
   <br>
      <input class="submit" type="submit" name="submit" value="Удалить">
</form>
<p>
<? 
pages3(20, $totalPages_Recordset1, $pn, $add);
	
include_once('bottom.php'); ?>