<?php
  ///////////////////////////////////////////////////
  //2010 (C)
  //Карпухин Павел
  ///////////////////////////////////////////////////
  require_once "utils/chlang_osn.php";

  $title = $TEXT['book-rez'];
  $button = $TEXT['book-rez-on'];
  $action = "rez_on.php";
?>
<!--<script type="text/javascript" language="JavaScript" src="lang/<?php echo $lang; ?>/calendar_usr.js"></script>-->
<?php
  require_once "config.php";
  require_once "utils/functions.php";
  require_once "utils/top.php";

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

  if(empty($_GET['book_id'])) {puterror2($result2['skin'],$TEXT['error-book5']); require_once "utils/bottom.php"; exit();}
  if(strlen($_GET['book_id'])>20) {puterror2($result2['skin'],$TEXT['error-book6']); require_once "utils/bottom.php"; exit();}
  $_GET['book_id'] = rep($_GET['book_id']);

  $date_day = date("d");
  $date_month = date("m");
  $date_year = date("Y");
  $chislo = (date("$date_year\-$date_month\-$date_day"));

  $query10 = "SELECT login_id,  name, familiya, otchestvo FROM `tbl_logins` WHERE login_id = '".$result2['login_id'] ."' ";
     $result10 = mysqli_query($dbcnx,$query10);
       if(!$result10) {puterror2($result2['skin'],$TEXT['error-tbl7']); require_once "utils/bottom.php"; exit();}
         $result_login = mysqli_fetch_array($result10);
?>
<form name="book" enctype="multipart/form-data" action="<?php echo $action; ?>" method="post">
<table align="center" >
<tr><td class="bold_it"><?php echo $TEXT['book-data5']; ?>:</td><td><input size="10" maxlength="10" type="date" name="data_zakaza" value="<?php echo $chislo; ?>" />
<!--<script type="text/javascript" language="JavaScript">
	var o_cal = new tcal ({
		// form name
		'formname': 'book',
		// input name
		'controlname': 'data_zakaza'
	});
	</script>-->
    </td></tr>
<?php
if($result2['administrator'] == 0) {
echo "<tr><td class='bold_it'>".$TEXT['user-tit'].": </td><td class='input'>".$result_login['familiya']."&nbsp;".$result_login['name']."&nbsp;".$result_login['otchestvo']."</td></tr>";
} else {
    echo "<tr><td class='bold_it'>".$TEXT['user-tit']."</td><td>";
    echo "<select name='user_id'>";
        $query10 = "SELECT login_id, name, familiya, otchestvo FROM `tbl_logins` ORDER BY familiya ";
          $result10 = mysqli_query($dbcnx,$query10);
            if (!$result10) {puterror($result2['skin'],$TEXT['error-tbl7']); require_once "utils/bottom.php"; exit();}
              while($result_login = mysqli_fetch_array($result10))
                {
                    if($result_login['login_id'] == $result2['login_id']) {$chk_login = "<option selected value=".$result_login['login_id'].">".$result_login['familiya']."&nbsp;".$result_login['name']."&nbsp;".$result_login['otchestvo']."";}
                    else {$chk_login = "<option value=".$result_login['login_id'].">".$result_login['familiya']."&nbsp;".$result_login['name']."&nbsp;".$result_login['otchestvo']."";}
                 echo $chk_login;
                }
}

echo "<tr><td></td><td><input class='button2' type='submit' value='".$button."' />";
echo "<input type='hidden' name='book_id' value='".$_GET['book_id']."' />";
if($result2['administrator'] == 0) {echo "<input  type='hidden' name='user_id' value='".$result_login['login_id']."' />";}

echo "</td></tr>";
echo "</table>";
echo "</form>";
require_once "utils/bottom.php";
?>