diff --git a/setup.php b/setup.php
index 0300894..0f13202 100644
--- a/setup.php
+++ b/setup.php
@@ -1,5 +1,4 @@
has('accounts', ["[>]assigned_permissions" => ["uid" => "uid"]],
if (is_empty($_POST['username']) || is_empty($_POST['password']) || is_empty($_POST['realname'])) {
?>
-
-
- Admin Account Creation
-
-
- Admin Account Creation tool
-
-
-
-Admin Account Creation
+ Admin Account Creation tool
+
+ get('accounts', 'uid', ['username' => $_POST['username']]);
+ echo "User already exists, skipping creation.\n";
+ } else {
+ $userid = adduser($_POST['username'], $_POST['password'], $_POST['realname'], (filter_var($_POST['email'], FILTER_VALIDATE_EMAIL) ? $_POST['email'] : null), "", "", 1);
+ echo "User account #$userid created.\n";
+ }
$database->insert('assigned_permissions', ['uid' => $userid, 'permid' => 1]);
- die("Account created.");
+ die("ADMIN permission assigned.");
}
\ No newline at end of file