From 7fae58283dff2b2f4f33c1b9c3554b7677f3f062 Mon Sep 17 00:00:00 2001 From: Connor Thomson Date: Sun, 20 Sep 2026 14:19:07 -0700 Subject: Switch to session ids --- signup/signup.php | 12 +++++------- signup/verify/verify.php | 6 +++++- 2 files changed, 10 insertions(+), 8 deletions(-) (limited to 'signup') diff --git a/signup/signup.php b/signup/signup.php index 5ba3ca8..4300b61 100755 --- a/signup/signup.php +++ b/signup/signup.php @@ -17,6 +17,10 @@ * along with this program. If not, see . */ +define('ROOT', rtrim($_SERVER['DOCUMENT_ROOT'], '/') . '/'); + +require_once ROOT . '/php/session.php'; + if ($_SERVER["REQUEST_METHOD"] == "POST") { $username = $_POST['username']; $password = $_POST['password']; @@ -64,13 +68,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") { $user_id = $pdo->lastInsertId(); - setcookie('user_id', (string)$user_id, [ - 'expires' => 2147483647, - 'path' => '/', - 'secure' => true, - 'httponly' => true, - 'samesite' => 'Strict' - ]); + set_user_id((int)$user_id); } catch (\PDOException $e) { if ($e->getCode() == 23000) { echo "Error: Username or email is already taken."; diff --git a/signup/verify/verify.php b/signup/verify/verify.php index e5e729f..1fc6202 100755 --- a/signup/verify/verify.php +++ b/signup/verify/verify.php @@ -17,9 +17,13 @@ * along with this program. If not, see . */ +define('ROOT', rtrim($_SERVER['DOCUMENT_ROOT'], '/') . '/'); + +require_once ROOT . '/php/session.php'; + if ($_SERVER["REQUEST_METHOD"] == "POST") { $code = $_POST['code']; - $user_id = $_COOKIE['user_id'] ?? null; + $user_id = get_user_id(); if (!$user_id) { echo "Not logged in."; -- cgit v1.2.3