<?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['domain-title'];

  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();}
?>
<table align="center" border="0" cellpadding="0" cellspacing="0" width="50%">
<tr align="right">
    <td><img alt="<?php echo $TEXT['add-new']; ?>" align="bottom" src="../skins/<?php echo $result2['skin']; ?>/add.png" /><a class="bold_it" href="addform.php" title="<?php echo $TEXT['add-new-tit']; ?>"><?php echo $TEXT['add-new']; ?></a></td>
</tr>
</table>
<table align="center" class="table" border="1" cellpadding="3" cellspacing="0" width="50%">
<?php
     $query10 = "SELECT * FROM `tbl_domain` ORDER BY `domain`";
     $result10 = mysqli_query($dbcnx,$query10);
     if(!$result10) {puterror($result2['skin'],$TEXT['error-tbl7']); require_once "../utils/bottom_adm.php"; exit();}
       if(mysqli_num_rows($result10)>0)
         {
           echo " <thead>
              <tr class='tableheadercat'>
                 <td width='60%'>".$TEXT['tbl-domain']."</td>
                 <td colspan=2>".$TEXT['tbl-action']."</td>
              </tr>
             </thead><tbody id='tab'>";
             while($result_domains = mysqli_fetch_array($result10,MYSQLI_ASSOC))
               {
              $edit_pic = "<img alt='картинка' src='../skins/".$result2['skin']."/edit.png' />";
              $edit = $edit_pic."&nbsp;<a href=editform.php?dom_id=".$result_domains['dom_id']." title='".$TEXT['edit-tit']."'>".$TEXT['edit-new']."</a>";

              $query_login_dom = mysqli_query($dbcnx,"SELECT COUNT(dom_id) AS c_dom_id FROM tbl_logins WHERE dom_id='".$result_domains['dom_id']."'");
	            $coun_login_dom = mysqli_fetch_array($query_login_dom,MYSQLI_ASSOC);
                  if($coun_login_dom['c_dom_id'] > 0)
                     {
                       $delete_pic = "<img alt='картинка' src='../skins/".$result2['skin']."/nodelete.png' />";
                       $delete =$delete_pic."&nbsp;".$TEXT['delete-new'];
                     }
                      else
                    {
                       $delete_pic = "<img alt='картинка' src='../skins/".$result2['skin']."/delete.png' />";
                       $delete = $delete_pic."&nbsp;<a href=delete.php?dom_id=".$result_domains['dom_id']." title='".$TEXT['delete-tit']."'>".$TEXT['delete-new']."</a>";
                     }
           ?>
           <tr>
              <td><?php echo $result_domains['domain']; ?></td>
              <td align="center"><?php echo $edit; ?></td>
              <td align="center"><?php echo $delete; ?></td>
            </tr>
           <?php
               }
         }
?>
</tbody>
</table>
<?php
require_once "../utils/bottom_adm.php";
?>