Files
huntingclubroster/classes/SignUp.php
T

33 lines
1.3 KiB
PHP
Raw Normal View History

<?php
2026-10-18 19:27:17 -04:00
class SignUp extends Base {
public function createAccount() {
2026-10-18 19:27:17 -04:00
$params = ['BTN_SUBMIT' => '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.');
}
2026-10-18 19:27:17 -04:00
$auth->register($_POST);
$_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] ?? '';
}
2026-10-18 19:27:17 -04:00
}
}
2026-10-18 19:27:17 -04:00
if (!empty($_SESSION['signup_success'])) {
$params['SIGNUP_SUCCESSFUL'] = 'TRUE';
unset($_SESSION['signup_success']);
}
echo $this->applyXSL('<XML/>', $this->getXSL('createAccount'), $params);
exit;
}
}