'main.php', 'REGISTER_ACTION' => 'SignUp.createAccount']; if (($_SERVER['REQUEST_METHOD'] ?? 'GET') === 'POST') { $this->requireCsrf(); try { $auth = new AuthService(); if (!$auth->allowAttempt('signup-ip', $_SERVER['REMOTE_ADDR'] ?? '', 5, 3600)) { throw new InvalidArgumentException('Too many account requests. Please try again later.'); } $auth->register($_POST); try{(new EmailVerification())->request($_POST['user_email']);} catch(Throwable $e){error_log('Signup verification delivery failed: '.$e->getMessage());} $_SESSION['signup_success'] = true; header('Location: main.php?Xaction=signup', true, 303); exit; } catch (InvalidArgumentException $e) { $params['SIGNUP_ERROR'] = $e->getMessage(); foreach (['user_first_name', 'user_last_name', 'user_email', 'user_name'] as $field) { $params[strtoupper($field)] = $_POST[$field] ?? ''; } } } if (!empty($_SESSION['signup_success'])) { $params['SIGNUP_SUCCESSFUL'] = 'TRUE'; unset($_SESSION['signup_success']); } echo $this->applyXSL('', $this->getXSL('createAccount'), $params); exit; } }