<?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['exusr-add2'];
  $helppage = $TEXT['exusr-add-title'];

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

  if($result2['administrator'] == 0) puterror3($TEXT['error-loginform4']);

  if(!isset($button)) $button = $TEXT['btn_add'];
  if(!isset($action)) $action = "add.php";
  if(!isset($showhide)) $visible = "checked";

  if(empty($_GET['userid'])) $_GET['userid'] = "0";

  if(strlen($_GET['userid'])>11) puterror3($TEXT['error-user2']);
  $_GET['userid'] = rep($_GET['userid']);

  $user=$_GET['userid'];
  $shl=$exim_shell;
  $uid=$exim_uid;
  $gid=$exim_gid;
  $home=$exim_home;
  $quo=$exim_kvota;
  $name="";
  $id="";
  $passwd=passgen($exim_pass);

?>
<form enctype='multipart/form-data' action=<?php echo $action; ?> method=post>
<table>
<tr><td class="useraddedit"><?php echo $TEXT['ex-bat-ex5']; ?>: </td><td class="useraddedit"><input size=50 maxlength=220 class="inputmandatory" type=text name=id value='<?php echo $id; ?>'></td></tr>
<tr><td class="useraddedit"><?php echo $TEXT['tbl-domain']; ?>: </td>
    <td class="useraddedit"><select class="inputmandatory" name="mbox_host">
    <?php
        $query = "SELECT * FROM `domains` ORDER BY domain";
        $domain_tmp = mysql_query($query);
          if(!$domain_tmp) puterror3($TEXT['error-tbl27']);
              while($domain = mysql_fetch_array($domain_tmp))
                {
		               $chk = "<option value=".$domain['domain'].">".$domain['domain']." (".$domain['type'].")";
                 echo $chk;
                }
    ?>
    </select></td></tr>
<tr><td class="useraddedit"><?php echo $TEXT['login-user']; ?>: </td><td class="useraddedit"><input size=50 maxlength=255 class="inputmandatory" type=text name=name value='<?php echo $name; ?>'></td></tr>
<tr><td class="useraddedit"><?php echo $TEXT['login-password']; ?>: </td><td class="useraddedit"><input size=50 maxlength=255 class="inputmandatory" type=text name=passwd value='<?php echo $passwd; ?>'></td></tr>
<tr><td class="useraddedit"><?php echo $TEXT['user-uid']; ?></td><td class="useraddedit"><input size=50 maxlength=10 class="inputmandatory" type=text name=uid value='<?php echo $uid; ?>'></td></tr>
<tr><td class="useraddedit"><?php echo $TEXT['user-gid']; ?></td><td class="useraddedit"><input size=50 maxlength=10 class="inputmandatory" type=text name=gid value='<?php echo $gid; ?>'></td></tr>
<tr><td class="useraddedit"><?php echo $TEXT['user-shell']; ?></td><td class="useraddedit"><input size=50 maxlength=32 class="inputmandatory" type=text name=shl value='<?php echo $shl; ?>'></td></tr>
<tr><td class="useraddedit"><?php echo $TEXT['user-hom']; ?></td><td class="useraddedit"><input size=50 maxlength=128 class="inputmandatory" type=text name=hom value='<?php echo $home; ?>'></td></tr>
<tr><td class="useraddedit"><?php echo $TEXT['exusr-kvota']; ?>: </td><td class="useraddedit"><input size=50 maxlength=7 class="inputmandatory" type=text name=kvota value='<?php echo $quo; ?>'></td></tr>
<tr><td class="useraddedit"><?php echo $TEXT['exusr-act4']; ?></td><td><input type=checkbox name=visible <?php echo $visible; ?>></td></tr>
<tr><td></td><td>
<input class="button" type=submit value='<?php echo $button; ?>' />
<input type=hidden name=user_id value='<?php echo $user; ?>' />
</td></tr>
</table>
</form>
<?php
  require_once "../../util/bottom.php";
?>