en fil der tillader en admin at oprette en my admin
This commit is contained in:
parent
c1484e4710
commit
409556ca2e
|
@ -0,0 +1,26 @@
|
||||||
|
<?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();
|
||||||
|
}
|
Loading…
Reference in New Issue