Replace isAdministrator with power

This commit is contained in:
Jay Trees 2022-01-18 12:52:21 +01:00
parent 3dd6c276b4
commit 5de69128fb
2 changed files with 5 additions and 5 deletions

View file

@ -20,8 +20,8 @@ if (isset($_POST['email'], $_POST['password'])) {
;'); ;');
} else { } else {
$database->query('INSERT INTO `users` $database->query('INSERT INTO `users`
(`email`, `password`, `isAdministrator`) VALUES (`email`, `password`, `power`) VALUES
("' . $_POST['email'] . '", "' . sha1($_POST['password']) . '", ' . true . ') ("' . $_POST['email'] . '", "' . sha1($_POST['password']) . '", 100)
;'); ;');
} }

View file

@ -22,10 +22,10 @@ if ('POST' === $_SERVER['REQUEST_METHOD']) {
if (-1 === version_compare($options->version, '0.2.0')) { if (-1 === version_compare($options->version, '0.2.0')) {
$database->query('ALTER TABLE `users` $database->query('ALTER TABLE `users`
ADD `last_login` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP AFTER `password`, ADD `last_login` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP AFTER `password`,
ADD `isAdministrator` BOOLEAN NOT NULL AFTER `last_login` ADD `power` BOOLEAN NOT NULL DEFAULT 0 AFTER `last_login`
;'); ;');
$database->query('UPDATE `users` $database->query('UPDATE `users`
SET `isAdministrator` = ' . true . ' SET `power` = 100
WHERE `id` = ' . $user->id . WHERE `id` = ' . $user->id .
';'); ';');
$database->query('ALTER TABLE `users` ADD INDEX(`password`);'); $database->query('ALTER TABLE `users` ADD INDEX(`password`);');