$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); } else { helper_result('new_user_result', 'result', 'error'); helper_result('new_user', 'error', txt('error')); } } else { helper_result('new_user_result', 'result', 'error'); helper_result('new_user', 'error', $tmp_login . ': ' . txt('login_exists')); }