From 3b6c6e5774dec41a16da03d1bb8497b448cfa564 Mon Sep 17 00:00:00 2001 From: ilotterytea Date: Sun, 20 Apr 2025 10:46:32 +0500 Subject: feat: users, account management, authentication system --- public/account/signout.php | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 public/account/signout.php (limited to 'public/account/signout.php') diff --git a/public/account/signout.php b/public/account/signout.php new file mode 100644 index 0000000..dd1d0f9 --- /dev/null +++ b/public/account/signout.php @@ -0,0 +1,25 @@ +prepare("UPDATE users SET secret_key = :secret_key WHERE id = :id"); +$stmt->bindValue(":id", $_SESSION["user_id"]); +$stmt->bindValue(":secret_key", generate_random_string(32)); +$stmt->execute(); + +session_unset(); +session_destroy(); + +setcookie("secret_key", "", time() - 1000); + +$db->close(); + +header("Location: /account"); \ No newline at end of file -- cgit v1.2.3