From 440e8f50feda7a3c1d78c16678624bfe8eaf4db1 Mon Sep 17 00:00:00 2001 From: ilotterytea Date: Tue, 19 Aug 2025 10:02:56 +0500 Subject: feat: edit account information + display it --- account/edit.php | 99 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 account/edit.php (limited to 'account') diff --git a/account/edit.php b/account/edit.php new file mode 100644 index 0000000..9c46c02 --- /dev/null +++ b/account/edit.php @@ -0,0 +1,99 @@ + 20) { + exit(create_alert('/account/edit.php', 400, 'New username must be between 4 and 20 characters long', null)); + } + } + + $db = new PDO(DB_URL, DB_USER, DB_PASS); + + $db->prepare('UPDATE users SET username = ?, password = ? WHERE id = ?') + ->execute([$username, $password, $user['id']]); + + $user['username'] = $username; + $user['password'] = $password; + + $_SESSION['user'] = $user; + + exit(create_alert('/account/edit.php', 200, 'Success!', $user)); +} + +?> + + + + + id system + + + + +
+ + + +
+
+

Edit account information

+ + + + + + + + + + + + + + + + + +
Username
Password
+ +
+
+
+
+
+

Danger zone

+ +
+
+ + + \ No newline at end of file -- cgit v1.2.3