From 24efe49bc2b545e3a3e46d7d6f2bd1166163e52b Mon Sep 17 00:00:00 2001 From: cflip <36554078+cflip@users.noreply.github.com> Date: Sat, 5 Jun 2021 11:18:10 -0600 Subject: Move object related functions into their classes. Some of the pages are still broken from this commit, but I plan to either rewrite or ignore them. --- includes/functions_user.php | 31 ------------------------------- 1 file changed, 31 deletions(-) delete mode 100644 includes/functions_user.php (limited to 'includes/functions_user.php') diff --git a/includes/functions_user.php b/includes/functions_user.php deleted file mode 100644 index 690350a..0000000 --- a/includes/functions_user.php +++ /dev/null @@ -1,31 +0,0 @@ -query($sql, "s", $username); - - return !empty($result); -} - -function register_user(string $username, string $pass_hash) -{ - $sql = "INSERT INTO users(user_name, user_pass, user_date, user_level) VALUES(?, ?, NOW(), 0);"; - Database::get()->query($sql, "ss", $username, $pass_hash); -} - -function change_password(User $user, string $pass_hash) -{ - if (!Session::get()->is_signed_in()) { - trigger_error('You are not signed in.'); - return; - } - - if (Session::get()->get_current_user()->id != $user->id) { - trigger_error("You can't change another user's password."); - return; - } - - $sql = "UPDATE users SET user_pass = ? WHERE user_id = ?;"; - Database::get()->query($sql, "si", $pass_hash, $user->id); -} \ No newline at end of file -- cgit v1.2.3