if (form_submit('new_user')) {
    if ($_POST['user_action'] == 'new_user') {
        $tmp_login = strip_tags($_POST['user_new_login']);
        $tmp_pass1 = strip_tags($_POST['user_new_pass']);
        $tmp_pass2 = strip_tags($_POST['user_new_pass2']);
        $tmp_type = strip_tags($_POST['user_new_type']);
        $tmp_active = intval(strip_tags($_POST['user_new_active']));
        $tmp_lang = strip_tags($_POST['user_new_lang']);
        $tmp_home = strip_tags($_POST['user_new_homedir']);
        if ($tmp_pass1 != $tmp_pass2) {
            helper_result('new_user_result', 'result', 'error');
            helper_result('new_user', 'error', txt('pass_not_match'));
        } else {
            $new_usr = new phpos_users();
            $new_usr->set_user_login($tmp_login);
            if (!$new_usr->user_login_exists($tmp_login)) {
                $new_usr->set_raw_pass($tmp_pass1);
                $new_usr->set_user_type($tmp_type);
                $new_usr->set_is_active($tmp_active);
                if ($tmp_home != 1) {
                    $new_usr->set_nohome();
                }
                if ($new_usr->new_user()) {
                    $new_id = $new_usr->get_new_user_id();
                    $new_cfg = new phpos_config('no_get');
                    $new_cfg->set_id_user($new_id);
                    $new_cfg->update_user('lang', $tmp_lang);
                    $new_cfg->update_user('wallpaper', globalconfig('wallpaper'));
                    helper_result('new_user', 'ok', txt('created'));
                    helper_result('new_user_result', 'result', 'success');
                    helper_result('new_user_id', 'var', $new_id);