<?php
  ///////////////////////////////////////////////////
  //Включить резервирование
  //2010 (C)
  //Карпухин Павел
  ///////////////////////////////////////////////////
  require_once "../utils/chlang.php";

  $title = $TEXT['book-rez'];

  require_once "../config_a.php";
  require_once "../utils/functions.php";
  require_once "../utils/top_adm_film.php";

  if($result2['administrator'] == 0) {puterror($result2['skin'],$TEXT['error-loginform2']); require_once "../utils/bottom_adm_film.php"; exit();}

  if(empty($_POST['film_id'])) {puterror($result2['skin'],$TEXT['error-film5']); require_once "../utils/bottom_adm_film.php"; exit();}
  if(strlen($_POST['film_id'])>20) {puterror($result2['skin'],$TEXT['error-film6']); require_once "../utils/bottom_adm_film.php"; exit();}
  if(empty($_POST['user_id'])) {puterror($result2['skin'],$TEXT['error-login15']); require_once "../utils/bottom_adm_film.php"; exit();}
  if(strlen($_POST['user_id'])>15) {puterror($result2['skin'],$TEXT['error-login14']); require_once "../utils/bottom_adm_film.php"; exit();}
  if(empty($_POST['data_zakaza'])) {puterror($result2['skin'],$TEXT['error-film12']); require_once "../utils/bottom_adm_film.php"; exit();}
  if(strlen($_POST['data_zakaza'])>10) {puterror($result2['skin'],$TEXT['error-film13']); require_once "../utils/bottom_adm_film.php"; exit();}
  $_POST['film_id'] = rep($_POST['film_id']);
  $_POST['user_id'] = rep($_POST['user_id']);
  $_POST['data_zakaza'] = rep($_POST['data_zakaza']);

  $query = "UPDATE `tbl_film` SET `user_id_zak`='".$_POST['user_id']."', `data_zakaza`='".$_POST['data_zakaza']."', `zakazano`= '1' WHERE `film_id`='".$_POST['film_id']."' ";
  if(mysqli_query($dbcnx,$query))
  {
    echo "<html><head>
          <meta HTTP-EQUIV='Refresh' CONTENT='0; URL=info.php?film_id=".$_POST['film_id']."' />
          </head></html>";
  } else {puterror($result2['skin'],$TEXT['error-tbl3']); require_once "../utils/bottom_adm_film.php"; exit();}
  require_once "../utils/bottom_adm_film.php";
?>