26 lines
804 B
PHP
26 lines
804 B
PHP
|
<?php
|
||
|
require_once "../../../bootstrap.php";
|
||
|
require_once "Admin.php";
|
||
|
|
||
|
use Backend\Models\AdminUser;
|
||
|
|
||
|
if (isAdmin()){
|
||
|
if (isset($_POST["newAdmin"])){
|
||
|
$admin = new AdminUser();
|
||
|
$admin->user_name = $_POST["newUsername"];
|
||
|
$admin->password = $_POST["newPassword"];
|
||
|
if ($admin->save()){
|
||
|
header("location: ../../../Frontend/Html/AdminPage.html?success=adminUserWasCreated");
|
||
|
exit();
|
||
|
}else{
|
||
|
header("location: ../../../Frontend/Html/AdminPage.html?error=errorWhileSaving");
|
||
|
exit();
|
||
|
}
|
||
|
}else{
|
||
|
header("location: ../../../Frontend/Html/AdminPage.html?error=input:newAdmin.notSet");
|
||
|
exit();
|
||
|
}
|
||
|
}else{
|
||
|
header("location: ../../../Frontend/index.html?error=isNotAdministrator");
|
||
|
exit();
|
||
|
}
|