diff --git a/lib/login.php b/lib/login.php index f27fa83..09431bd 100644 --- a/lib/login.php +++ b/lib/login.php @@ -22,10 +22,10 @@ $ldap = new LdapManager($ldap_config); * @param string $email User's email address. * @param string $phone1 Phone number #1 * @param string $phone2 Phone number #2 - * @param string $type Account type + * @param int $type Account type * @return int The new user's ID number in the database. */ -function adduser($username, $password, $realname, $email = null, $phone1 = "", $phone2 = "", $type) { +function adduser($username, $password, $realname, $email = null, $phone1 = "", $phone2 = "", $type = 1) { global $database; $database->insert('accounts', [ 'username' => strtolower($username), diff --git a/setup.php b/setup.php new file mode 100644 index 0000000..0300894 --- /dev/null +++ b/setup.php @@ -0,0 +1,45 @@ +has('accounts', ["[>]assigned_permissions" => ["uid" => "uid"]], ['permid' => 1])) { + die("An admin account already exists, exiting."); +} + +if (is_empty($_POST['username']) || is_empty($_POST['password']) || is_empty($_POST['realname'])) { + ?> + + + + Admin Account Creation + + +

Admin Account Creation tool

+
+ Username:
+ Password:
+ Name:
+ Email:
+ +
+ + +insert('assigned_permissions', ['uid' => $userid, 'permid' => 1]); + die("Account created."); +} \ No newline at end of file