From d8055192991ac8504e48c137038879790c762d2d Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Tue, 26 Jul 2016 14:27:14 +0200 Subject: Adding and deleting users --- include/settings.php | 170 +++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 145 insertions(+), 25 deletions(-) (limited to 'include/settings.php') diff --git a/include/settings.php b/include/settings.php index 7dfbbc3..896152c 100644 --- a/include/settings.php +++ b/include/settings.php @@ -35,43 +35,163 @@ require('./header.php'); + isAdmin()) { + try { + $user = new user($_pdo, $_GET['delete_user']); + if ($user->delete()) { + echo "
The user with username {$user->getUsername()} has been removed.
"; + } else { + echo "
The user with username {$user->getUsername()} could not be removed.
"; + } + } catch (PDOException $e) { + echo "
The user with username {$user->getUsername()} could not be removed due to a PDO error.
"; + } catch (Exception $e) { + echo "
The user with id {$_GET['delete_user']} could not be found.
"; + } + } + ?> +
Password
-
- The passwords don\'t match.
'; - } else if (!$_user->verifyPassword($_POST['password_current'])) { - echo '
The current password was incorrect.
'; - } else { - try { - $_user->setPassword($_POST['password_update']); - echo '
Password successfully changed.
'; - } catch (PDOException $e) { - echo '
An unknown error occurred.
'; - } +
+ The passwords don\'t match.
'; + } else if (!$_user->verifyPassword($_POST['password_current'])) { + echo '
The current password was incorrect.
'; + } else { + try { + $_user->setPassword($_POST['password_update']); + echo '
Password successfully changed.
'; + } catch (PDOException $e) { + echo '
An unknown error occurred.
'; } } - ?> -
-
- -
-
- -
+ } + ?> + +
+ +
+
+ +
+
+ +
+ +
+
+
+
+ +
+
+
Users
+
+ + + + + + isAdmin()) echo ''; ?> + + + + getId()}' + data-mixer-order-username='{$user->getUsername()}'> + + "; + if ($_user->isAdmin()) { + if ($user->getId() == $_user->getId()) { + echo ""; + } else { + echo ""; + } + } + echo ""; + } + ?> + +
#UsernameTools
{$user->getId()}{$user->getUsername()} + + + +
+
+
+
+ + isAdmin()) : ?> +
+
+
Create new
+
+
+
- + +
- +
+
- + -- cgit v1.2.3