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

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

  $title = $TEXT['aut-title-info'];
  $button = $TEXT['btn_back'];
  $action = "add_autor.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['autor_id'])) {puterror($result2['skin'],$TEXT['error-aut15']); require_once "../utils/bottom_adm.php"; exit();}
  if(strlen($_GET['autor_id'])>15) {puterror($result2['skin'],$TEXT['error-aut14']); require_once "../utils/bottom_adm.php"; exit();}
  if(strlen($_GET['familiya'])>255) {puterror($result2['skin'],$TEXT['error-aut4']); 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']);
  $_GET['autor_id'] = rep ($_GET['autor_id']);
  $_GET['familiya'] = rep ($_GET['familiya']);

$query_iskh = "SELECT data_rozdeniya, name, familiya, otchestvo, mesto_rozdeniya, real_name, photo_autor, site_protocol, site_name FROM `tbl_autor` WHERE `autor_id`='".$_GET['autor_id']."' ";
  $result_iskh = mysqli_query($dbcnx,$query_iskh);
  if(!$result_iskh) {puterror($result2['skin'],$TEXT['error-tbl1']); require_once "../utils/bottom_adm.php"; exit();}
    $result_iskh2 = mysqli_fetch_array($result_iskh);
      $year = $TEXT['year'];
      if($result_iskh2['data_rozdeniya'] == "0" || $result_iskh2['data_rozdeniya'] == "0000" || $result_iskh2['data_rozdeniya'] == "1970") {$data_r = "";}
       else {$data_r = $result_iskh2['data_rozdeniya']." ".$TEXT['year'];}

      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_autor']) && file_exists($result_iskh2['photo_autor'])) {$result_image = "<img alt='Фото автора' src=".$result_iskh2['photo_autor']." />";}
       else {$result_image =  "<img alt='Фото отсутствует' src='../skins/".$result2['skin']."/nophoto.png' />";}
?>
<table align="center" width=80%>
<tr><td>
<form enctype='multipart/form-data' action=<?php echo $action; ?> method=post>
<table align="center" border=0 width=95%>
    <tr><td valign="top"><?php echo $result_image; ?></td>
    <td>
<table align="left">
<tr><td class="inform"><?php echo $TEXT['login-familiya']; ?>:&nbsp;</td><td class="input"><?php echo $result_iskh2['familiya']; ?></td></tr>
<tr><td class="inform"><?php echo $TEXT['login-name']; ?>:&nbsp;</td><td class="input"><?php echo $result_iskh2['name']; ?></td></tr>
<?php
if(!empty($result_iskh2['otchestvo'])) {echo "<tr><td class='inform'>".$TEXT['login-otchestvo'].":&nbsp;</td><td class='input'>".$result_iskh2['otchestvo']."</td></tr>";}
if($data_r !== "") {echo "<tr><td class='inform'>".$TEXT['data_rozdeniya'].":&nbsp;</td><td class='input'>".$data_r."</td></tr>";}
if(!empty($result_iskh2['mesto_rozdeniya'])) {echo "<tr><td class='inform'>".$TEXT['mesto_rozdeniya'].":&nbsp;</td><td class='input'>".$result_iskh2['mesto_rozdeniya']."</td></tr>";}
if(!empty($result_iskh2['real_name'])) {echo "<tr><td class='inform'>".$TEXT['real_name'].":&nbsp;</td><td class='input'>".$result_iskh2['real_name']."</td></tr>";}
if($address_aut !== "") {echo "<tr><td class='inform'>".$TEXT['aut-site'].":&nbsp;</td><td class='input'>".$address_aut."</td></tr>";}
?>
<tr><td></td><td><input class="button" type=submit value='<?php echo $button; ?>' />
<input type=hidden name=book_id value='<?php echo $_GET['book_id']; ?>' />
</td></tr>
<?php
if(!empty($_GET['familiya'])) {echo "<input type=hidden name=familiya value='".$_GET['familiya']."' />";}
?>
</table>
</td>
</tr>
</table>
</form>
</td>
</tr>
</table>
<?php
  require_once "../utils/bottom_adm.php";
?>