<!DOCTYPE html>
<?php
  ///////////////////////////////////////////////////
  //2009 (C)
  //Карпухин Павел
  ///////////////////////////////////////////////////

  if(empty($title)) {$title  = $TEXT['global-film'];}
  if(empty($description)) {$description = $TEXT['global-film-description'];}

   $address = "http://".$_SERVER['SERVER_ADDR']."/library/film_main.php";
?>
<html>
<head>
<meta charset="utf-8" />
<meta name="ROBOTS" content="NOINDEX, NOFOLLOW" />
<meta http-equiv="Expires" content="Mon, 23 May 1995 02:00:00 GMT" />
<meta http-equiv="Cache-Control" content="no-cache, must-revalidate" />
<meta name="description" content="<?php echo $description; ?>" />
<title><?php echo $title; ?></title>
<?php
  if(empty($_COOKIE['ident'])) {puterror3('',$TEXT['error-loginform5']); exit();}
  if(strlen($_COOKIE['ident'])>15) {puterror3('',$TEXT['error-login14']); exit();}
  if(empty($_COOKIE['passwrd'])) {puterror3('',$TEXT['error-loginform5']); exit();}
  if(strlen($_COOKIE['passwrd'])>100) {puterror3('',$TEXT['error-login5']); exit();}

  $query = "SELECT login_id, login, skin2 AS skin, pass, administrator, user, name, familiya, otchestvo, chk_upd FROM `tbl_logins` WHERE `login_id`='".$_COOKIE['ident']."' ";
  $result = mysqli_query($dbcnx,$query);
  if(!$result) {puterror2($result2['skin'],$TEXT['error-tbl7']); require_once "../utils/bottom_film.php"; exit();}
      $result2 = mysqli_fetch_array($result);
      $passw1 = $_COOKIE['passwrd'];
      $passw2 = $result2['pass'];

       if($passw1 !== $passw2) {puterror($result2['skin'],$TEXT['error-loginform1']); require_once "../utils/bottom_film.php"; exit();}
       if(empty($passw1)) {puterror2($result2['skin'],$TEXT['error-loginform1']); require_once "../utils/bottom_film.php"; exit();}

   $query_book = "SELECT DISTINCT first_bt AS bukva2 FROM `tbl_film` ORDER BY bukva2 LIMIT 1 ";
   $result_book = mysqli_query($dbcnx,$query_book);
    if(!$result_book) {puterror2($result2['skin'],$TEXT['error-tbl3']); require_once "utils/bottom_film.php"; exit();}
     $first_bk2 = mysqli_fetch_array($result_book);
      $bkv2 = $first_bk2['bukva2'];

$month["1"] = $TEXT['month01'];
$month["2"] = $TEXT['month02'];
$month["3"] = $TEXT['month03'];
$month["4"] = $TEXT['month04'];
$month["5"] = $TEXT['month05'];
$month["6"] = $TEXT['month06'];
$month["7"] = $TEXT['month07'];
$month["8"] = $TEXT['month08'];
$month["9"] = $TEXT['month09'];
$month["01"] = $TEXT['month01'];
$month["02"] = $TEXT['month02'];
$month["03"] = $TEXT['month03'];
$month["04"] = $TEXT['month04'];
$month["05"] = $TEXT['month05'];
$month["06"] = $TEXT['month06'];
$month["07"] = $TEXT['month07'];
$month["08"] = $TEXT['month08'];
$month["09"] = $TEXT['month09'];
$month["10"] = $TEXT['month10'];
$month["11"] = $TEXT['month11'];
$month["12"] = $TEXT['month12'];
?>
<link rel="StyleSheet" href="skins/<?php echo $result2['skin']; ?>/reader.css" />
<link rel="icon" href="favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
<link rel="search" type="application/opensearchdescription+xml" title="<?php echo $TEXT['global-title'] ?>" href="http://<?php echo $_SERVER['SERVER_ADDR'] ?>/library/utils/library-<?php echo $lang ?>.xml">
</head>
<body>
<script src="utils/drop_down.js"></script>
<table align="center" width="95%" border="0" cellspacing="0" cellpadding="0">
 <tr>
  <td width="16">&nbsp;</td>
  <td></td>
  <td width="16">&nbsp;</td>
 </tr>
 <tr>
   <td class="osn_top_r"></td>
   <td class="osn_top"></td>
   <td class="osn_top_l"><a href="logout.php" class=shut_img title="<?php echo $TEXT['global-logout-tit']; ?>"><img class="shut_logo" alt="<?php echo $TEXT['global-logout2']; ?>" src="skins/<?php echo $result2['skin']; ?>/clear.png"></a></td>
 </tr>
 <tr>
   <td class="osn_left">&nbsp;</td>
   <td class="osn_center">
    <table width="100%"  border="0" cellspacing="0" cellpadding="0">
     <tr>
      <td>
      <form action="film-extsearch.php" method=post>
      <table width="100%"  border="0" cellspacing="0" cellpadding="0">
        <tr>
         <td width="55%">
           <?php
           if($result2['administrator'] == 1)
           {
           ?>
           <ul id="nav">
	     <li><a href="film_main.php" class="link" title="<?php echo $TEXT['menu-btn1-title-film']; ?>"><?php echo $TEXT['menu-btn1']; ?></a>
               <ul>
                 <li><a href="film-printform.php" class="link" title="<?php echo $TEXT['menu-btn33-title']; ?>"><?php echo $TEXT['menu-btn33']; ?></a></li>
                 <li><a href="main.php" class="link" title="<?php echo $TEXT['global-description']; ?>"><?php echo $TEXT['book-bibl']; ?></a></li>
               </ul>
             </li>
	     <li><a href="#null"><?php echo $TEXT['search-btn']; ?></a>
               <ul>
                <li><a href="film-alf-search.php?bukva=<?php echo $bkv2; ?>" class="link" title="<?php echo $TEXT['search-alf-film']; ?>"><?php echo $TEXT['menu-btn2']; ?></a></li>
                <li><a href="film-reating-search.php" class="link" title="<?php echo $TEXT['menu-btn30-title']; ?>"><?php echo $TEXT['menu-btn30']; ?></a></li>
                <li><a href="film-vidano-search.php" class="link" title="<?php echo $TEXT['menu-btn31-title']; ?>"><?php echo $TEXT['menu-btn31']; ?></a></li>
                <li><a href="film-reserv-search.php" class="link" title="<?php echo $TEXT['menu-btn32-title']; ?>"><?php echo $TEXT['menu-btn32']; ?></a></li>
                <li><a href="film-zakupka-search.php" class="link" title="<?php echo $TEXT['book-show5-tit']; ?>"><?php echo $TEXT['book-show5']; ?></a></li>
                <li><a href="film-extsearchform.php" class="link" title="<?php echo $TEXT['menu-btn3']; ?>"><?php echo $TEXT['menu-btn3']; ?></a></li>
	      </ul>
	    </li>
	    <li><a href="#null"><?php echo $TEXT['global-admin']; ?></a>
	      <ul>
		<li><a href="#null"><?php echo $TEXT['menu-btn25']; ?></a>
                  <ul>
                    <li><a href="films/index.php" class="link" title="<?php echo $TEXT['menu-btn39-title']; ?>"><?php echo $TEXT['menu-btn39']; ?></a></li>
                    <li><a href="film-izd/index.php" class="link" title="<?php echo $TEXT['menu-btn22-title-film']; ?>"><?php echo $TEXT['menu-btn22-film']; ?></a></li>
                    <li><a href="film-libr/index.php" class="link" title="<?php echo $TEXT['menu-btn21-title-film']; ?>"><?php echo $TEXT['menu-btn21-film']; ?></a></li>
                    <li><a href="film-zal/index.php" class="link" title="<?php echo $TEXT['menu-btn20-title']; ?>"><?php echo $TEXT['menu-btn20']; ?></a></li>
                    <li><a href="film-shkaf/index.php" class="link" title="<?php echo $TEXT['menu-btn19-title']; ?>"><?php echo $TEXT['menu-btn19']; ?></a></li>
                    <li><a href="film-polki/index.php" class="link" title="<?php echo $TEXT['menu-btn18-title']; ?>"><?php echo $TEXT['menu-btn18']; ?></a></li>
                    <li><a href="film-cicl/index.php" class="link" title="<?php echo $TEXT['menu-btn17-title-film']; ?>"><?php echo $TEXT['menu-btn17']; ?></a></li>
                    <li><a href="film-zhanr/index.php" class="link" title="<?php echo $TEXT['menu-btn15-title']; ?>"><?php echo $TEXT['menu-btn15']; ?></a></li>
                    <li><a href="film-nositel/index.php" class="link" title="<?php echo $TEXT['menu-btn36-title']; ?>"><?php echo $TEXT['menu-btn36']; ?></a></li>
                    <li><a href="film-berezh/index.php" class="link" title="<?php echo $TEXT['menu-btn26-title']; ?>"><?php echo $TEXT['menu-btn26']; ?></a></li>
                    <li><a href="film-vozrast/index.php" class="link" title="<?php echo $TEXT['tbl-vozrast']; ?>"><?php echo $TEXT['vozrast-title']; ?></a></li>
                    <li><a href="film-domain/index.php" class="link" title="<?php echo $TEXT['menu-btn12-title']; ?>"><?php echo $TEXT['menu-btn12']; ?></a></li>
                    <li><a href="film-seriya/index.php" class="link" title="<?php echo $TEXT['menu-btn29-title-film']; ?>"><?php echo $TEXT['menu-btn29']; ?></a></li>
                    <li><a href="film-sound/index.php" class="link" title="<?php echo $TEXT['menu-btn37-title']; ?>"><?php echo $TEXT['menu-btn37']; ?></a></li>
                  </ul>
	        </li>
	        <li><a href="#null"><?php echo $TEXT['menu-obsluzhivanie']; ?></a>
	          <ul>
	            <li><a href="film-service/analize.php" class="link" title="<?php echo $TEXT['menu-btn11-title']; ?>"><?php echo $TEXT['menu-btn11']; ?></a></li>
		    <li><a href="film-service/optimize.php" class="link" title="<?php echo $TEXT['menu-btn10-title']; ?>"><?php echo $TEXT['menu-btn10']; ?></a></li>
		    <li><a href="film-service/check.php" class="link" title="<?php echo $TEXT['menu-btn9-title']; ?>"><?php echo $TEXT['menu-btn9']; ?></a></li>
                    <li><a href="film-service/repair.php" class="link" title="<?php echo $TEXT['menu-btn6-title']; ?>"><?php echo $TEXT['menu-btn6']; ?></a></li>
                    <li><a href="film-service/dbsize.php" class="link" title="<?php echo $TEXT['menu-btn4-title']; ?>"><?php echo $TEXT['menu-btn4']; ?></a></li>
                    <li><a href="film-ondisk/index.php" class="link" title="<?php echo $TEXT['menu-btn14-title']; ?>"><?php echo $TEXT['menu-btn14']; ?></a></li>
                    <li><a href="film-savepar/index.php" class="link" title="<?php echo $TEXT['menu-btn28-title']; ?>"><?php echo $TEXT['menu-btn28']; ?></a></li>
                    <li><a href="film-service/dump.php" class="link" title="<?php echo $TEXT['backup-tit']; ?>"><?php echo $TEXT['backup-tit']; ?></a></li>
		    <li><a href="film-service/importfrm.php" class="link" title="<?php echo $TEXT['restore-tit']; ?>"><?php echo $TEXT['menu-btn34']; ?></a></li>
                  </ul>
		</li>
		<li><a href="film-logs/index.php" class="link" title="<?php echo $TEXT['menu-btn5-title']; ?>"><?php echo $TEXT['menu-btn5']; ?></a></li>
                <li><a href="film-logs/statistic_sm.php" class="link" title="<?php echo $TEXT['menu-btn27-title']; ?>"><?php echo $TEXT['menu-btn27']; ?></a></li>
                <li><a href="film-logins/index.php" class="link" title="<?php echo $TEXT['menu-btn7-title']; ?>"><?php echo $TEXT['menu-btn7']; ?></a></li>
	      </ul>
	   </li>
        </ul>
       <?php
       }
       else
        {
        ?>
        <ul id="nav">
	     <li><a href="main.php" class="link" title="<?php echo $TEXT['menu-btn1-title']; ?>"><?php echo $TEXT['menu-btn1']; ?></a>
               <ul>
                 <li><a href="printform.php" class="link" title="<?php echo $TEXT['menu-btn33-title']; ?>"><?php echo $TEXT['menu-btn33']; ?></a></li>
               </ul>
             </li>
	     <li><a href="#null"><?php echo $TEXT['search-btn']; ?></a>
               <ul>
                <li><a href="film-alf-search.php?bukva=<?php echo $bkv2; ?>" class="link" title="<?php echo $TEXT['search-alf-film']; ?>"><?php echo $TEXT['menu-btn2']; ?></a>
                </li>
                <li><a href="film-reating-search.php" class="link" title="<?php echo $TEXT['menu-btn30-title']; ?>"><?php echo $TEXT['menu-btn30']; ?></a></li>
                <li><a href="film-vidano-search.php" class="link" title="<?php echo $TEXT['menu-btn31-title']; ?>"><?php echo $TEXT['menu-btn31']; ?></a></li>
                <li><a href="film-reserv-search.php" class="link" title="<?php echo $TEXT['menu-btn32-title']; ?>"><?php echo $TEXT['menu-btn32']; ?></a></li>
                <li><a href="film-zakupka-search.php" class="link" title="<?php echo $TEXT['book-show5-tit']; ?>"><?php echo $TEXT['book-show5']; ?></a></li>
                <li><a href="film-extsearchform.php" class="link" title="<?php echo $TEXT['menu-btn3']; ?>"><?php echo $TEXT['menu-btn3']; ?></a></li>
	      </ul>
	    </li>
	 </ul>
      <?php
       }
     ?>
  </td>
  <td align="right"><input class="inputsearch" size=30 maxlength=50 type=text name=search title="<?php echo $TEXT['search-btn-title']; ?>" >&nbsp;<input type=submit class=button value='<?php echo $TEXT['search-btn']; ?>'></td>
</tr>
  </table>
  <hr size="1" width="99%" />
  <table width="100%" border="0" cellspacing="0" cellpadding="0">
   <tr>
    <td align="left" class="bold_it"><?php echo $TEXT['global-hellow']; ?><?php echo $result2['name']; ?> <?php echo $result2['otchestvo']; ?></td>
    <td align="right" class="menu">
    <input type=radio name=typepar value=5 checked><?php echo $TEXT['search-all']; ?>
    <input type=radio name=typepar value=1><?php echo $TEXT['film-name']; ?>
    <input type=radio name=typepar value=2><?php echo $TEXT['film-soderzh']; ?>
    <input type=radio name=typepar value=3><?php echo $TEXT['book-opis']; ?>
    </td>
  </tr>
 </table>
</form>
<hr size="3" width="98%" />
<tr>
 <td>