");
if ($_SESSION['userlevel'] < '10')
{
  include("includes/error-no-perm.inc.php");
}
else
{
  echo("
Add User
");
  $pagetitle[] = "Add user";
  if (auth_usermanagement())
  {
    if ($_POST['action'] == "add")
    {
      if ($_POST['new_username'])
      {
        if (!user_exists($_POST['new_username']))
        {
          if (isset($_POST['can_modify_passwd'])) {
            $_POST['can_modify_passwd'] = 1;
          } else {
            $_POST['can_modify_passwd'] = 0;
          }
          # FIXME: missing email field here on the form
          if (adduser($_POST['new_username'], $_POST['new_password'], $_POST['new_level'], '', $_POST['realname'], $_POST['can_modify_passwd']))
          {
            echo("User " . $_POST['username'] . " added!");
          }
        }
        else
        {
          echo('User with this name already exists!
');
        }
      }
      else
      {
        echo('Please enter a username!
');
      }
    }
    echo("");
  }
  else
  {
    echo('Auth module does not allow user management!
');
  }
}
echo("");
?>