<?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-add'];
  $button = $TEXT['btn_add'];
  $action = "add.php";

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();}

?>
<form enctype='multipart/form-data' action=<?php echo $action; ?> method=post>
<table border="0" width="100%" align="center">
<tr>
<td width="50%">
<fieldset>
<legend align="left" title="<?php echo $TEXT['addr-ip-tit']; ?>"><?php echo $TEXT['addr-ip']; ?></legend>
<table align="left" width="98%">
<tr><td class="bold_it_page"><?php echo $TEXT['addr-name']; ?>*</td><td><input size=30 maxlength=255 type=text name=name ></td></tr>
<tr><td class="bold_it_page"><?php echo $TEXT['addr-descr']; ?></td><td><input size=30 maxlength=255 type=text name=descr ></td></tr>
<tr><td class="bold_it_page"><?php echo $TEXT['addr-ip-addr']; ?>*</td><td><input size=20 maxlength=15 type=text name=ip_addr ></td></tr>
<tr><td class="bold_it_page"><?php echo $TEXT['addr-mac']; ?>*</td><td><input size=20 maxlength=17 type=text name=hw ></td></tr>
<tr><td class="bold_it_page"><?php echo $TEXT['srv-vkl']; ?></td><td><input type=checkbox name=vkl_ip ></td></tr>
<tr><td></td><td><input class="button" type=submit value='<?php echo $button; ?>'></td></tr>
</table>
</fieldset>
</td>
<td width="50%">
<fieldset>
<legend align="left" title="<?php echo $TEXT['addr-srv-tit']; ?>"><?php echo $TEXT['addr-srv']; ?></legend>
<table align="right" width="98%" border="0">
<?php
     $query_body = "SELECT srv_id, name, descr, shablon FROM `tbl_srv` WHERE vkl = '1' ORDER BY name ";
     $result_body = mysqli_query($dbcnx,$query_body);
     if(!$result_body) {puterror($result2['skin'],$TEXT['error-tbl1']); require_once "../utils/bottom_adm.php"; exit();}
       $result_rows = mysqli_num_rows($result_body);
       if($result_rows > 0)
         {
          while($result_body_srv = mysqli_fetch_array($result_body,MYSQLI_ASSOC))
          {
           if(empty($_POST['familiya'])) {$fam = "";}
            else {$fam = "&familiya=".$_POST['familiya']."";}

           $srv_name = $result_body_srv['name'];
           $srv_id = $result_body_srv['srv_id'];
           ?>
           <tr>
              <td class="bold_it_page_left"><input type="checkbox" name=srv[] value="<?php echo $srv_id; ?>">&nbsp;<?php echo $srv_name; ?>&nbsp;(<?php echo $result_body_srv['descr']; ?>)</td>
           </tr>
           <?php
               }
         }
           ?>
</table>
</fieldset>
</td>
</table>
</form>
<?php
  require_once "../utils/bottom_adm.php";
?>