<?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['evnt-del'];
  $helppage = "";

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

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

  if(empty($_GET['room_id'])) puterror2($TEXT['meet-err-edit2']);
  if(strlen($_GET['room_id'])>11) puterror2($TEXT['meet-err-edit3']);
  if(empty($_GET['evnt_id'])) puterror2($TEXT['meet-err-edit2']);
  if(strlen($_GET['evnt_id'])>11) puterror2($TEXT['meet-err-edit3']);
  $_GET['room_id'] = rep($_GET['room_id']);
  $_GET['evnt_id'] = rep($_GET['evnt_id']);

  $room_id = $_GET['room_id'];
  $evnt_id = $_GET['evnt_id'];

  //*************************************
  $query = "SELECT `meet_name` FROM `tbl_meet_event` WHERE `evnt_id`='".$_GET['evnt_id']."' ";
  $result = mysql_query($query);
  if(!$result) puterror2($TEXT['error-tbl49']);
   $result_log = mysql_fetch_array($result,MYSQL_ASSOC);

  $ip = $_SERVER['REMOTE_ADDR'];
  $doing = $TEXT['log-evnt3'];
  $what = $result_log['meet_name'];
  $who = $result2['fullname'];
  //*************************************
  $query2 = "DELETE FROM `tbl_meet_event` WHERE `evnt_id`='$evnt_id'";
  if(mysql_query($query2))
  {
    $query3 = "INSERT INTO `tbl_logs` ( `log_id` , `data` , `ip` , `who` , `doing` , `what` ) VALUES ( NULL , NOW() , '$ip' , '$who' , '$doing' , '$what')";
        if(mysql_query($query3))
           {
             echo "<html><head>
                   <meta HTTP-EQUIV='Refresh' CONTENT='0; URL=deleteform.php?room_id=$room_id' />
                   </head></html>";
           } else puterror2($TEXT['error-log']);
  } else puterror2($TEXT['error-inst8']);
  require_once "../util/bottom.php";
?>