<?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-title'];
  $helppage = $TEXT['login-help'];

  require_once "../config.php";
  require_once "../util/top.php";
  require_once "../util/pass.php";

  if($result2['administrator'] == 0) puterror2($TEXT['error-loginform2']);

  if(!isset($title)) $title = $TEXT['login-title'];
  if(!isset($button)) $button = $TEXT['btn_add'];
  if(!isset($action)) $action = "add.php";

  $passwd=passgen($spr_pass);
?>
<form enctype='multipart/form-data' action=<?php echo $action; ?> method=post>
<table>
<tr><td class="useraddedit"><?php echo $TEXT['login-name']; ?></td><td class="useraddedit"><input size=30 maxlength=30 class="inputmandatory" type=text name=login /></td></tr>
<tr><td class="useraddedit"><?php echo $TEXT['login-fullname']; ?></td><td class="useraddedit"><input size=30 maxlength=127 type=text name=fullname /></td></tr>
<tr><td class="useraddedit"><?php echo $TEXT['login-password']; ?></td><td class="useraddedit"><input size=30 maxlength=100 class="inputmandatory" type=text name=password value='<?php echo $passwd; ?>' /></td></tr>
<tr><td class="useraddedit"><?php echo $TEXT['login-password2']; ?></td><td class="useraddedit"><input size=30 maxlength=100 class="inputmandatory" type=text name=password2 /></td></tr>
<tr><td class="useraddedit"><?php echo $TEXT['login-moderator']; ?></td><td><input type=checkbox name=moderator /></td></tr>
<tr><td class="useraddedit"><?php echo $TEXT['login-administrator']; ?></td><td><input type=checkbox name=administrator /></td></tr>
<tr><td class="useraddedit"><?php echo $TEXT['login-user']; ?></td><td><input type=checkbox name=user /></td></tr>
<tr><td class="useraddedit"><?php echo $TEXT['login-manager']; ?></td><td><input type=checkbox name=manager /></td></tr>
<tr><td class="useraddedit"><?php echo $TEXT['login-master']; ?></td><td><input type=checkbox name=master /></td></tr>
<tr><td class="useraddedit"><?php echo $TEXT['res-field18']; ?></td><td><input type=checkbox name=otvetstvenniy /></td></tr>
<tr>
    <td class="useraddedit"><?php echo $TEXT['login-split']; ?></td><td><input type=checkbox name=iduser >
    <select class=input name="user_id">
    <?php
        $query = "SELECT * FROM `tbl_users` WHERE `visible` != 'hide' ORDER BY familiya";
        $user_tmp = mysql_query($query);
          if(!$user_tmp) puterror2($TEXT['error-tbl2']);
              while($user = mysql_fetch_array($user_tmp))
                {
                 $chk = "<option value=".$user['user_id'].">".$user['familiya']." ".$user['name']." ".$user['otchestvo'];
                 echo $chk;
                }
    ?>
    </select></td>
</tr>
<tr><td class="useraddedit"><?php echo $TEXT['global-chk-updates']; ?></td><td><input type=checkbox name=chk_upd ></td></tr>
<tr><td></td><td><input class="button" type=submit value='<?php echo $button; ?>' /></td></tr>
</table>
</form>
<?php
  require_once "../util/bottom.php";
?>