. */ define("headless", true); require_once(dirname(__DIR__) . "/auth.php"); // sets $user require_once(ROOT_DIR . "/helpers/utils.php"); $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : NULL; $login = isset($_REQUEST['login']) ? trim($_REQUEST['login']) : NULL; $pass = isset($_REQUEST['pass']) ? $_REQUEST['pass'] : NULL; if (!$user->isAdmin || empty($action) || empty($login) || $user->login == $login) { uUtils::exitWithError($lang["servererror"]); } $aUser = new uUser($login); switch ($action) { case 'add': if ($aUser->isValid) { uUtils::exitWithError($lang["userexists"]); } if (empty($pass) || $aUser->add($login, $pass) === false) { uUtils::exitWithError($lang["servererror"]); } break; case 'update': // update password if (empty($pass) || $aUser->setPass($pass) === false) { uUtils::exitWithError($lang["servererror"]); } break; case 'delete': if ($aUser->delete() === false) { uUtils::exitWithError($lang["servererror"]); } break; default: uUtils::exitWithError($lang["servererror"]); break; } uUtils::exitWithSuccess(); ?>