diff options
Implemented a simple login page for (admin) dashboard and skeleton of dashboard controller and view
1 files changed, 24 insertions, 0 deletions
| -rw-r--r-- | src/controllers/DashboardLoginController.php | 24 |
diff --git a/src/controllers/DashboardLoginController.php b/src/controllers/DashboardLoginController.php new file mode 100644 index 0000000..8c1cc67 --- /dev/null +++ b/src/controllers/DashboardLoginController.php @@ -0,0 +1,24 @@ +<?php +include_once('controllers/BaseController.php'); +include_once('controllers/DashboardController.php'); + +class DashboardLoginController extends BaseController { + private static $message; + + public static function get() { + include "views/dashboard-login.php"; + } + + public static function post() { + if ($_POST['username'] == "admin" && $_POST['password'] == "admin") { + // Probably a bad practice, but couldn't find if it is + $_SERVER['REQUEST_METHOD'] = "GET"; + // Load normal dashboard + DashboardController::invoke(); + } + else { + self::$message = "Bad credentials!"; + include "views/dashboard-login.php"; + } + } +} |
