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

$title = $TEXT['aut-title-info'];

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

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

if(empty($_GET['login_id'])) {puterror($result2['skin'],$TEXT['error-login15']); require_once "../utils/bottom_adm.php"; exit();}
if(strlen($_GET['login_id'])>15) {puterror($result2['skin'],$TEXT['error-login14']); require_once "../utils/bottom_adm.php"; exit();}
$_GET['login_id'] = rep($_GET['login_id']);
if(strlen($_GET['k'])>8) {puterror($result2['skin'],$TEXT['error-paging1']); require_once "../utils/bottom_adm.php"; exit();}
$_GET['k'] = rep($_GET['k']);
if(empty($_GET['k'])) {$_GET['k']=0;}
$stop_r = $_GET['k'];
if($stop_r == 0) {$lim_ogr = "5";}
else {$lim_ogr = $stop_r.",5";}

$ktblvis = $stop_r+5;
$str = $ktblvis/5;

$query_body = "SELECT 
 tbl_logins.*,
 tbl_domain.domain
 FROM tbl_logins
 LEFT JOIN tbl_domain ON tbl_logins.dom_id=tbl_domain.dom_id 
 WHERE tbl_logins.login_id=".$_GET['login_id']."";
 $result_body = mysqli_query($dbcnx,$query_body);
  if(!$result_body) {puterror($result2['skin'],$TEXT['error-tbl7']); require_once "../utils/bottom_adm.php"; exit();}
   if(mysqli_num_rows($result_body)>0)
   {
      $result_iskh2 = mysqli_fetch_array($result_body);
      $usr_name = $result_iskh2['familiya']." ".$result_iskh2['name']." ".$result_iskh2['otchestvo']."";
      $usr_name2 = $result_iskh2['familiya']." ".$result_iskh2['name'];

      if(!empty($result_iskh2['e_mail'])) {$address_aut = "<a href='mailto:".$result_iskh2['e_mail']."@".$result_iskh2['domain']."'>".$result_iskh2['e_mail']."@".$result_iskh2['domain']."</a>";}
       else {$address_aut = "";}

      if(!empty($result_iskh2['photo_user']) && $result_iskh2['photo_user']!="-") {$result_image = "<img alt='picture' src='".$result_iskh2['photo_user']."' />";}
       else {$result_image =  "<img alt='picture' align='center' with='130px' heigh='185px' src='../skins/".$result2['skin']."/nophoto.png' />";}

$query_cnt_logs = mysqli_query($dbcnx,"SELECT COUNT(log_id) AS c_log_id FROM tbl_logs WHERE `who`='".$usr_name2."'");
$cn_log_rws = mysqli_fetch_array($query_cnt_logs);
if($cn_log_rws['c_log_id'] > 0) {$usr_logs = "<a href='../logs/index.php?who=".$usr_name2."&amp;rows=".$cn_log_rws['c_log_id']."' target='_blank' title='".$TEXT['log-tit3'].$cn_log_rws['c_log_id']."'>".$TEXT['aut-viewtit']."</a>";}
 else {$usr_logs = "---";}
?>
<table align="center" width="100%">
<tr><td width="35%" align="left" valign="top">
<fieldset>
 <legend align="left"><?php echo $TEXT['login-login']; ?>:&nbsp<span class="informssilka"><?php echo $result_iskh2['login']; ?></span></legend>
<table align="left" border=0 width=95%>
    <tr><td valign="top"><?php echo $result_image; ?></td>
    <td>
<table align="left">
<?php 
if(!empty($result_iskh2['familiya'])) {echo "<tr><td class='inform'>".$TEXT['login-familiya'].":&nbsp;</td><td class='input'>".$result_iskh2['familiya']."</td></tr>";}
if(!empty($result_iskh2['name'])) {echo "<tr><td class='inform'>".$TEXT['login-name'].":&nbsp;</td><td class='input'>".$result_iskh2['name']."</td></tr>";}
if(!empty($result_iskh2['otchestvo'])) {echo "<tr><td class='inform'>".$TEXT['login-otchestvo'].":&nbsp;</td><td class='input'>".$result_iskh2['otchestvo']."</td></tr>";}
if(!empty($result_iskh2['address_user'])) {echo "<tr><td class='inform'>".$TEXT['user-adrr'].":&nbsp;</td><td class='input'>".$result_iskh2['address_user']."</td></tr>";}
if(!empty($result_iskh2['phone'])) {echo "<tr><td class='inform'>".$TEXT['user-tel-mob'].":&nbsp;</td><td class='input'>".$result_iskh2['phone']."</td></tr>";}
if(!empty($result_iskh2['icq'])) {echo "<tr><td class='inform'>".$TEXT['user-icq'].":&nbsp;</td><td class='input'>".$result_iskh2['icq']."</td></tr>";}
if($address_aut !== "") {echo "<tr><td class='inform'>".$TEXT['user-e-mail'].":&nbsp;</td><td class='input'>".$address_aut."</td></tr>";}
if($usr_logs !== "---") {echo "<tr><td class='inform'>".$TEXT['menu-btn27'].":&nbsp;</td><td class='input'>".$usr_logs."</td></tr>";}
?>
</table>
</td>
</tr>
</table>
</fieldset>
</td>
<td width="65%" align="right" valign="top">
<fieldset>
<?php
if($_GET['st'] == 1)
{
echo "<legend align='left'>".$TEXT['book-onhand']."</legend>";
echo "<table align='left' border='0' width='100%'>";

$query_iskh = "SELECT
 tbl_book.data_sdachi,
 tbl_book.book_name,
 tbl_book.book_id,
 tbl_book.vidano,
 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,
 tbl_book.cicle_id AS cicl_book,
 tbl_cicle.cicle
 FROM tbl_book
 LEFT JOIN tbl_cicle ON tbl_book.cicle_id=tbl_cicle.cicle_id
 WHERE tbl_book.vidano = '1' AND tbl_book.user_id = ".$_GET['login_id']."
 ORDER BY tbl_book.data_sdachi, tbl_book.book_name LIMIT ".$lim_ogr."";
 $result_iskh = mysqli_query($dbcnx,$query_iskh);
  if(!$result_iskh) {puterror2($result2['skin'],$TEXT['error-tbl3']); require_once "utils/bottom.php"; exit();}
  if(mysqli_num_rows($result_iskh) > 0)
  {
   while($result_iskh2 = mysqli_fetch_array($result_iskh))
    {
    if($result_iskh2['cicle'] !== '---') {$book_cicle = "<br />&nbsp;&nbsp;&nbsp;&nbsp;<a href='../extsearch.php?cicle_id=".$result_iskh2['cicl_book']."&cicle_ch=on' target='_blank' title='".$TEXT['search-all-cicl']."'>(".$TEXT['book-cicle']." - ".rep_back($result_iskh2['cicle']).")</a>";}
     else {$book_cicle = "";}
    $autor = "";
     $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 = '".$result_iskh2['book_id']."' ";
    $result_autor = mysqli_query($dbcnx,$query_autor);
     if(!$result_autor) {puterror2($result2['skin'],$TEXT['error-tbl16']); require_once "utils/bottom.php"; exit();}
      while($result_autor2 = mysqli_fetch_array($result_autor))
       {
        $autor .="<a href='../extsearch.php?autor_id=".$result_autor2['autor_id']."&amp;autor_ch=on' target='_blank' title='".$TEXT['search-all-aut']."'>".$result_autor2['name']." ".$result_autor2['otchestvo']." ".$result_autor2['familiya']."</a>, ";
       }
       $autors =substr($autor, 0,-2);
       $query_zad = mysqli_query($dbcnx,"SELECT DATEDIFF(CURRENT_DATE(),data_sdachi) AS zad_date FROM tbl_book WHERE book_id = ".$result_iskh2['book_id']."");
        $res_zad = mysqli_fetch_array($query_zad);

       $date_day = $result_iskh2['data_vidachi_day'];
       $date_month = $result_iskh2['data_vidachi_month'];
       $date_year = $result_iskh2['data_vidachi_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_sdachi_day'];
       $date_month2 = $result_iskh2['data_sdachi_month'];
       $date_year2 = $result_iskh2['data_sdachi_year'];
       if($date_year2 == "0000" || $date_year2 == "1970") {$data_r2 = "---";}
        else {$data_r2 = $date_day2." ".$month[$date_month2]." ".$date_year2." ".$TEXT['year2'];}

        if($res_zad['zad_date'] < 1)
         {
          $book_sost = "<img alt='ok' src='../skins/".$result2['skin']."/active.png' />";
          echo "<tr><td class='informlft'>".$book_sost."&nbsp;<a href='../info.php?book_id=".$result_iskh2['book_id']."' target='_blank' title='".$TEXT['aut-viewtit']."'>".rep_back($result_iskh2['book_name'])."</a>  <span class='informlftdat'> &#040;".$data_r." - ".$data_r2."&#041;</span>&nbsp;<br />&nbsp;&nbsp;<span class='opis'>".$autors.$book_cicle."</span><hr align='left' width='55%' /></td></tr>";
         }
         else
          {
           $book_sost = "<img alt='warning' src='../skins/".$result2['skin']."/warn.png' />";
           echo "<tr><td class='informlft'>".$book_sost."&nbsp;<a href='../info.php?book_id=".$result_iskh2['book_id']."' target='_blank' title='".$TEXT['aut-viewtit']."'>".rep_back($result_iskh2['book_name'])."</a>  <span class='informlftdat'> &#040;".$data_r." - ".$data_r2." &#124; ".$TEXT['book-zad']." - ".$res_zad['zad_date']." ".$TEXT['book-zad-days']."&#041;</span>&nbsp;<br />&nbsp;&nbsp;<span class='opis'>".$autors.$book_cicle."</span><hr align='left' width='55%' /></td></tr>";
          }
      }
  } else {echo "<tr><td class='informcntr'>".$TEXT['book-myhand-clr2']."</td></tr>";}
}
elseif($_GET['st'] == 2)
{
echo "<legend align='left'>".$TEXT['book-onrez']."</legend>";
echo "<table align='left' border='0' width='100%'>";

$query_iskh = "SELECT
     tbl_book.data_zakaza,
     tbl_book.book_name,
     tbl_book.book_id,
     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_book.user_id_zak,
     tbl_book.zakazano,
     tbl_biblioteka.name AS bibl_name,
     tbl_book.cicle_id AS cicl_book,
     tbl_cicle.cicle
     FROM tbl_book
     JOIN tbl_biblioteka ON tbl_book.bibl_id=tbl_biblioteka.bibl_id
     LEFT JOIN tbl_cicle ON tbl_book.cicle_id=tbl_cicle.cicle_id
     WHERE tbl_book.zakazano = '1' AND tbl_book.user_id_zak = ".$_GET['login_id']."
     ORDER BY tbl_book.data_zakaza DESC, tbl_book.book_name ASC LIMIT ".$lim_ogr."";
 $result_iskh = mysqli_query($dbcnx,$query_iskh);
  if(!$result_iskh) {puterror2($result2['skin'],$TEXT['error-tbl3']); require_once "utils/bottom.php"; exit();}
  if(mysqli_num_rows($result_iskh) > 0)
  {
   while($result_iskh2 = mysqli_fetch_array($result_iskh))
    {
    if($result_iskh2['cicle'] !== '---') {$book_cicle = "<br />&nbsp;&nbsp;&nbsp;&nbsp;<a href='../extsearch.php?cicle_id=".$result_iskh2['cicl_book']."&cicle_ch=on' target='_blank' title='".$TEXT['search-all-cicl']."'>(".$TEXT['book-cicle']." - ".rep_back($result_iskh2['cicle']).")</a>";}
     else {$book_cicle = "";}
    $autor = "";
     $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 = '".$result_iskh2['book_id']."' ";
    $result_autor = mysqli_query($dbcnx,$query_autor);
     if(!$result_autor) {puterror2($result2['skin'],$TEXT['error-tbl16']); require_once "utils/bottom.php"; exit();}
      while($result_autor2 = mysqli_fetch_array($result_autor))
       {
        $autor .="<a href='../extsearch.php?autor_id=".$result_autor2['autor_id']."&amp;autor_ch=on' target='_blank' title='".$TEXT['search-all-aut']."'>".$result_autor2['name']." ".$result_autor2['otchestvo']." ".$result_autor2['familiya']."</a>, ";
       }
       $autors =substr($autor, 0,-2);
       $date_day = $result_iskh2['data_zakaza_day'];
       $date_month = $result_iskh2['data_zakaza_month'];
       $date_year = $result_iskh2['data_zakaza_year'];
       if($date_year == "0000" || $date_year == "1970") {$data_r = "---";}
        else {$data_r = $date_day." ".$month[$date_month]." ".$date_year." ".$TEXT['year2'];}

        $book_sost = "<img alt='ok' src='../skins/".$result2['skin']."/active.png' />";
        echo "<tr><td class='informlft'>".$book_sost."&nbsp;<a href='../info.php?book_id=".$result_iskh2['book_id']."' target='_blank' title='".$TEXT['aut-viewtit']."'>".rep_back($result_iskh2['book_name'])."</a>  <span class='informlftdat'> &#040;".$data_r."&#041;</span>&nbsp;<br />&nbsp;&nbsp;<span class='opis'>".$autors.$book_cicle."</span><hr align='left' width='55%' /></td></tr>";
      }
  } else {echo "<tr><td class='informcntr'>".$TEXT['book-myhand-clr2']."</td></tr>";}
}
elseif($_GET['st'] == 3)
{
echo "<legend align='left'>".$TEXT['book-give']."</legend>";
echo "<table align='left' border='0' width='100%'>";

$query_iskh = "SELECT
     tbl_statistik.*,
     tbl_statistik.book_id AS stat_book_id,
     YEAR(tbl_statistik.r_data_sdachi) AS data_sdachi_year,
     MONTH(tbl_statistik.r_data_sdachi) AS data_sdachi_month,
     DAY(tbl_statistik.r_data_sdachi) AS data_sdachi_day,
     tbl_book.data_zakaza,
     tbl_book.book_name,
     tbl_book.book_id,
     tbl_book.cicle_id AS cicl_book,
     tbl_cicle.cicle,
     tbl_obraschenie.*
     FROM tbl_statistik
     JOIN tbl_book ON tbl_statistik.book_id=tbl_book.book_id
     JOIN tbl_obraschenie ON tbl_statistik.obr_id=tbl_obraschenie.obr_id
     LEFT JOIN tbl_cicle ON tbl_book.cicle_id=tbl_cicle.cicle_id
     WHERE tbl_statistik.user_id = ".$_GET['login_id']."
     ORDER BY tbl_statistik.data_vidachi DESC, tbl_book.book_name ASC LIMIT ".$lim_ogr."";
 $result_iskh = mysqli_query($dbcnx,$query_iskh);
  if(!$result_iskh) {puterror2($result2['skin'],$TEXT['error-tbl3']); require_once "utils/bottom.php"; exit();}
  if(mysqli_num_rows($result_iskh) > 0)
  {
   while($result_iskh2 = mysqli_fetch_array($result_iskh))
    {
    if($result_iskh2['cicle'] !== '---') {$book_cicle = "<br />&nbsp;&nbsp;&nbsp;&nbsp;<a href='../extsearch.php?cicle_id=".$result_iskh2['cicl_book']."&cicle_ch=on' target='_blank' title='".$TEXT['search-all-cicl']."'>(".$TEXT['book-cicle']." - ".rep_back($result_iskh2['cicle']).")</a>";}
     else {$book_cicle = "";}

    if($result_iskh2['kachestvo'] !== '---') {$book_kach_obr = " &#124; ".$TEXT['tbl-obr']." - ".$result_iskh2['kachestvo']." ";}
     else {$book_kach_obr = "";}

     $autor = "";
     $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 = '".$result_iskh2['book_id']."' ";
    $result_autor = mysqli_query($dbcnx,$query_autor);
     if(!$result_autor) {puterror2($result2['skin'],$TEXT['error-tbl16']); require_once "utils/bottom.php"; exit();}
      while($result_autor2 = mysqli_fetch_array($result_autor))
       {
        $autor .="<a href='../extsearch.php?autor_id=".$result_autor2['autor_id']."&amp;autor_ch=on' target='_blank' title='".$TEXT['search-all-aut']."'>".$result_autor2['name']." ".$result_autor2['otchestvo']." ".$result_autor2['familiya']."</a>, ";
       }
       $autors =substr($autor, 0,-2);
       $date_day = $result_iskh2['data_sdachi_day'];
       $date_month = $result_iskh2['data_sdachi_month'];
       $date_year = $result_iskh2['data_sdachi_year'];
       if($date_year == "0000" || $date_year == "1970") {$data_r = "---";}
        else {$data_r = $date_day." ".$month[$date_month]." ".$date_year." ".$TEXT['year2'];}

        if($result_iskh2['zad_days'] == 0)
        {
         $zad = "";
         $book_sost = "<img alt='ok' src='../skins/".$result2['skin']."/active.png' />";
        }
         else
         {
          $zad =  " &#124; ".$TEXT['book-zad']." - ".$result_iskh2['zad_days']." ".$TEXT['book-zad-days'];
          $book_sost = "<img alt='ok' src='../skins/".$result2['skin']."/warn.png' />";
         }

          echo "<tr><td class='informlft'>".$book_sost."&nbsp;<a href='../info.php?book_id=".$result_iskh2['book_id']."' target='_blank' title='".$TEXT['aut-viewtit']."'>".rep_back($result_iskh2['book_name'])."</a>  <span class='informlftdat'> &#040;".$data_r." ".$zad."".$book_kach_obr."&#041;</span>&nbsp;<br />&nbsp;&nbsp;<span class='opis'>".$autors.$book_cicle."</span><hr align='left' width='55%' /></td></tr>";
      }
  } else {echo "<tr><td class='informcntr'>".$TEXT['book-myhand-clr2']."</td></tr>";}
}
elseif($_GET['st'] == 4)
{
echo "<legend align='left'>".$TEXT['book-otziv4']."</legend>";
echo "<table align='left' border='0' width='100%'>";

$query_iskh = "SELECT
     tbl_otziv.*,
     tbl_otziv.book_id AS stat_book_id,
     YEAR(tbl_otziv.otz_data) AS otz_data_year,
     MONTH(tbl_otziv.otz_data) AS otz_data_month,
     DAY(tbl_otziv.otz_data) AS otz_data_day,
     tbl_book.book_name,
     tbl_book.book_id,
     tbl_book.cicle_id AS cicl_book,
     tbl_cicle.cicle
     FROM tbl_otziv
     JOIN tbl_book ON tbl_otziv.book_id=tbl_book.book_id
     LEFT JOIN tbl_cicle ON tbl_book.cicle_id=tbl_cicle.cicle_id
     WHERE tbl_otziv.login_id = ".$_GET['login_id']." AND tbl_otziv.use_prog = 1
     ORDER BY tbl_otziv.otz_data DESC, tbl_book.book_name ASC LIMIT ".$lim_ogr."";
 $result_iskh = mysqli_query($dbcnx,$query_iskh);
  if(!$result_iskh) {puterror2($result2['skin'],$TEXT['error-tbl3']); require_once "utils/bottom.php"; exit();}
  if(mysqli_num_rows($result_iskh) > 0)
  {
   while($result_iskh2 = mysqli_fetch_array($result_iskh))
    {
    if($result_iskh2['cicle'] !== '---') {$book_cicle = "<br />&nbsp;&nbsp;&nbsp;&nbsp;<a href='../extsearch.php?cicle_id=".$result_iskh2['cicl_book']."&cicle_ch=on' target='_blank' title='".$TEXT['search-all-cicl']."'>(".$TEXT['book-cicle']." - ".rep_back($result_iskh2['cicle']).")</a>";}
     else {$book_cicle = "";}
    $autor = "";
     $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 = '".$result_iskh2['book_id']."' ";
    $result_autor = mysqli_query($dbcnx,$query_autor);
     if(!$result_autor) {puterror2($result2['skin'],$TEXT['error-tbl16']); require_once "utils/bottom.php"; exit();}
      while($result_autor2 = mysqli_fetch_array($result_autor))
       {
        $autor .="<a href='../extsearch.php?autor_id=".$result_autor2['autor_id']."&amp;autor_ch=on' target='_blank' title='".$TEXT['search-all-aut']."'>".$result_autor2['name']." ".$result_autor2['otchestvo']." ".$result_autor2['familiya']."</a>, ";
       }
       $autors =substr($autor, 0,-2);
       $date_day = $result_iskh2['otz_data_day'];
       $date_month = $result_iskh2['otz_data_month'];
       $date_year = $result_iskh2['otz_data_year'];
       if($date_year == "0000" || $date_year == "1970") {$data_r = "---";}
        else {$data_r = $date_day." ".$month[$date_month]." ".$date_year." ".$TEXT['year2'];}

       $result_iskh2['otziv'] = rep_back($result_iskh2['otziv']);
       if($result_iskh2['otziv'] !== "") {$otziv = "<br />&nbsp;<span class='opis'>".nl2br($result_iskh2['otziv'])."</span>";}
        else {$otziv = "";}

       if($result_iskh2['usr_rating'] == "1") {$otz_rating = $TEXT['book-ocenka1'];}
       if($result_iskh2['usr_rating'] == "2") {$otz_rating = $TEXT['book-ocenka2'];}
       if($result_iskh2['usr_rating'] == "3") {$otz_rating = $TEXT['book-ocenka3'];}
       if($result_iskh2['usr_rating'] == "4") {$otz_rating = $TEXT['book-ocenka4'];}
       if($result_iskh2['usr_rating'] == "5") {$otz_rating = $TEXT['book-ocenka5'];}

       echo "<tr><td class='informlft'>".$book_sost."&nbsp;<a href='../info.php?book_id=".$result_iskh2['book_id']."' target='_blank' title='".$TEXT['aut-viewtit']."'>".rep_back($result_iskh2['book_name'])."</a>  <span class='informlftdat'> &#040;".$data_r." &#124; ".$otz_rating." &#041;</span>&nbsp;<br />&nbsp;&nbsp;<span class='opis'>".$autors.$book_cicle."</span>".$otziv."<hr align='left' width='55%' /></td></tr>";
      }
  } else {echo "<tr><td class='informcntr'>".$TEXT['book-myhand-clr2']."</td></tr>";}
}
?>
</table>
<?php
if($_GET['st'] == 1)
{
$query_count = mysqli_query($dbcnx,"SELECT COUNT(book_id) AS c_book_id FROM tbl_book WHERE vidano = '1' AND user_id = ".$_GET['login_id']."");
	       $coun_rows = mysqli_fetch_array($query_count);
               $pag = $coun_rows['c_book_id']/5;
               if($pag<=1) {$pag = ceil($pag);}
                else
                {
                 ?>
                  <table align="center" border="0" cellpadding="0" cellspacing="0" width="90%" >
                   <tr align="center">
                    <td><hr size="3" width="98%" />
                <?php
                $pag=ceil($pag);
                $strn = $str-5;
                if($strn<1) {$strn=1;}
                $strk = $str+5;
                for($i=$strn; $i<=$pag; $i++)
                 {
                  if($i<=$strk)
                  {
                    if($i==$str)
                    {
                      $k = $i*5-5;
                      $kvis=$k+5;
                      $nvis=$k;
                      echo $pg = " <a class='zagolovok' href='info.php?k=".$k."&amp;st=1&amp;login_id=".$_GET['login_id']."' title='".$TEXT['tbl-details4'].$nvis.$TEXT['tbl-details3'].$kvis."'>".$i."</a>";
                    }
                    else
                    {
                    $k = $i*5-5;
                    $kvis=$k+5;
                    $nvis=$k;
                    echo $pg = " <a href='info.php?k=".$k."&amp;st=1&amp;login_id=".$_GET['login_id']."' title='".$TEXT['tbl-details4'].$nvis.$TEXT['tbl-details3'].$kvis."'>[".$i."]</a>";
                    }
                  }
                 }
                 ?>
                    <select name='k' onchange=window.location.href=this.options[this.selectedIndex].value;>
                    <?php
                    for($j=1; $j<=$pag; $j++)
                    {
                     $k = $j*5-5;
                     if($k == $_GET['k']) {echo "<option selected value=info.php?k=".$k."&amp;st=1&amp;login_id=".$_GET['login_id'].">".$j."</option>";}
                       else {echo "<option value=info.php?k=".$k."&amp;st=1&amp;login_id=".$_GET['login_id'].">".$j."</option>";}
                    }
                    ?>
                    </select>
                    </td>
                   </tr>
                  </table>
                 <?php
                }

}
if($_GET['st'] == 2)
{
$query_count = mysqli_query($dbcnx,"SELECT COUNT(book_id) AS c_book_id FROM tbl_book WHERE zakazano = '1' AND user_id_zak = ".$_GET['login_id']."");
	       $coun_rows = mysqli_fetch_array($query_count);
               $pag = $coun_rows['c_book_id']/5;
               if($pag<=1) {$pag = ceil($pag);}
                else
                {
                 ?>
                  <table align="center" border="0" cellpadding="0" cellspacing="0" width="90%" >
                   <tr align="center">
                    <td><hr size="3" width="98%" />
                <?php
                $pag=ceil($pag);
                $strn = $str-5;
                if($strn<1) {$strn=1;}
                $strk = $str+5;
                for($i=$strn; $i<=$pag; $i++)
                 {
                  if($i<=$strk)
                  {
                    if($i==$str)
                    {
                      $k = $i*5-5;
                      $kvis=$k+5;
                      $nvis=$k;
                      echo $pg = " <a class='zagolovok' href='info.php?k=".$k."&amp;st=2&amp;login_id=".$_GET['login_id']."' title='".$TEXT['tbl-details4'].$nvis.$TEXT['tbl-details3'].$kvis."'>".$i."</a>";
                    }
                    else
                    {
                    $k = $i*5-5;
                    $kvis=$k+5;
                    $nvis=$k;
                    echo $pg = " <a href='info.php?k=".$k."&amp;st=2&amp;login_id=".$_GET['login_id']."' title='".$TEXT['tbl-details4'].$nvis.$TEXT['tbl-details3'].$kvis."'>[".$i."]</a>";
                    }
                  }
                 }
                 ?>
                    <select name='k' onchange=window.location.href=this.options[this.selectedIndex].value;>
                    <?php
                    for($j=1; $j<=$pag; $j++)
                    {
                     $k = $j*5-5;
                     if($k == $_GET['k']) {echo "<option selected value=info.php?k=".$k."&amp;st=2&amp;login_id=".$_GET['login_id'].">".$j."</option>";}
                       else {echo "<option value=info.php?k=".$k."&amp;st=2&amp;login_id=".$_GET['login_id'].">".$j."</option>";}
                    }
                    ?>
                    </select>
                    </td>
                   </tr>
                  </table>
                 <?php
                }
}
if($_GET['st'] == 3)
{
$query_count = mysqli_query($dbcnx,"SELECT COUNT(stat_id) AS c_stat_id FROM tbl_statistik WHERE user_id = ".$_GET['login_id']."");
	       $coun_rows = mysqli_fetch_array($query_count);
               $pag = $coun_rows['c_stat_id']/5;
               if($pag<=1) {$pag = ceil($pag);}
                else
                {
                 ?>
                  <table align="center" border="0" cellpadding="0" cellspacing="0" width="90%" >
                   <tr align="center">
                    <td><hr size="3" width="98%" />
                <?php
                $pag=ceil($pag);
                $strn = $str-5;
                if($strn<1) {$strn=1;}
                $strk = $str+5;
                for($i=$strn; $i<=$pag; $i++)
                 {
                  if($i<=$strk)
                  {
                    if($i==$str)
                    {
                      $k = $i*5-5;
                      $kvis=$k+5;
                      $nvis=$k;
                      echo $pg = " <a class='zagolovok' href='info.php?k=".$k."&amp;st=3&amp;login_id=".$_GET['login_id']."' title='".$TEXT['tbl-details4'].$nvis.$TEXT['tbl-details3'].$kvis."'>".$i."</a>";
                    }
                    else
                    {
                    $k = $i*5-5;
                    $kvis=$k+5;
                    $nvis=$k;
                    echo $pg = " <a href='info.php?k=".$k."&amp;st=3&amp;login_id=".$_GET['login_id']."' title='".$TEXT['tbl-details4'].$nvis.$TEXT['tbl-details3'].$kvis."'>[".$i."]</a>";
                    }
                  }
                 }
                 ?>
                    <select name='k' onchange=window.location.href=this.options[this.selectedIndex].value;>
                    <?php
                    for($j=1; $j<=$pag; $j++)
                    {
                     $k = $j*5-5;
                     if($k == $_GET['k']) {echo "<option selected value=info.php?k=".$k."&amp;st=3&amp;login_id=".$_GET['login_id'].">".$j."</option>";}
                       else {echo "<option value=info.php?k=".$k."&amp;st=3&amp;login_id=".$_GET['login_id'].">".$j."</option>";}
                    }
                    ?>
                    </select>
                    </td>
                   </tr>
                  </table>
                 <?php
                }
}
if($_GET['st'] == 4)
{
$query_count = mysqli_query($dbcnx,"SELECT COUNT(otz_id) AS c_otz_id FROM tbl_otziv WHERE login_id = ".$_GET['login_id']." AND use_prog = 1");
	       $coun_rows = mysqli_fetch_array($query_count);
               $pag = $coun_rows['c_otz_id']/5;
               if($pag<=1) {$pag = ceil($pag);}
                else
                {
                 ?>
                  <table align="center" border="0" cellpadding="0" cellspacing="0" width="90%" >
                   <tr align="center">
                    <td><hr size="3" width="98%" />
                <?php
                $pag=ceil($pag);
                $strn = $str-5;
                if($strn<1) {$strn=1;}
                $strk = $str+5;
                for($i=$strn; $i<=$pag; $i++)
                 {
                  if($i<=$strk)
                  {
                    if($i==$str)
                    {
                      $k = $i*5-5;
                      $kvis=$k+5;
                      $nvis=$k;
                      echo $pg = " <a class='zagolovok' href='info.php?k=".$k."&amp;st=4&amp;login_id=".$_GET['login_id']."' title='".$TEXT['tbl-details4'].$nvis.$TEXT['tbl-details3'].$kvis."'>".$i."</a>";
                    }
                    else
                    {
                    $k = $i*5-5;
                    $kvis=$k+5;
                    $nvis=$k;
                    echo $pg = " <a href='info.php?k=".$k."&amp;st=4&amp;login_id=".$_GET['login_id']."' title='".$TEXT['tbl-details4'].$nvis.$TEXT['tbl-details3'].$kvis."'>[".$i."]</a>";
                    }
                  }
                 }
                 ?>
                    <select name='k' onchange=window.location.href=this.options[this.selectedIndex].value;>
                    <?php
                    for($j=1; $j<=$pag; $j++)
                    {
                     $k = $j*5-5;
                     if($k == $_GET['k']) {echo "<option selected value=info.php?k=".$k."&amp;st=4&amp;login_id=".$_GET['login_id'].">".$j."</option>";}
                       else {echo "<option value=info.php?k=".$k."&amp;st=4&amp;login_id=".$_GET['login_id'].">".$j."</option>";}
                    }
                    ?>
                    </select>
                    </td>
                   </tr>
                  </table>
                 <?php
                }
}
?>
</form>
</fieldset>
</td>
</tr>
</table>
<?php
   }
  require_once "../utils/bottom_adm.php";
?>