diff options
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 |
