From 437c0482c62794231e713628bb36a54f665a053e Mon Sep 17 00:00:00 2001 From: ilotterytea Date: Mon, 12 May 2025 14:12:05 +0500 Subject: fix: delete avatars and banners on /delete request --- public/account/delete.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'public') diff --git a/public/account/delete.php b/public/account/delete.php index 4459edb..99aebe5 100644 --- a/public/account/delete.php +++ b/public/account/delete.php @@ -22,8 +22,15 @@ setcookie("secret_key", "", time() - 1000); $db = null; $path = "../static/userdata/avatars/$id"; -if (is_file($path)) { - unlink($path); +if (is_dir($path)) { + array_map("unlink", glob("$path/*.*")); + rmdir($path); +} + +$path = "../static/userdata/banners/$id"; +if (is_dir($path)) { + array_map("unlink", glob("$path/*.*")); + rmdir($path); } header("Location: /account"); \ No newline at end of file -- cgit v1.2.3