From 409556ca2e63f756c1d9204adc2970bb88e8d76a Mon Sep 17 00:00:00 2001 From: Thomas FJ Date: Fri, 19 Mar 2021 10:48:42 +0100 Subject: [PATCH] en fil der tillader en admin at oprette en my admin --- Backend/Controllers/Admin/AdminSignup.php | 26 +++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 Backend/Controllers/Admin/AdminSignup.php diff --git a/Backend/Controllers/Admin/AdminSignup.php b/Backend/Controllers/Admin/AdminSignup.php new file mode 100644 index 0000000..8c7910e --- /dev/null +++ b/Backend/Controllers/Admin/AdminSignup.php @@ -0,0 +1,26 @@ +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(); +} \ No newline at end of file