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/delete.php | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 public/account/delete.php (limited to 'public/account/delete.php') diff --git a/public/account/delete.php b/public/account/delete.php new file mode 100644 index 0000000..af8a093 --- /dev/null +++ b/public/account/delete.php @@ -0,0 +1,39 @@ +prepare("UPDATE emotes SET uploaded_by = NULL WHERE uploaded_by = :id"); +$stmt->bindValue(":id", $id); +$stmt->execute(); + +$stmt = $db->prepare("DELETE FROM connections WHERE user_id = :id"); +$stmt->bindValue(":id", $id); +$stmt->execute(); + +$stmt = $db->prepare("DELETE FROM users WHERE id = :id"); +$stmt->bindValue(":id", $id); +$stmt->execute(); + +session_unset(); +session_destroy(); + +setcookie("secret_key", "", time() - 1000); + +$db->close(); + +$path = "../static/userdata/avatars/$id"; +if (is_file($path)) { + unlink($path); +} + +header("Location: /account"); \ No newline at end of file -- cgit v1.2.3