<?php
  ///////////////////////////////////////////////////
  //2007 (C)
  //Карпухин Павел
  ///////////////////////////////////////////////////

  $lang = substr($_SERVER["HTTP_ACCEPT_LANGUAGE"], 0,2);
  if(is_file ("../lang/".$lang."/".$lang.".php")) include "../lang/".$lang."/".$lang.".php";
     else include "../lang/ru/ru.php";

  $title=$titlepage = $TEXT['pas-title'];
  $helppage = $TEXT['pas-help'];

  require_once "../config.php";
  require_once "../util/top_layer1.php";

  if($result2['user'] == 1) puterror2($TEXT['error-loginform4']);
  if($result2['master'] == 1) puterror2($TEXT['error-loginform4']);
  if($result2['manager'] == 1) puterror2($TEXT['error-loginform4']);

  if(empty($_GET['pas_str_id'])) puterror2($TEXT['error-kat8']);
  if(strlen($_GET['pas_str_id'])>11) puterror2($TEXT['error-kat9']);
  if(empty($_GET['pas_id'])) puterror2($TEXT['error-zhurn11']);
  if(strlen($_GET['pas_id'])>11) puterror2($TEXT['error-zhurn12']);

  $_GET['pas_str_id'] = rep($_GET['pas_str_id']);
  $_GET['pas_id'] = rep($_GET['pas_id']);

  //*************************************
  $query_zh = "SELECT fio FROM `tbl_pass_keep` WHERE `pas_id` = ".$_GET['pas_id']."";
  $result_zh = mysql_query($query_zh);
  if(!$result_zh) puterror2($TEXT['error-tbl52']);
   $result_log = mysql_fetch_array($result_zh);

  $ip = $_SERVER['REMOTE_ADDR'];
  $doing = $TEXT['log-zhurn3'];
  $what = $TEXT['log-zhurn4']."&laquo;".$result_log['zh_tema']."&raquo;".$TEXT['log-id'].$_GET['zhurn_id'];
  $who = $result2['fullname'];
  //*************************************
  $query = "DELETE FROM `tbl_pass_keep` WHERE `pas_id`='".$_GET['pas_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=deleteform.php?pas_str_id=".$_GET['pas_str_id']."' />
                   </head></html>";
           } else puterror2($TEXT['error-log']);
  } else puterror2($TEXT['error-tbl52']);
?>
</body>
</html>