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

  $lang = substr($_SERVER["HTTP_ACCEPT_LANGUAGE"], 0,2);
  if(is_file ("../lang/".$lang."/".$lang.".php")) {include "../lang/".$lang."/".$lang.".php";}
     else {include "../lang/ru/ru.php";}

  $title = $TEXT['addr-title'];

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

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

  $button = $TEXT['btn_filter'];
  $action = "index.php";

  if(empty($_POST['rows']))
  {
   if(empty($_GET['rows'])) {$_POST['rows'] = $result2['fltr_size'];}
    else {$_POST['rows'] = $_GET['rows'];}
  }

  if(empty($_POST['name']))
  {
   if(empty($_GET['name'])) {$_POST['name'] = "";}
    else {$_POST['name'] = $_GET['name'];}
  }

  if(empty($_POST['ip_addr']))
  {
   if(empty($_GET['ip_addr'])) {$_POST['ip_addr'] = "";}
    else {$_POST['ip_addr'] = $_GET['ip_addr'];}
  }

  if(empty($_POST['hw']))
  {
   if(empty($_GET['hw'])) {$_POST['hw'] = "";}
    else {$_POST['hw'] = $_GET['hw'];}
  }

  if(empty($_POST['descr']))
  {
   if(empty($_GET['descr'])) {$_POST['descr'] = "";}
    else {$_POST['descr'] = $_GET['descr'];}
  }

  if(empty($_POST['vkl']))
  {
   if(empty($_GET['vkl'])) {$_POST['vkl'] = "";}
    else {$_POST['vkl'] = $_GET['vkl'];}
  }

  if(empty($_POST['srv_id']))
  {
   if(empty($_GET['srv_id'])) {$_POST['srv_id'] = "";}
    else {$_POST['srv_id'] = $_GET['srv_id'];}
  }

  if(empty($_POST['vkl_ch']))
  {
   if(empty($_GET['vkl_ch'])) {$_POST['vkl_ch'] = "";}
    else {$_POST['vkl_ch'] = $_GET['vkl_ch'];}
  }

  if(empty($_POST['srv_ch']))
  {
   if(empty($_GET['srv_ch'])) {$_POST['srv_ch'] = "";}
    else {$_POST['srv_ch'] = $_GET['srv_ch'];}
  }

  if(empty($_POST['search']))
  {
   if(!empty($_GET['search'])) {$_POST['search'] = $_GET['search'];}
    else {$_POST['search'] = "";}
  }

   if(!empty($_GET['typepar'])) {$_POST['typepar'] = $_GET['typepar'];}
    else {$_POST['typepar'] = $_POST['typepar'];}

  if(strlen($_POST['rows'])>12) {puterror($result2['skin'],$TEXT['error-log10']); require_once "../utils/bottom_adm.php"; exit();}
  if(strlen($_POST['srv_id'])>5) {puterror($result2['skin'],$TEXT['error-srv22']); require_once "../utils/bottom_adm.php"; exit();}
  if(strlen($_POST['ip_id'])>255) {puterror($result2['skin'],$TEXT['error-addr22']); require_once "../utils/bottom_adm.php"; exit();}
  if(strlen($_POST['name'])>255) {puterror($result2['skin'],$TEXT['error-addr2']); require_once "../utils/bottom_adm.php"; exit();}
  if(strlen($_POST['descr'])>255) {puterror($result2['skin'],$TEXT['error-addr3']); require_once "../utils/bottom_adm.php"; exit();}
  if(strlen($_POST['ip_addr'])>15) {puterror($result2['skin'],$TEXT['error-addr5']); require_once "../utils/bottom_adm.php"; exit();}
  if(strlen($_POST['hw'])>17) {puterror($result2['skin'],$TEXT['error-addr7']); require_once "../utils/bottom_adm.php"; exit();}
  if(strlen($_POST['vkl'])>1) {puterror($result2['skin'],$TEXT['error-srv15']); require_once "../utils/bottom_adm.php"; exit();}
  if(strlen($_POST['vkl_ch'])>5) {puterror($result2['skin'],$TEXT['error-srv15']); require_once "../utils/bottom_adm.php"; exit();}
  if(strlen($_POST['srv_ch'])>5) {puterror($result2['skin'],$TEXT['error-srv15']); require_once "../utils/bottom_adm.php"; exit();}
  if(strlen($_POST['search'])>255) {puterror($result2['skin'],$TEXT['error-ondisk7']); require_once "../utils/bottom_adm.php"; exit();}

  $_POST['name'] = rep($_POST['name']);
  $_POST['descr'] = rep($_POST['descr']);
  $_POST['ip_addr'] = rep($_POST['ip_addr']);
  $_POST['hw'] = rep($_POST['hw']);
  $_POST['vkl'] = rep($_POST['vkl']);
  $_POST['vkl_ch'] = rep($_POST['vkl_ch']);
  $_POST['srv_ch'] = rep($_POST['srv_ch']);
  $_POST['srv_id'] = rep($_POST['srv_id']);
  if(empty($_POST['rows'])) {$_POST['rows'] = $result2['fltr_size'];}
  $_POST['rows'] = rep($_POST['rows']);
  $_POST['rows'] = intval($_POST['rows']);
  $_POST['search'] = rep($_POST['search']);

  if($_POST['search'] !== '')
  {
    switch($_POST['typepar'])
      {
      case 1:
      $_POST['ip_addr'] = $_POST['search'];
      break;
      case 2:
      $_POST['hw'] = $_POST['search'];
      break;
      case 3:
      $_POST['descr'] = $_POST['search'];
      break;
      case 4:
      $_POST['name'] = $_POST['search'];
      break;
      case 5:
      $_POST['skvznoy'] = $_POST['search'];
      break;
      }
   }
  $ipmass = Array(",","ю","Ю");
  $ipmass2 = Array(",");
  $_POST['ip_addr'] = trim(str_replace($ipmass,".",$_POST['ip_addr']));
  $_POST['skvznoy'] = trim(str_replace($ipmass2,".",$_POST['skvznoy']));

  $delimiter=".";
  $name=$_POST['name'];
  if(!empty($_POST['ip_addr']))
  {
  $ip_addr=$_POST['ip_addr'];
  $addr = explode($delimiter,$ip_addr,4);
  $oct1 = strlen($addr['0']);
   if($oct1 == 1) {$oct_res1 = "00".$addr['0'];}
    elseif($oct1 == 2) {$oct_res1 = "0".$addr['0'];}
     else
      {
       if($addr['0'] == "") {$oct_res1 = "";}
        else {$oct_res1 = $addr['0'];}
      }
  $oct2 = strlen($addr['1']);
   if($oct2 == 1) {$oct_res2 = ".00".$addr['1'];}
    elseif($oct2 == 2) {$oct_res2 = ".0".$addr['1'];}
     else
      {
       if($addr['1'] == "") {$oct_res2 = "";}
        else {$oct_res2 = ".".$addr['1'];}
      }
  $oct3 = strlen($addr['2']);
    if($oct3 == 1) {$oct_res3 = ".00".$addr['2'];}
     elseif($oct3 == 2) {$oct_res3 = ".0".$addr['2'];}
      else
      {
       if($addr['2'] == "") {$oct_res3 = "";}
        else {$oct_res3 = ".".$addr['2'];}
      }
  $oct4 = strlen($addr['3']);
    if($oct4 == 1) {$oct_res4 = ".00".$addr['3'];}
     elseif($oct4 == 2) {$oct_res4 = ".0".$addr['3'];}
      else
      {
       if($addr['3'] == "") {$oct_res4 = "";}
        else {$oct_res4 = ".".$addr['3'];}
      }
   $ip_addr2 = $oct_res1.$oct_res2.$oct_res3.$oct_res4;
  } else {$ip_addr2 = "";}

  if(!empty($_POST['skvznoy']))
  {
  $ip_addr=$_POST['skvznoy'];
  $addr = explode($delimiter,$ip_addr,4);
  $oct1 = strlen($addr['0']);
   if($oct1 == 1) {$oct_res1 = "00".$addr['0'];}
    elseif($oct1 == 2) {$oct_res1 = "0".$addr['0'];}
     else
      {
       if($addr['0'] == "") {$oct_res1 = "";}
        else {$oct_res1 = $addr['0'];}
      }
  $oct2 = strlen($addr['1']);
   if($oct2 == 1) {$oct_res2 = ".00".$addr['1'];}
    elseif($oct2 == 2) {$oct_res2 = ".0".$addr['1'];}
     else
      {
       if($addr['1'] == "") {$oct_res2 = "";}
        else {$oct_res2 = ".".$addr['1'];}
      }
  $oct3 = strlen($addr['2']);
    if($oct3 == 1) {$oct_res3 = ".00".$addr['2'];}
     elseif($oct3 == 2) {$oct_res3 = ".0".$addr['2'];}
      else
      {
       if($addr['2'] == "") {$oct_res3 = "";}
        else {$oct_res3 = ".".$addr['2'];}
      }
  $oct4 = strlen($addr['3']);
    if($oct4 == 1) {$oct_res4 = ".00".$addr['3'];}
     elseif($oct4 == 2) {$oct_res4 = ".0".$addr['3'];}
      else
      {
       if($addr['3'] == "") {$oct_res4 = "";}
        else {$oct_res4 = ".".$addr['3'];}
      }
   $ip_addr3 = $oct_res1.$oct_res2.$oct_res3.$oct_res4;
  } else {$ip_addr3 = "";}

  $hwmass = Array(":",";","-");
  $hw=$_POST['hw']=trim(strtoupper(str_replace($hwmass,"",$_POST['hw'])));
  $hw2=$_POST['skvznoy']=trim(strtoupper(str_replace($hwmass,"",$_POST['skvznoy'])));
  $descr=$_POST['descr'];
  $rows=$_POST['rows'];
  if(empty($_POST['vkl'])) {$_POST['vkl'] = 0;}

  if($_POST['vkl_ch'] == "on")
   {
    $vkl="AND tbl_ip.vkl_ip = '".$_POST['vkl']."' ";
    $vkl_ch="checked";
    $vkl_opt = $_POST['vkl'];
   }
   else
   {
    $vkl="";
    $vkl_ch="";
    $vkl_opt = $_POST['vkl'];
   }

  if($_POST['srv_ch'] == "on")
   {
    $srv_id=" tbl_ip.srv_id = '".$_POST['srv_id']."' ";
    $srv_ch="checked";
   }
   else
   {
    $srv_id=" tbl_ip.ip_id !='0' ";
    $srv_ch="";
   }

  $query2 = mysqli_query($dbcnx,"SELECT COUNT(ip_id) AS c_ip_id FROM tbl_ip");
    $coun = mysqli_fetch_array($query2,MYSQLI_ASSOC);
?>
<form enctype='multipart/form-data' action=<?php echo $action; ?> method=post >
<table align="center" class="table" border="0" cellpadding="0" cellspacing="0" width="90%">
<tr><td>
<fieldset>
<legend align="left" title="<?php echo $TEXT['log-tit7']; ?>"><?php echo $TEXT['btn_filter']; ?>&nbsp;(<?php echo $TEXT['log-addr8']; ?><?php echo $coun['c_ip_id']; ?>)</legend>
<table class="table" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr class="button2">
    <td><?php echo $TEXT['addr-ip-addr']; ?></td>
    <td><?php echo $TEXT['addr-mac']; ?></td>
    <td><?php echo $TEXT['addr-name']; ?></td>
    <td><?php echo $TEXT['addr-descr']; ?></td>
    <td><?php echo $TEXT['srv-name']; ?><input type=checkbox name=srv_ch <?php echo $srv_ch; ?>></td>
    <td><?php echo $TEXT['srv-vkl-tit']; ?><input type=checkbox name=vkl_ch <?php echo $vkl_ch; ?>></td>
    <td><?php echo $TEXT['size-count']; ?></td>
</tr>
<tr><td><input size=13 maxlength=15 type=text name=ip_addr value='<?php echo $_POST['ip_addr']; ?>'></td>
    <td><input size=15 maxlength=17 type=text name=hw value='<?php echo $hw; ?>'></td>
    <td><input size=12 maxlength=255 type=text name=name value='<?php echo $name; ?>'></td>
    <td><input size=20 maxlength=255 type=text name=descr value='<?php echo $descr; ?>'></td>
    <td><select name="srv_id">
    <?php
        $query1 = "SELECT srv_id, name, descr FROM `tbl_srv` ORDER BY name";
        $srv_tmp = mysqli_query($dbcnx,$query1);
          if(!$srv_tmp) {puterror($result2['skin'],$TEXT['error-tbl1']); require_once "../utils/bottom_adm.php"; exit();}
              while($srv = mysqli_fetch_array($srv_tmp,MYSQLI_ASSOC))
                {
                 if($srv['srv_id'] == $_POST['srv_id'])
                   {
                    if($srv['descr'] == '')
                    {
                     $chk = "<option selected value=".$srv['srv_id'].">".$srv['name'];
                    } else {$chk = "<option selected value=".$srv['srv_id'].">".$srv['name']."(".$srv['descr'].")";}
                   }
                  else
                   {
                     if($srv['descr'] == '')
                    {
                     $chk = "<option value=".$srv['srv_id'].">".$srv['name'];
                    } else {$chk = "<option value=".$srv['srv_id'].">".$srv['name']."(".$srv['descr'].")";}
                   }
                echo $chk;
                }
    ?>
    </select></td>
    <td>
        <select name=vkl>
          <option value='1' <?php if ($vkl_opt == 1) {echo "selected";} ?>><?php echo $TEXT['addr-vkluchit2']; ?>
          <option value='0' <?php if ($vkl_opt == 0) {echo "selected";} ?>><?php echo $TEXT['addr-vikluchit2']; ?>
       </select>
    </td>
    <td><input size=8 maxlength=11 type=text name=rows title='<?php echo $TEXT['log-tit12']; ?>' value='<?php echo $rows; ?>'></td>
    <td><input class="button" type=submit value='<?php echo $button; ?>'></td>
</tr>
</table>
</fieldset>
</td></tr>
</table>
</form>
<table align="center" border="0" cellpadding="0" cellspacing="0" width="90%">
<tr align="right">
<td align="right">
    <img alt="<?php echo $TEXT['add-new']; ?>" align="bottom" src="../skins/<?php echo $result2['skin']; ?>/add.png" />
</td>
<td align="left" width="12%">
    <a class="bold_it" href="addform.php" title="<?php echo $TEXT['addr-new-all-tit']; ?>"><?php echo $TEXT['addr-new-all']; ?></a><br />
    <a class="bold_it" href="../podset/index.php?a=2" title="<?php echo $TEXT['addr-new-tit']; ?>"><?php echo $TEXT['add-new']; ?></a>
</td>
</tr>
</table>
<table align="center" border="1" cellpadding="3" cellspacing="0" width="90%">
<?php
echo "<thead><tr class='tableheadercat'>
            <td>".$TEXT['addr-ip-addr']."</td>
            <td>".$TEXT['addr-mac']."</td>
            <td>".$TEXT['addr-name']."</td>
            <td>".$TEXT['addr-descr']."</td>
            <td>".$TEXT['srv-name']."</td>
            <td>".$TEXT['srv-vkl-tit']."</td>
            <td colspan=5>".$TEXT['global-action']."</td>
            </tr></thead><tbody id='tab'>";

   if(!empty($_POST['name'])) {$name = "AND LOWER(tbl_ip.name) LIKE LOWER('%".$_POST['name']."%') ";}
    else {$name = "";}

   if(!empty($_POST['descr'])) {$descr = "AND LOWER(tbl_ip.descr) LIKE LOWER('%".$_POST['descr']."%') ";}
    else {$descr = "";}

   if(!empty($_POST['ip_addr'])) {$ip_addr = "AND tbl_ip.ip_addr REGEXP '".$ip_addr2."' ";}
    else {$ip_addr = "";}

   if(!empty($_POST['hw'])) {$hw = "AND tbl_ip.hw REGEXP '".$hw."' ";}
    else {$hw = "";}

   if(!empty($_POST['skvznoy'])) {$skvznoy = "AND LOWER(tbl_ip.name) LIKE LOWER('%".$_POST['skvznoy']."%') OR tbl_ip.hw REGEXP '".$hw2."' OR LOWER(tbl_ip.descr) LIKE LOWER('%".$_POST['skvznoy']."%') OR tbl_ip.ip_addr REGEXP '".$ip_addr3."' ";}
    else {$skvznoy = "";}

     $query_body = "SELECT 
     tbl_ip.*,
     tbl_etazh.*,
     tbl_oborud.*,
     tbl_podset.etazh_id,
     tbl_podset.obor_id,
     tbl_srv.srv_id,
     tbl_srv.name AS srv_name,
     tbl_srv.descr AS srv_descr
     FROM tbl_ip
     JOIN tbl_srv ON tbl_ip.srv_id=tbl_srv.srv_id
     LEFT JOIN tbl_podset ON tbl_ip.pods_id=tbl_podset.pods_id
     LEFT JOIN tbl_etazh ON tbl_podset.etazh_id=tbl_etazh.etazh_id
     LEFT JOIN tbl_oborud ON tbl_podset.obor_id=tbl_oborud.obor_id
     WHERE ".$srv_id." ".$name." ".$descr." ".$ip_addr." ".$hw." ".$skvznoy." ".$vkl."
     ORDER BY tbl_srv.name, tbl_ip.ip_addr LIMIT ".$rows."";
     $result_body = mysqli_query($dbcnx,$query_body);
     if(!$result_body) {puterror($result2['skin'],mysqli_error($dbcnx)); require_once "../utils/bottom_adm.php"; exit();}
       $result_rows2 = mysqli_num_rows($result_body);
       if($result_rows2 > 0)
         {
           while($result_body_addr = mysqli_fetch_array($result_body,MYSQLI_ASSOC))
               {
              $delete_pic = "<img alt='Удалить' src='../skins/".$result2['skin']."/delete.png' />";
              $delete = "&nbsp;<a href=delete.php?ip_id=".$result_body_addr['ip_id']."&amp;name=".$_POST['name']."&amp;descr=".$_POST['descr']."&amp;ip_addr=".$_POST['ip_addr']."&amp;hw=".$_POST['hw']."&amp;rows=".$_POST['rows']."&amp;srv_id=".$_POST['srv_id']."&amp;srv_ch=".$_POST['srv_ch']."&amp;vkl_ch=".$_POST['vkl_ch']."&amp;vkl=".$_POST['vkl']." title='".$TEXT['delete-tit']."'>".$delete_pic."</a>";

              $wake_pic = "<img alt='".$TEXT['addr-wake']."' src='../skins/".$result2['skin']."/wakeonlan.png' />";
              $wake = "<a href=wakeonlan.php?ip_id=".$result_body_addr['ip_id']." title='".$TEXT['addr-wake']."'>".$wake_pic."</a>";

              $change_pic = "<img alt='".$TEXT['addr-change-param']."' src='../skins/".$result2['skin']."/change.png' />";
              $change_pic2 = "<img alt='".$TEXT['addr-change-param']."' src='../skins/".$result2['skin']."/changetbl.png' />";
              $change = "<a href='changefrm.php?ip_id=".$result_body_addr['ip_id']."' title='".$TEXT['addr-change-param']."'>".$change_pic."</a>";
              $change2 = "<a href='changefrm2.php?ip_id=".$result_body_addr['ip_id']."&amp;srv_id=".$result_body_addr['srv_id']."&amp;srv_ch=on' title='".$TEXT['addr-change-param2']."'>".$change_pic2."</a>";

              $online = "<img alt='".$TEXT['addr-vikluchit']."' src='../skins/".$result2['skin']."/online.png' />";
              $offline = "<img alt='".$TEXT['addr-vkluchit']."' src='../skins/".$result2['skin']."/offline.png' />";
              $move_pic = "<img alt='".$TEXT['btn-move']."' src='../skins/".$result2['skin']."/move.png' />";
              $move = "<a href=movesrvfrm.php?ip_id=".$result_body_addr['ip_id']." title='".$TEXT['btn-move-tit']."'>".$move_pic."</a>&nbsp;<a href='moveform2.php?ip_id=".$result_body_addr['ip_id']."&amp;srv_id=".$result_body_addr['srv_id']."&amp;srv_ch=on' title='".$TEXT['addr-move-tit2']." ".$TEXT['addr-move-tit3']."'>".$change_pic2."</a>";
              $edit_pic = "<img alt='".$TEXT['edit-new']."' src='../skins/".$result2['skin']."/edit.png' />";
              $edit = "<a href=editform.php?ip_id=".$result_body_addr['ip_id']." title='".$TEXT['edit-tit']."'>".$edit_pic."</a>";

              if($result_body_addr['descr'] == "") {$descr = "---";}
               else {$descr = $result_body_addr['descr'];}

              if($result_body_addr['vkl_ip'] == '1') {$vkl = $online;}
                else {$vkl = $offline;}

              if($result_body_addr['vkl_ip'] == '0') {$strvisible = "<a href=on.php?ip_id=".$result_body_addr['ip_id']."&amp;name=".$_POST['name']."&amp;descr=".$_POST['descr']."&amp;ip_addr=".$_POST['ip_addr']."&amp;hw=".$_POST['hw']."&amp;rows=".$_POST['rows']."&amp;srv_id=".$_POST['srv_id']."&amp;srv_ch=".$_POST['srv_ch']."&amp;vkl_ch=".$_POST['vkl_ch']."&amp;vkl=".$_POST['vkl']." title='".$TEXT['srv-vkluchit']."'>".$vkl."</a>";}
                else {$strvisible = "<a href=off.php?ip_id=".$result_body_addr['ip_id']."&amp;name=".$_POST['name']."&amp;descr=".$_POST['descr']."&amp;ip_addr=".$_POST['ip_addr']."&amp;hw=".$_POST['hw']."&amp;rows=".$_POST['rows']."&amp;srv_id=".$_POST['srv_id']."&amp;srv_ch=".$_POST['srv_ch']."&amp;vkl_ch=".$_POST['vkl_ch']."&amp;vkl=".$_POST['vkl']." title='".$TEXT['srv-vikluchit']."'>".$vkl."</a>";}

              $addr = explode($delimiter,$result_body_addr['ip_addr'],4);
              $oct1 = substr($addr['0'],0,1);
               if($oct1 == '0')
                { 
                 $oct_res1 = substr($addr['0'],1,1);
                 if($oct_res1 == '0') 
                  {
                  $oct_result1 = substr($addr['0'],2,3);
                  } else {$oct_result1 = substr($addr['0'],1,3);}
                 } else {$oct_result1 = $addr['0'];}

              $oct2 = substr($addr['1'],0,1);
               if($oct2 == '0')
                { 
                 $oct_res2 = substr($addr['1'],1,1);
                 if($oct_res2 == '0') 
                  {
                  $oct_result2 = substr($addr['1'],2,3);
                  } else {$oct_result2 = substr($addr['1'],1,3);}
                 } else {$oct_result2 = $addr['1'];}

              $oct3 = substr($addr['2'],0,1);
               if($oct3 == '0')
                { 
                 $oct_res3 = substr($addr['2'],1,1);
                 if($oct_res3 == '0') 
                  {
                  $oct_result3 = substr($addr['2'],2,3);
                  } else {$oct_result3 = substr($addr['2'],1,3);}
                 } else {$oct_result3 = $addr['2'];}

              $oct4 = substr($addr['3'],0,1);
               if($oct4 == '0')
                { 
                 $oct_res4 = substr($addr['3'],1,1);
                 if($oct_res4 == '0') 
                  {
                  $oct_result4 = substr($addr['3'],2,3);
                  } else {$oct_result4 = substr($addr['3'],1,3);}
                 } else {$oct_result4 = $addr['3'];}
              $ip_addres = $oct_result1.".".$oct_result2.".".$oct_result3.".".$oct_result4;
              $ip_addres = "<a href='../logs/index.php?what=".$ip_addres."' target=_blank title='".$TEXT['addr-see-log']."'>".$ip_addres."</a>";

              $hw = substr(chunk_split($result_body_addr['hw'],2,":"),0,-1);
              $hw = "<a href='../logs/index.php?what=".$result_body_addr['hw']."' target=_blank >".$hw."</a>";

              if($result_body_addr['etazh'] !== NULL || $result_body_addr['oborud'] !== NULL) {
                  $opis_et_ob = " (".$result_body_addr['etazh'].",&nbsp;".$result_body_addr['oborud'].")";
                  $opis_et_ob2 = ",&nbsp;".$result_body_addr['etazh'].",&nbsp;".$result_body_addr['oborud']."";
              }
                else {$opis_et_ob = "";}

              if(trim($result_body_addr['srv_descr'] !== ""))
              {
           ?>
           <tr>
              <td><?php echo $ip_addres; ?></td>
              <td><?php echo $hw; ?></td>
              <td><?php echo $result_body_addr['name']; ?></td>
              <td><?php echo $descr; ?></td>
              <td><?php echo $result_body_addr['srv_name']; ?> (<?php echo $result_body_addr['srv_descr']; ?><?php echo $opis_et_ob2; ?>)</td>
              <td><?php echo $strvisible; ?></td>
              <td><?php echo $wake; ?></td>
              <td><?php echo $change; ?>&nbsp;<?php echo $change2; ?></td>
              <td align="center"><?php echo $move; ?></td>
              <td align="center"><?php echo $edit; ?></td>
              <td align="center"><?php echo $delete; ?></td>
           </tr>
           <?php
              }
              else
              {
           ?>
           <tr>
              <td><?php echo $ip_addres; ?></td>
              <td><?php echo $result_body_addr['hw']; ?></td>
              <td><?php echo $result_body_addr['name']; ?></td>
              <td><?php echo $descr; ?></td>
              <td><?php echo $result_body_addr['srv_name']; ?><?php echo $opis_et_ob; ?></td>
              <td><?php echo $strvisible; ?></td>
              <td><?php echo $wake; ?></td>
              <td><?php echo $move; ?></td>
              <td><?php echo $edit_pic; ?>&nbsp;<?php echo $edit; ?></td>
              <td><?php echo $delete; ?></td>
           </tr>
           <?php
               }
              }
         }
          else
         {
         ?>
         <tr><td colspan="11" class="bold_it"><?php echo $TEXT['search-err4']; ?></td></tr>
         <?php
         }        
?>
</tbody>
<tfoot>
<tr class='tableheadercat'>
<td colspan="11" align="right"><?php echo $TEXT['addr-found']; ?><?php echo $result_rows2; ?><?php echo $TEXT['addr-found-obg']; ?></td>
</tr>
</tfoot>
</table>
<?php
  require_once "../utils/bottom_adm.php";
?>