<?php
  ///////////////////////////////////////////////////
  //2007 (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=$titlepage = $TEXT['login-title4'];
  $helppage = $TEXT['login-help4'];
  require_once "../config.php";
  require_once "../util/top.php";

  if($result2['administrator'] == 0) puterror2($TEXT['error-loginform2']);
?>
 <img alt="<?php echo $TEXT['login-add-new']; ?>" src= "../img/insert.png" height="15" align="top" /><a class="boldit" href="addform.php" title="<?php echo $TEXT['login-add-new-tit']; ?>"><?php echo $TEXT['login-add-new']; ?></a>
 <br />
 <br />
 <span class="tabledata"><?php echo $TEXT['login-text1']; ?></span>
<table class="table" border="1" cellpadding="3" cellspacing="0" width="90%">
<?php
     $query = "SELECT * FROM `tbl_logins` ORDER BY `login`";
     $result = mysql_query($query);
     if(!$result) puterror2($TEXT['error-tbl20']);
       if(mysql_num_rows($result)>0);
         {
           echo "<tr class='tableheadercat'>
            <td>".$TEXT['login-login']."</td>
            <td>".$TEXT['login-fullname']."</td>
            <td>".$TEXT['login-user']."</td>
            <td>".$TEXT['login-moderator']."</td>
            <td>".$TEXT['login-administrator']."</td>
            <td>".$TEXT['login-manager']."</td>
            <td>".$TEXT['login-master']."</td>
            <td>".$TEXT['res-field2']."</td>
            <td colspan=2>".$TEXT['tbl-action']."</td>
                 </tr>";
             while($result_logins = mysql_fetch_array($result,MYSQL_ASSOC))
               {
              $edit = "<a href=editform.php?login_id=".$result_logins['login_id']." title='".$TEXT['login-edit-tit']."'>".$TEXT['tbl-edit']."</a>";
              $delete = "<a href=delete.php?login_id=".$result_logins['login_id']." title='".$TEXT['login-del-tit']."'>".$TEXT['tbl-delete']."</a>";
              $yes = "<img alt='yes' src='../img/yes.png' />";
              $no = "<img alt='no' src='../img/no.png' />";

              if($result_logins['moderator'] == 1) $moderator = $yes;
                else $moderator = $no;

              if($result_logins['administrator'] == 1) $administrator = $yes;
                else $administrator = $no;

              if($result_logins['user'] == 1) $user = $yes;
                else $user = $no;

              if($result_logins['manager'] == 1) $manager = $yes;
                else $manager = $no;

              if($result_logins['master'] == 1) $master = $yes;
                else $master = $no;

              if($result_logins['otvetstvenniy'] == 1) $otvetstvenniy = $yes;
                else $otvetstvenniy = $no;

             if($result_logins['usr_id'] > 0) $login_v = "<a href# onClick=window.open('../../user.php?user_id=".$result_logins['usr_id']."','popup','top=". $TEXT['user-top'].",left=".$TEXT['user-left'].",width=".$TEXT['user-width'].",height=".$TEXT['user-height'].",status=no,scrollbars=no,location=no,menubar=no,toolbar=no') title='".$TEXT['btn_test']."'>".$result_logins['login']."</a>";
              else $login_v = $result_logins['login'];
           ?>
           <tr class='tabledata' onmouseover="this.style.backgroundColor='#cccccc';" onmouseout="this.style.backgroundColor='#ffffff';">
              <td><?php echo $login_v; ?></td>
              <td><?php echo $result_logins['fullname']; ?></td>
              <td><?php echo $user; ?></td>
              <td><?php echo $moderator; ?></td>
              <td><?php echo $administrator; ?></td>
              <td><?php echo $manager; ?></td>
              <td><?php echo $master; ?></td>
              <td><?php echo $otvetstvenniy; ?></td>
              <td><?php echo $edit; ?></td>
              <td><?php echo $delete; ?></td>
           </tr>
           <?php
               }
         }
?>
</table>
<?php
  require_once "../util/bottom.php";
?>