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/delete.php | |
| parent | 10cde47798f2a7b10a84a22f53aeddab1ceea720 (diff) | |
feat: moved from SQLite to MySQL
Diffstat (limited to 'public/account/delete.php')
| -rw-r--r-- | public/account/delete.php | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/public/account/delete.php b/public/account/delete.php index af8a093..ecfcc80 100644 --- a/public/account/delete.php +++ b/public/account/delete.php @@ -1,5 +1,6 @@ <?php include "../../src/utils.php"; +include_once "../../src/config.php"; session_start(); @@ -10,26 +11,23 @@ if (!isset($_SESSION["user_id"])) { $id = $_SESSION["user_id"]; -$db = new SQLite3("../../database.db"); +$db = new PDO(DB_URL, DB_USER, DB_PASS); -$stmt = $db->prepare("UPDATE emotes SET uploaded_by = NULL WHERE uploaded_by = :id"); -$stmt->bindValue(":id", $id); -$stmt->execute(); +$stmt = $db->prepare("UPDATE emotes SET uploaded_by = NULL WHERE uploaded_by = ?"); +$stmt->execute([$id]); -$stmt = $db->prepare("DELETE FROM connections WHERE user_id = :id"); -$stmt->bindValue(":id", $id); -$stmt->execute(); +$stmt = $db->prepare("DELETE FROM connections WHERE user_id = ?"); +$stmt->execute([$id]); -$stmt = $db->prepare("DELETE FROM users WHERE id = :id"); -$stmt->bindValue(":id", $id); -$stmt->execute(); +$stmt = $db->prepare("DELETE FROM users WHERE id = ?"); +$stmt->execute([$id]); session_unset(); session_destroy(); setcookie("secret_key", "", time() - 1000); -$db->close(); +$db = null; $path = "../static/userdata/avatars/$id"; if (is_file($path)) { |
