diff options
| author | ilotterytea <iltsu@alright.party> | 2025-04-20 16:06:19 +0500 |
|---|---|---|
| committer | ilotterytea <iltsu@alright.party> | 2025-04-20 16:06:19 +0500 |
| commit | 5fc857449011f76ed7677aad40576790310d23e1 (patch) | |
| tree | a8bbff085c1cd83d5070c1bf4c013e79cfe8f938 /public/account/signout.php | |
| parent | 10cde47798f2a7b10a84a22f53aeddab1ceea720 (diff) | |
feat: moved from SQLite to MySQL
Diffstat (limited to 'public/account/signout.php')
| -rw-r--r-- | public/account/signout.php | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/public/account/signout.php b/public/account/signout.php index dd1d0f9..66a0cac 100644 --- a/public/account/signout.php +++ b/public/account/signout.php @@ -1,5 +1,6 @@ <?php include "../../src/utils.php"; +include_once "../../src/config.php"; session_start(); @@ -8,18 +9,16 @@ if (!isset($_SESSION["user_id"])) { exit; } -$db = new SQLite3("../../database.db"); +$db = new PDO(DB_URL, DB_USER, DB_PASS); -$stmt = $db->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(); +$stmt = $db->prepare("UPDATE users SET secret_key = ? WHERE id = ?"); +$stmt->execute([generate_random_string(32), $_SESSION["user_id"]]); session_unset(); session_destroy(); setcookie("secret_key", "", time() - 1000); -$db->close(); +$db = null; header("Location: /account");
\ No newline at end of file |
