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

if(empty($title)) {$title  = $TEXT['global-title'];}
if(empty($description)) {$description = $TEXT['global-description'];}
?>
<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'])) {puterror4('',$TEXT['error-loginform4']); exit();}
  if(strlen($_COOKIE['ident'])>15) {puterror4('',$TEXT['error-login14']); exit();}
  if(empty($_COOKIE['passwrd'])) {puterror4('',$TEXT['error-loginform4']); exit();}
  if(strlen($_COOKIE['passwrd'])>100) {puterror4('',$TEXT['error-login5']); exit();}

  $query = "SELECT login_id, login, skin, pass, administrator, user, name, otchestvo FROM `tbl_logins` WHERE `login_id`='".$_COOKIE['ident']."' ";
  $result = mysqli_query($dbcnx,$query);
  if(!$result) {puterror($result2['skin'],$TEXT['error-tbl7']); require_once "../utils/bottom_adm.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_adm.php"; exit();}
if(empty($passw1))
{
 puterror($result2['skin'],$TEXT['error-loginform1']);
 require_once "../utils/bottom_adm.php";
 exit();
}

$query_autor = "SELECT DISTINCT first_bt AS fbas FROM `tbl_autor` ORDER BY fbas LIMIT 1 ";
$result_autor = mysqli_query($dbcnx,$query_autor);
if(!$result_autor) {puterror($result2['skin'],$TEXT['error-tbl1']); require_once "../utils/bottom_adm.php"; exit();}
$first_bk = mysqli_fetch_array($result_autor);
$bkv = $first_bk['fbas'];

$query_book = "SELECT DISTINCT first_bt AS bukva2 FROM `tbl_book` ORDER BY bukva2 LIMIT 1 ";
$result_book = mysqli_query($dbcnx,$query_book);
if(!$result_book) {puterror($result2['skin'],$TEXT['error-tbl3']); require_once "../utils/bottom_adm.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" />
 </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="../extsearch.php" method="post">
         <table width="100%"  border="0" cellspacing="0" cellpadding="0">
          <tr>
           <td width="55%">
            <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="#null"><?php echo $TEXT['menu-btn2']; ?></a>
                <ul>
                 <li><a href="../alfaut-search.php?bukva=<?php echo $bkv; ?>" class="link" title="<?php echo $TEXT['menu-btn23']; ?>"><?php echo $TEXT['menu-btn23']; ?></a></li>
                 <li><a href="../alfbook-search.php?bukva=<?php echo $bkv2; ?>" class="link" title="<?php echo $TEXT['menu-btn24']; ?>"><?php echo $TEXT['menu-btn24']; ?></a></li>
                </ul>
               </li>
               <li><a href="../reating-search.php" class="link" title="<?php echo $TEXT['menu-btn30-title']; ?>"><?php echo $TEXT['menu-btn30']; ?></a></li>
               <li><a href="../vidano-search.php" class="link" title="<?php echo $TEXT['menu-btn31-title']; ?>"><?php echo $TEXT['menu-btn31']; ?></a></li>
               <li><a href="../reserv-search.php" class="link" title="<?php echo $TEXT['menu-btn32-title']; ?>"><?php echo $TEXT['menu-btn32']; ?></a></li>
               <li><a href="../zakupka-search.php" class="link" title="<?php echo $TEXT['book-show5-tit']; ?>"><?php echo $TEXT['book-show5']; ?></a></li>
               <li><a href="../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="../books/index.php" class="link" title="<?php echo $TEXT['menu-btn24-title']; ?>"><?php echo $TEXT['menu-btn24']; ?></a></li>
                 <li><a href="../autors/index.php" class="link" title="<?php echo $TEXT['menu-btn23-title']; ?>"><?php echo $TEXT['menu-btn23']; ?></a></li>
                 <li><a href="../izd/index.php" class="link" title="<?php echo $TEXT['menu-btn22-title']; ?>"><?php echo $TEXT['menu-btn22']; ?></a></li>
                 <li><a href="../libr/index.php" class="link" title="<?php echo $TEXT['menu-btn21-title']; ?>"><?php echo $TEXT['menu-btn21']; ?></a></li>
                 <li><a href="../zal/index.php" class="link" title="<?php echo $TEXT['menu-btn20-title']; ?>"><?php echo $TEXT['menu-btn20']; ?></a></li>
                 <li><a href="../shkaf/index.php" class="link" title="<?php echo $TEXT['menu-btn19-title']; ?>"><?php echo $TEXT['menu-btn19']; ?></a></li>
                 <li><a href="../polki/index.php" class="link" title="<?php echo $TEXT['menu-btn18-title']; ?>"><?php echo $TEXT['menu-btn18']; ?></a></li>
                 <li><a href="../cicl/index.php" class="link" title="<?php echo $TEXT['menu-btn17-title']; ?>"><?php echo $TEXT['menu-btn17']; ?></a></li>
                 <li><a href="../zhanr/index.php" class="link" title="<?php echo $TEXT['menu-btn15-title']; ?>"><?php echo $TEXT['menu-btn15']; ?></a></li>
                 <li><a href="../typeizd/index.php" class="link" title="<?php echo $TEXT['menu-btn13-title']; ?>"><?php echo $TEXT['menu-btn13']; ?></a></li>
                 <li><a href="../berezh/index.php" class="link" title="<?php echo $TEXT['menu-btn26-title']; ?>"><?php echo $TEXT['menu-btn26']; ?></a></li>
                 <li><a href="../domain/index.php" class="link" title="<?php echo $TEXT['menu-btn12-title']; ?>"><?php echo $TEXT['menu-btn12']; ?></a></li>
                 <li><a href="../seriya/index.php" class="link" title="<?php echo $TEXT['menu-btn29-title']; ?>"><?php echo $TEXT['menu-btn29']; ?></a></li>
                </ul>
               </li>
               <li><a href="#null"><?php echo $TEXT['menu-obsluzhivanie']; ?></a>
                <ul>
                 <li><a href="../service/analize.php" class="link" title="<?php echo $TEXT['menu-btn11-title']; ?>"><?php echo $TEXT['menu-btn11']; ?></a></li>
                 <li><a href="../service/optimize.php" class="link" title="<?php echo $TEXT['menu-btn10-title']; ?>"><?php echo $TEXT['menu-btn10']; ?></a></li>
                 <li><a href="../service/check.php" class="link" title="<?php echo $TEXT['menu-btn9-title']; ?>"><?php echo $TEXT['menu-btn9']; ?></a></li>
                 <li><a href="../service/repair.php" class="link" title="<?php echo $TEXT['menu-btn6-title']; ?>"><?php echo $TEXT['menu-btn6']; ?></a></li>
                 <li><a href="../service/dbsize.php" class="link" title="<?php echo $TEXT['menu-btn4-title']; ?>"><?php echo $TEXT['menu-btn4']; ?></a></li>
                 <li><a href="../ondisk/index.php" class="link" title="<?php echo $TEXT['menu-btn14-title']; ?>"><?php echo $TEXT['menu-btn14']; ?></a></li>
                 <li><a href="../savepar/index.php" class="link" title="<?php echo $TEXT['menu-btn28-title']; ?>"><?php echo $TEXT['menu-btn28']; ?></a></li>
                 <li><a href="../service/dump.php" class="link" title="<?php echo $TEXT['backup-tit']; ?>"><?php echo $TEXT['backup-tit']; ?></a></li>
                 <li><a href="../service/importfrm.php" class="link" title="<?php echo $TEXT['restore-tit']; ?>"><?php echo $TEXT['menu-btn34']; ?></a></li>
                </ul>
               </li>
               <li><a href="../logs/index.php" class="link" title="<?php echo $TEXT['menu-btn5-title']; ?>"><?php echo $TEXT['menu-btn5']; ?></a></li>
               <li><a href="../logs/statistic_sm.php" class="link" title="<?php echo $TEXT['menu-btn27-title']; ?>"><?php echo $TEXT['menu-btn27']; ?></a></li>
               <li><a href="../logins/index.php" class="link" title="<?php echo $TEXT['menu-btn7-title']; ?>"><?php echo $TEXT['menu-btn7']; ?></a></li>
              </ul>
             </li>
            </ul>
           </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="hidden" name="typepar" value="5" />
            <a href="info.php?st=1&amp;login_id=<?php echo $_GET['login_id']; ?>" title="<?php echo $TEXT['menu-btn31-title']; ?>" ><span class="informssilka"><?php echo $TEXT['book-onhand']; ?></span></a> / 
            <a href="info.php?st=2&amp;login_id=<?php echo $_GET['login_id']; ?>" title="<?php echo $TEXT['menu-btn32-title']; ?>" ><span class="informssilka"><?php echo $TEXT['menu-btn32']; ?></span></a> /
            <a href="info.php?st=3&amp;login_id=<?php echo $_GET['login_id']; ?>" title="<?php echo $TEXT['book-give']; ?>" ><span class="informssilka"><?php echo $TEXT['book-give']; ?></span></a> /
            <a href="info.php?st=4&amp;login_id=<?php echo $_GET['login_id']; ?>" title="<?php echo $TEXT['book-otziv4']; ?>" ><span class="informssilka"><?php echo $TEXT['book-otziv5']; ?></span></a> /
           </td>
          </tr>
         </table>
         <hr size="3" width="98%" />
        </form>
      <tr>
       <td>