<?php
  ///////////////////////////////////////////////////
  //2012 (C)
  //Карпухин Павел
  ///////////////////////////////////////////////////
 $lang = substr($_SERVER["HTTP_ACCEPT_LANGUAGE"], 0,2);
  if(is_file ("../lang/".$lang.".php")) include "../lang/".$lang.".php";
     else include "../lang/ru.php";

  $title=$titlepage = $TEXT['tbl-delete'];

  require_once "../config.php";
  require_once "top.php";
  ?>
  <title><?php echo $title; ?></title>
  <link rel="StyleSheet" type="text/css" href="../utils/grid.css" />
  </head>
  <body>
  <?php
  if($result2['administrator'] == 0) puterror2($TEXT['error-supp11']);

  if(empty($_POST['pas_str_id'])) puterror2($TEXT['error-zhurn1']);
  if(strlen($_POST['pas_str_id'])>11) puterror2($TEXT['error-zhurn2']);
  $_POST['pas_str_id'] = rep($_POST['pas_str_id']);

  $query_strukt_iskh = mysql_query("SELECT `strukt_name` FROM `tbl_pass_strukt`  WHERE `pas_str_id` = '".$_POST['pas_str_id']."' LIMIT 1 ");
    if(!$query_strukt_iskh) puterror2($TEXT['error-tbl51']);
     $result_strukt_iskh = mysql_fetch_array($query_strukt_iskh,MYSQL_ASSOC);
     $result_strukt_name = $result_strukt_iskh['strukt_name'];

  //*************************************
  $ip = $_SERVER['REMOTE_ADDR'];
  $doing = $TEXT['pass-log'];
  $what = $TEXT['pass-log7']."&laquo;".$result_strukt_name."&raquo;";
  $who = $result2['fullname'];
  //*************************************
  $query = "DELETE FROM `tbl_pass_keep` WHERE `pas_str_id`='".$_POST['pas_str_id']."' ";
     if(mysql_query($query))
      {
       $query2 = "INSERT INTO tbl_logs ( `log_id` , `data` , `ip` , `who` , `doing` , `what` ) VALUES ( NULL , NOW() , '$ip' , '$who' , '$doing' , '$what')";
        if(mysql_query($query2))
         {
          echo "<html><head>
          <meta HTTP-EQUIV='Refresh' CONTENT='0; URL=pass_keep.php?pas_str_id=".$_POST['pas_str_id']."' />
          </head></html>";
          } else puterror2($TEXT['error-log']);
      } else puterror2($TEXT['error-tbl52']);
?>
</body>
</html>