<?php
  ///////////////////////////////////////////////////
  //2010 (C)
  //Карпухин Павел
  ///////////////////////////////////////////////////

  require_once "../utils/chlang.php";

  $title = $TEXT['aut-title-info'];
  $button = $TEXT['btn_back'];
  $action = "index.php";

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

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

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

$query_iskh = "SELECT 
tbl_book.*,
YEAR(tbl_book.data_postupleniya) AS data_postupleniya_year,
MONTH(tbl_book.data_postupleniya) AS data_postupleniya_month,
DAY(tbl_book.data_postupleniya) AS data_postupleniya_day,
YEAR(tbl_book.data_vidachi) AS data_vidachi_year,
MONTH(tbl_book.data_vidachi) AS data_vidachi_month,
DAY(tbl_book.data_vidachi) AS data_vidachi_day,
YEAR(tbl_book.data_sdachi) AS data_sdachi_year,
MONTH(tbl_book.data_sdachi) AS data_sdachi_month,
DAY(tbl_book.data_sdachi) AS data_sdachi_day,
YEAR(tbl_book.data_zakaza) AS data_zakaza_year,
MONTH(tbl_book.data_zakaza) AS data_zakaza_month,
DAY(tbl_book.data_zakaza) AS data_zakaza_day,
tbl_cicle.cicle,
tbl_biblioteka.name AS biblioteka,
tbl_biblioteka.bibl_id,
tbl_zhanr.zhanr_id,
tbl_zhanr.zhanr,
tbl_tip_izd.tip_izd_id,
tbl_tip_izd.tip_izd,
tbl_zal.zal_id,
tbl_zal.zal,
tbl_shkaf.shkaf_id,
tbl_shkaf.shkaf,
tbl_polka.polka_id,
tbl_polka.polka,
tbl_seriya.ser_id,
tbl_seriya.seriya,
lang1.bl_id AS bl_id1,
lang1.booklang AS booklang1,
lang1.picture AS picture1,
lang2.bl_id AS bl_id2,
lang2.booklang AS booklang2,
lang2.picture AS picture2
FROM tbl_book
JOIN tbl_cicle ON tbl_book.cicle_id=tbl_cicle.cicle_id
JOIN tbl_biblioteka ON tbl_book.bibl_id=tbl_biblioteka.bibl_id
JOIN tbl_zhanr ON tbl_book.zhanr_id=tbl_zhanr.zhanr_id
JOIN tbl_tip_izd ON tbl_book.tip_izd_id=tbl_tip_izd.tip_izd_id
JOIN tbl_zal ON tbl_book.zal_id=tbl_zal.zal_id
JOIN tbl_shkaf ON tbl_book.shkaf_id=tbl_shkaf.shkaf_id
JOIN tbl_polka ON tbl_book.polka_id=tbl_polka.polka_id
JOIN tbl_seriya ON tbl_book.ser_id=tbl_seriya.ser_id
JOIN tbl_booklang AS lang1 ON tbl_book.bl_id=lang1.bl_id
JOIN tbl_booklang AS lang2 ON tbl_book.bl2_id=lang2.bl_id
WHERE book_id = '".$_GET['book_id']."' ";
  $result_iskh = mysqli_query($dbcnx,$query_iskh);
  if(!$result_iskh) {puterror($result2['skin'],$TEXT['error-tbl3']); require_once "../utils/bottom_adm.php"; exit();}
      $result_iskh2 = mysqli_fetch_array($result_iskh);

     $bnt = substr($result_iskh2['book_num'],0,1);
      if($bnt == '0')
      {
       $book_n = substr($result_iskh2['book_num'],1,1);
        if($book_n == '0')
        {
         $book_num = substr($result_iskh2['book_num'],2,3);
        } else {$book_num = substr($result_iskh2['book_num'],1,3);}
       } else {$book_num = $result_iskh2['book_num'];}

      $date_day = $result_iskh2['data_postupleniya_day'];
      $date_month = $result_iskh2['data_postupleniya_month'];
      $date_year = $result_iskh2['data_postupleniya_year'];
      if($date_year == "0000" || $date_year == "1970") {$data_r = "---";}
       else {$data_r = $date_day." ".$month[$date_month]." ".$date_year." ".$TEXT['year2'];}

      $date_day2 = $result_iskh2['data_izdaniya'];
      if($date_day2 == "0000" || $date_day2 == "1970") {$data_r2 = "---";}
       else {$data_r2 = $date_day2." ".$TEXT['year'];}

      $date_day3 = $result_iskh2['data_vidachi_day'];
      $date_month3 = $result_iskh2['data_vidachi_month'];
      $date_year3 = $result_iskh2['data_vidachi_year'];
      if($date_year3 == "0000" || $date_year3 == "1970") {$data_r3 = "---";}
       else {$data_r3 = $date_day3." ".$month[$date_month3]." ".$date_year3." ".$TEXT['year2'];}

      $date_day4 = $result_iskh2['data_sdachi_day'];
      $date_month4 = $result_iskh2['data_sdachi_month'];
      $date_year4 = $result_iskh2['data_sdachi_year'];
      if($date_year4 == "0000" || $date_year4 == "1970") {$data_r4 = "---";}
       else {$data_r4 = $date_day4." ".$month[$date_month4]." ".$date_year4." ".$TEXT['year2'];}

      $date_day5 = $result_iskh2['data_zakaza_day'];
      $date_month5 = $result_iskh2['data_zakaza_month'];
      $date_year5 = $result_iskh2['data_zakaza_year'];
      if($date_year5 == "0000" || $date_year5 == "1970") {$data_r5 = "---";}
       else {$data_r5 = $date_day5." ".$month[$date_month5]." ".$date_year5." ".$TEXT['year2'];}

     $query_autor = "SELECT
     tbl_s_book_aut.*,
     tbl_autor.autor_id,
     tbl_autor.name,
     tbl_autor.familiya,
     tbl_autor.otchestvo
     FROM tbl_s_book_aut
     JOIN tbl_autor ON tbl_s_book_aut.autor_id=tbl_autor.autor_id
    WHERE book_id = '".$_GET['book_id']."' ";
    $result_autor = mysqli_query($dbcnx,$query_autor);
     if (!$result_autor) {puterror($result2['skin'],$TEXT['error-tbl16']); require_once "../utils/bottom_adm.php"; exit();}
      while($result_autor2 = mysqli_fetch_array($result_autor))
       {
           $autor .= rep_back($result_autor2['name'])." ".rep_back($result_autor2['otchestvo'])." ".rep_back($result_autor2['familiya']).", ";
       }
       $autors = substr($autor, 0,-2);

     $query_izd = "SELECT
     tbl_s_book_izd.*,
     tbl_izdatelstvo.*
     FROM tbl_s_book_izd
     JOIN tbl_izdatelstvo ON tbl_s_book_izd.izd_id=tbl_izdatelstvo.izd_id
     WHERE book_id = '".$_GET['book_id']."' ";
     $result_izd = mysqli_query($dbcnx,$query_izd);
      if (!$result_izd) {puterror($result2['skin'],$TEXT['error-tbl17']); require_once "../utils/bottom_adm.php"; exit();}
      while($result_izd2 = mysqli_fetch_array($result_izd))
       {
           $izd .= "<a href='".$result_izd2['site_protocol']."://".$result_izd2['site_name']."' target=_blank title='".$TEXT['izd-str']."'>".$result_izd2['izdatelstvo']."</a>, ";
       }
       $izds = substr($izd, 0,-2);

      if(!empty($result_iskh2['site_name'])) {$address_aut = "<a href='".$result_iskh2['site_protocol']."://".$result_iskh2['site_name']."' target=_blank title=".$TEXT['aut-site'].">".$result_iskh2['site_protocol']."://".$result_iskh2['site_name']."</a>";}
       else {$address_aut = "";}

      if(!empty($result_iskh2['photo_book']) && file_exists($result_iskh2['photo_book'])) {$result_image = "<div id='resz-container'><a href='editform.php?book_id=".$_GET['book_id']."' title='".$TEXT['edit-tit']."'><img alt='".$TEXT['global-alt']."' src='".$result_iskh2['photo_book']."' /></a></div>";}
        else {$result_image = "<a href='editform.php?book_id=".$_GET['book_id']."' title='".$TEXT['edit-tit']."'><img alt='".$TEXT['global-alt']."' src='../skins/".$result2['skin']."/nophoto.png' /></a>";}


      #start 26.02.2019
      if(!empty($result_iskh2['paper_copy'] == "yes")) {$result_bl_pic_p = "&nbsp;<img align='top' alt='book' src='../skins/".$result2['skin']."/book.png' />";}
        else {$result_bl_pic_p = "";}

      if(!empty($result_iskh2['bl_id'] == $result_iskh2['bl2_id'])) {$result_bl_pic = "<img alt='".$result_iskh2['lang1.booklang']."' src='".$result_iskh2['lang1.picture']."' />";}
        else {$result_bl_pic = "<img alt='".$result_iskh2['lang1.booklang']."' src='".$result_iskh2['lang1.picture']."' />&nbsp;&nbsp;<img alt='".$result_iskh2['lang2.booklang']."' src='".$result_iskh2['lang2.picture']."' />";}

      if(!empty($result_iskh2['remote_copy'] == "yes")) {$result_bl_pic_e = "&nbsp;<img align='top' alt='remote' src='../skins/".$result2['skin']."/internet.png' />";}
        else {$result_bl_pic_e = "";}

      $usr_agnt = $_SERVER['HTTP_USER_AGENT'];
      $user_agent = device_check($usr_agnt);
      if($result_iskh2['bl_id'] == $result_iskh2['bl2_id'])
        {
        if(!empty($result_iskh2['picture1']) && file_exists($result_iskh2['picture1'])) {
            if($user_agent == "book") {$result_bl = "<span class='inform'>".$TEXT['menu-btn35']." &raquo; ".$result_iskh2['booklang1']."</span>";}
              else {$result_bl = "<img alt='".$result_iskh2['booklang1']."' src='".$result_iskh2['picture1']."' />";}
            $result_bl_tit = $TEXT['menu-btn35']." &raquo; ".$result_iskh2['booklang1'];
            }
            else {
                  $result_bl = "<span class='inform'>".$TEXT['menu-btn35']." &raquo; ".$result_iskh2['booklang1']."</span>";
                  $result_bl_tit = $TEXT['menu-btn35']." &raquo; ".$result_iskh2['booklang1'];
                 }
        } 
        else 
              {
               if(!empty($result_iskh2['picture1']) && file_exists($result_iskh2['picture1']) && !empty($result_iskh2['picture2']) && file_exists($result_iskh2['picture2'])) {
                   if($user_agent == "book") {$result_bl = "<span class='inform'>".$TEXT['menu-btn35']." &raquo; ".$result_iskh2['booklang1']."&comma;&nbsp;".$result_iskh2['booklang2']."</span>";}
                     else {$result_bl = "<img alt='".$result_iskh2['booklang1']."' src='".$result_iskh2['picture1']."' />&nbsp;<img alt='".$result_iskh2['booklang2']."' src='".$result_iskh2['picture2']."' />";}
                   $result_bl_tit = $TEXT['menu-btn35']." &raquo; ".$result_iskh2['booklang1']."&comma;&nbsp;".$result_iskh2['booklang2'];
                   }
                   else {
                        $result_bl = "<span class='inform'>".$TEXT['menu-btn35']." &raquo; ".$result_iskh2['booklang1']."&comma;&nbsp;".$result_iskh2['booklang2']."</span>";
                        $result_bl_tit = $TEXT['menu-btn35']." &raquo; ".$result_iskh2['booklang1']."&comma;&nbsp;".$result_iskh2['booklang2'];
                        }
               }

       #end 26.02.19

       if($result_iskh2['visible'] == '1') {$vis = "<a href='vis_off.php?book_id=".$_GET['book_id']."' title='".$TEXT['book-show-off']."'><img align='top' alt='".$TEXT['book-show2']."' src='../skins/".$result2['skin']."/visible.png' /></a>";}
        else {$vis = "<a href='vis_on.php?book_id=".$_GET['book_id']."'title='".$TEXT['book-show']."'><img align='top' alt='".$TEXT['book-show2']."' src='../skins/".$result2['skin']."/invisible.png' /></a>";}

       if($result_iskh2['napominalka'] == '1') {$nap = "<a href='nap_off.php?book_id=".$_GET['book_id']."' title='".$TEXT['book-nap-off']."'><img align='top' alt='".$TEXT['book-show2']."' src='../skins/".$result2['skin']."/nap_on.png' /></a>";}
        else {$nap = "<a href='nap_on.php?book_id=".$_GET['book_id']."'title='".$TEXT['book-nap']."'><img align='top' alt='".$TEXT['book-show2']."' src='../skins/".$result2['skin']."/nap_off.png' /></a>";}

       $result_iskh2['opisanie'] = rep_back($result_iskh2['opisanie']);
       $result_iskh2['oglavlenie'] = rep_back($result_iskh2['oglavlenie']);
       $result_iskh2['book_name'] = rep_back($result_iskh2['book_name']);
       $result_iskh2['isbn'] = rep_back($result_iskh2['isbn']);
?>
<form enctype="multipart/form-data" action="<?php echo $action; ?>" method="post">
<table align="center" width="98%" border="0">
<?php
if($result_iskh2['vidano'] == '3') {echo "<tr><td class='zagolovok_zak'>&nbsp;".$result_iskh2['book_name']."</td><td width='15%' align='right' title='".$result_bl_tit."'>".$result_bl."</td></tr>";}
  elseif($result_iskh2['vidano'] == '2') {echo "<tr><td class='zagolovok_sp'>&nbsp;".$result_iskh2['book_name']."</td><td width='15%' align='right' title='".$result_bl_tit."'>".$result_bl."</td></tr>";}
 else {echo "<tr><td class='zagolovok'>&nbsp;".$result_iskh2['book_name']."</td><td width='15%' align='right' title='".$result_bl_tit."'>".$result_bl."</td></tr>";}
?>
<tr><td>
</table>
<hr width="98%" />
<table align="center" width="98%" border="0">
<tr>
<td width="4%" valign="top">
   <table align="left" border="0" width="100%">
    <tr><td class="informcntr"><?php echo $result_image; ?></td></tr>
    <?php
      //if(!empty($result_iskh2['e_book'])) $e_book = "<tr><td class='informcntr'><a class='informcntr' href='".$result_iskh2['e_book']."' target=_blank title='".$result_iskh2['book_name']."'>".$TEXT['book-ebook']."</a></td></tr>";
      $fl = $result_iskh2['e_book'];
      if(!empty($result_iskh2['e_book']) && file_exists($fl)) {
          $e_book = "<tr><td class='informcntr'><a class='informcntr' href='get_book.php?book_id=".$result_iskh2['book_id']."' target=_blank title='".$result_iskh2['book_name']."'>".$TEXT['book-ebook']."</a></td></tr>";
          $result_bl_pic_l = "&nbsp;<img align='top' alt='E-book' src='../skins/".$result2['skin']."/clip.png' />";
      }
       else {
           $e_book = "";
           $result_bl_pic_l = "";
       }
      echo $e_book;
      
     $fla = $result_iskh2['a_book'];
     if(!empty($result_iskh2['a_book']) && file_exists($fla)) {
         $a_book = "<tr><td class='informcntr'><a class='informcntr' href='get_abook.php?book_id=".$result_iskh2['book_id']."' target=_blank title='".$result_iskh2['book_name']."'>".$TEXT['book-audio']."</a></td></tr>";
         $result_bl_pic_la = "&nbsp;<img align='top' alt='Audio' src='../skins/".$result2['skin']."/audio.png' />";
     }
      else {
          $a_book = "";
          $result_bl_pic_la = "";
      }
      echo $a_book;
    
     $flcd = $result_iskh2['cd_book'];
     if(!empty($result_iskh2['cd_book']) && file_exists($flcd)) {
         $cd_book = "<tr><td class='informcntr'><a class='informcntr' href='get_cdbook.php?book_id=".$result_iskh2['book_id']."' target=_blank title='".$result_iskh2['book_name']."'>".$TEXT['book-cdrom']."</a></td></tr>";
         $result_bl_pic_lcd = "&nbsp;<img align='top' alt='CD-ROM' src='../skins/".$result2['skin']."/cdrom.png' />";
     }
      else {
          $cd_book = "";
          $result_bl_pic_lcd = "";
      }
      echo $cd_book;
            
     if($result_iskh2['prev_books'] !== "0") {$prev_books = "<tr><td class='informcntr'><div id='formaupdate2'>&#9753;&nbsp;<a class='informcntr' href='extsearch.php?cicle_id=".$result_iskh2['prev_books']."&amp;cicle_ch=on' target=_blank title='".$TEXT['book-prereq2']."'>".$TEXT['book-prereq']."</a>&nbsp;&#10087;</div></td></tr>";}
      else {$prev_books = "";}
      echo $prev_books;
    ?>
    </table>
</td>
<td width="48%" valign="top">
<fieldset>
    <legend align="left" title="<?php echo $TEXT['book-fldset1-tit']; ?>"><?php echo $TEXT['book-fldset1']; ?></legend>
<table align="left" width="100%" border="0">
<tr><td class="inform" width="30%"><?php echo $TEXT['menu-btn23']; ?>:&nbsp;</td><td class="input"><?php echo $autors; ?></td></tr>
<tr><td class="inform"><?php echo $TEXT['menu-btn22']; ?>:&nbsp;</td><td class="input"><?php echo $izds; ?></td></tr>
<?php
if(!empty($result_iskh2['isbn'])) {echo "<tr><td class='inform'>".$TEXT['book-isbn'].":&nbsp;</td><td class='input'>".$result_iskh2['isbn']."</td></tr>";}
?>
<tr><td class="inform"><?php echo $TEXT['book-zhanr']; ?>:&nbsp;</td><td class="input"><?php echo rep_back($result_iskh2['zhanr']); ?></td></tr>
<?php
if(!empty($result_iskh2['cicle'])) {echo "<tr><td class='inform'>".$TEXT['book-cicle'].":&nbsp;</td><td class='input'>".rep_back($result_iskh2['cicle'])."</td></tr>";}
if(!empty($result_iskh2['book_num']) && $result_iskh2['book_num'] !== "0") {echo "<tr><td class='inform'>".$TEXT['book-num'].":&nbsp;</td><td class='input'>".$book_num."</td></tr>";}
if(!empty($result_iskh2['opisanie'])) {echo "<tr><td class='inform'>".$TEXT['book-opis'].":&nbsp;</td><td class='opis'>".nl2br($result_iskh2['opisanie'])."</td></tr>";}
if(!empty($result_iskh2['oglavlenie'])) {echo "<tr><td class='inform'>".$TEXT['book-oglavl'].":&nbsp;</td><td class='ogl'><hr class='hr50left'>".nl2br($result_iskh2['oglavlenie'])."</td></tr>";}
?>
</table>
</fieldset>
</td>
<td width="48%" valign="top">
<fieldset>
    <legend align="left" title="<?php echo $TEXT['book-fldset2-tit']; ?>"><?php echo $TEXT['book-fldset2']; ?></legend>
<table align="right" width="100%" border="0">
<tr><td class="inform"><?php echo $TEXT['book-data']; ?>:&nbsp;</td><td class="input"><?php echo  $data_r2; ?></td></tr>
<tr><td class="inform"><?php echo $TEXT['book-data2']; ?>:&nbsp;</td><td class="input"><?php echo $data_r; ?></td></tr>
<tr><td class="inform"><?php echo $TEXT['ser-title']; ?>:&nbsp;</td><td class="input"><?php echo rep_back($result_iskh2['seriya']); ?></td></tr>
<tr><td class="inform"><?php echo $TEXT['book-tip-izd']; ?>:&nbsp;</td><td class="input"><?php echo rep_back($result_iskh2['tip_izd']); ?></td></tr>
<tr><td class="inform"><?php echo $TEXT['book-bibl']; ?>:&nbsp;</td><td class="input"><?php echo rep_back($result_iskh2['biblioteka']); ?></td></tr>
<tr><td class="inform"><?php echo $TEXT['book-zal']; ?>:&nbsp;</td><td class="input"><?php echo rep_back($result_iskh2['zal']); ?></td></tr>
<tr><td class="inform"><?php echo $TEXT['book-shkaf']; ?>:&nbsp;</td><td class="input"><?php echo $result_iskh2['shkaf']; ?></td></tr>
<tr><td class="inform"><?php echo $TEXT['book-polka']; ?>:&nbsp;</td><td class="input"><?php echo $result_iskh2['polka']; ?></td></tr>
<tr><td class="inform"><?php echo $TEXT['book-place']; ?>:&nbsp;</td><td><?php echo $result_bl_pic_p.$result_bl_pic_la.$result_bl_pic_lcd.$result_bl_pic_l.$result_bl_pic_e; ?></td></tr>
</table>
</fieldset>
<fieldset>
    <legend align="left" title="<?php echo $TEXT['book-fldset3-tit']; ?>"><?php echo $TEXT['book-fldset3']; ?></legend>
<table align="right" width="100%" border="0">
<?php
if($result_iskh2['vidano'] == '2' || $result_iskh2['vidano'] == '3')
{
   $query_nal1 = "SELECT
tbl_book.user_id,
tbl_logins.login_id,
tbl_logins.familiya,
tbl_logins.name,
tbl_logins.otchestvo
FROM tbl_book
JOIN tbl_logins ON tbl_book.user_id=tbl_logins.login_id
WHERE book_id = '".$_GET['book_id']."' ";
  $result_nal = mysqli_query($dbcnx,$query_nal1);
  if (!$result_nal) {puterror($result2['skin'],$TEXT['error-tbl3']); require_once "../utils/bottom_adm.php"; exit();}
      $result_nal1 = mysqli_fetch_array($result_nal);
      $user_name_nal1 = rep_back($result_nal1['familiya'])." ".rep_back($result_nal1['name']);

   if($result_iskh2['vidano'] == '2')
   {
   $nal=  "<a href='nal_back.php?book_id=".$_GET['book_id']."' title='".$TEXT['book-nal']."'><img align='top' alt='".$TEXT['book-show3']."' src='../skins/".$result2['skin']."/back-book.png' /></a>&nbsp;<a href='index.php?book_name=".$result_iskh2['book_name']."' title='".$TEXT['delete-tit']."'><img align='top' alt='".$TEXT['delete-new']."' src='../skins/".$result2['skin']."/noobr.png' /></a>";
   echo "<tr><td class='inform'>".$TEXT['book-show3'].":&nbsp;</td><td class='input'>".$nal."</td></tr>";
   echo "<tr><td class='inform'>".$TEXT['book-who-viv'].":&nbsp;</td><td class='input'>".$user_name_nal1."</td></tr>";
   echo "<tr><td class='inform'>".$TEXT['book-data6'].":&nbsp;</td><td class='input'>".$data_r3."</td></tr>";
   echo "<tr><td class='inform'>".$TEXT['book-prichina'].":&nbsp;</td><td class='input'>".$result_iskh2['prichina']."</td></tr>";
   }
   else
    {
    $nal=  "<a href='nal_back.php?book_id=".$_GET['book_id']."' title='".$TEXT['book-zak']."'><img align='top' alt='".$TEXT['book-show5']."' src='../skins/".$result2['skin']."/zakupka.png' /></a>";
    echo "<tr><td class='inform'>".$TEXT['book-show5'].":&nbsp;</td><td class='input'>".$nal."</td></tr>";
    echo "<tr><td class='inform'>".$TEXT['book-who-zak'].":&nbsp;</td><td class='input'>".$user_name_nal1."</td></tr>";
    echo "<tr><td class='inform'>".$TEXT['book-data5'].":&nbsp;</td><td class='input'>".$data_r3."</td></tr>";
    }
}
else
{

if($result_iskh2['vidano'] == '0')
{
$nal=  "<a href='nal_off_frm.php?book_id=".$_GET['book_id']."&amp;user_id=".$result_iskh2['user_id_zak']."' title='".$TEXT['book-nal-off']."'><img align='top' alt='".$TEXT['book-show2']."' src='../skins/".$result2['skin']."/online.png' /></a>";
 echo "<tr><td class='inform'>".$TEXT['book-fldset3'].":&nbsp;</td><td class='input'>".$nal."</td></tr>";
}
   else
{
$query_nal1 = "SELECT
tbl_book.user_id,
tbl_logins.login_id,
tbl_logins.familiya,
tbl_logins.name,
tbl_logins.otchestvo
FROM tbl_book
JOIN tbl_logins ON tbl_book.user_id=tbl_logins.login_id
WHERE book_id = '".$_GET['book_id']."' ";
  $result_nal = mysqli_query($dbcnx,$query_nal1);
  if (!$result_nal) {puterror($result2['skin'],$TEXT['error-tbl3']); require_once "../utils/bottom_adm.php"; exit();}
      $result_nal1 = mysqli_fetch_array($result_nal);
      $user_name_nal1 = rep_back($result_nal1['familiya'])." ".rep_back($result_nal1['name'])." ".rep_back($result_nal1['otchestvo']);

$nal= "<a href='nal_on_frm.php?book_id=".$_GET['book_id']."'title='".$TEXT['book-nal']."'><img align='top' alt='".$TEXT['book-show2']."' src='../skins/".$result2['skin']."/rezervon.png' /></a>";
 echo "<tr><td class='inform'>".$TEXT['book-fldset3'].":&nbsp;</td><td class='input'>".$nal."</td></tr>";
 echo "<tr><td class='inform'>".$TEXT['book-data3'].":&nbsp;</td><td class='input'>".$data_r3."</td></tr>";
 echo "<tr><td class='inform'>".$TEXT['book-data4'].":&nbsp;</td><td class='input'>".$data_r4."</td></tr>";
 echo "<tr><td class='inform'>".$TEXT['book-who-vid'].":&nbsp;</td><td class='input'>".$user_name_nal1."</td></tr>";
 echo "<tr><td class='inform'>".$TEXT['book-napom'].":&nbsp;</td><td class='input'>".$nap."</td></tr>";
}

if($result_iskh2['zakazano'] == '1')
{
$query_rez1 = "SELECT
tbl_book.user_id_zak,
tbl_logins.login_id,
tbl_logins.familiya,
tbl_logins.name,
tbl_logins.otchestvo
FROM tbl_book
JOIN tbl_logins ON tbl_book.user_id_zak=tbl_logins.login_id
WHERE book_id = '".$_GET['book_id']."' ";
  $result_rez = mysqli_query($dbcnx,$query_rez1);
  if (!$result_rez) {puterror($result2['skin'],$TEXT['error-tbl3']); require_once "../utils/bottom_adm.php"; exit();}
      $result_rez1 = mysqli_fetch_array($result_rez);
      $user_name_rez1 = rep_back($result_rez1['familiya'])." ".rep_back($result_rez1['name'])." ".rep_back($result_rez1['otchestvo']);

$rez=  "<a href='rez_off.php?book_id=".$_GET['book_id']."' title='".$TEXT['book-rez-off']."'><img align='top' alt='".$TEXT['book-show2']."' src='../skins/".$result2['skin']."/rezervon.png' /></a>";

echo "<tr><td class='inform' width='44%'>".$TEXT['book-rez'].":&nbsp;</td><td class='input'>".$rez."</td></tr>";
echo "<tr><td class='inform'>".$TEXT['book-who-rez'].":&nbsp;</td><td class='input'>".$user_name_rez1."</td></tr>";
echo "<tr><td class='inform'>".$TEXT['book-data5'].":&nbsp;</td><td class='input'>".$data_r5."</td></tr>";
}
 else
{
 if($result_iskh2['vidano'] == '0') {$rez= "<a href='rez_on_frm.php?book_id=".$_GET['book_id']."'title='".$TEXT['book-rez-on']."'><img align='top' alt='".$TEXT['book-show2']."' src='../skins/".$result2['skin']."/online.png' /></a>";}
   else {$rez=  "<img align='top' alt='".$TEXT['book-show2']."' src='../skins/".$result2['skin']."/offline.png' />";}

 echo "<tr><td class='inform' width='44%'>".$TEXT['book-rez'].":&nbsp;</td><td class='input'>".$rez."</td></tr>";
}
}
?>
</table>
</fieldset>
</td></tr>
<tr><td colspan="3">
<input class="button" type="submit" value="<?php echo $button; ?>" />
<input type="hidden" name="book_id" value="<?php echo $_GET['book_id']; ?>" />
<?php
if(!empty($_GET['familiya'])) {echo "<input type='hidden' name='familiya' value='".$_GET['familiya']."' />";}
?>
</td></tr>
</table>
</form>
<?php
  require_once "../utils/bottom_adm.php";
?>