From 21fedb3af692b12c1f0aa266bbf788b01f2cbe4c Mon Sep 17 00:00:00 2001 From: George Halkiadakis Date: Sun, 26 Mar 2023 04:50:46 +0300 Subject: auth tests --- html/app/config/app_constants.php | 5 ++++ html/app/models/admin/History_model.php | 2 +- html/app/routes/frontend.php | 3 ++ html/app/views/login.php | 52 +++++++++++++++++++++++++++++++++ html/app/views/simple/Render.php | 2 +- html/index.php | 11 +++++-- 6 files changed, 71 insertions(+), 4 deletions(-) create mode 100644 html/app/views/login.php (limited to 'html') diff --git a/html/app/config/app_constants.php b/html/app/config/app_constants.php index c3b142f..c533748 100644 --- a/html/app/config/app_constants.php +++ b/html/app/config/app_constants.php @@ -14,6 +14,11 @@ define('DEFAULT_PRIVILEGES', [ +define('COMMON_USER', 1); +define('EDITOR', 2); +define('ADMIN', 3); + + // ACCESS HISTORY ////////////////////////////////////////////////////////////// // ----------------------------------------------------------------------------- // (user-)access types diff --git a/html/app/models/admin/History_model.php b/html/app/models/admin/History_model.php index 638ac62..438121e 100644 --- a/html/app/models/admin/History_model.php +++ b/html/app/models/admin/History_model.php @@ -5,7 +5,7 @@ namespace app\models\admin; use \Registry; -class User_model +class Histrory_model { /** track user access diff --git a/html/app/routes/frontend.php b/html/app/routes/frontend.php index 8ba7b4f..191ce4e 100644 --- a/html/app/routes/frontend.php +++ b/html/app/routes/frontend.php @@ -19,6 +19,9 @@ Route::notFound( function() { }); // 404 +Route::add('/login', function() { Render::view('login'); }); + + // Resolve urls // --- -- -- - - - Route::add('/course/([0-9a-zA-Z-_]*)', diff --git a/html/app/views/login.php b/html/app/views/login.php new file mode 100644 index 0000000..769b660 --- /dev/null +++ b/html/app/views/login.php @@ -0,0 +1,52 @@ + + + + + 404: Not Found + + + + + + +
+
+

Login

+
+
+
+ + +
+
+ + +
+ +
+
+
+ + diff --git a/html/app/views/simple/Render.php b/html/app/views/simple/Render.php index ebe15fc..79a93a0 100644 --- a/html/app/views/simple/Render.php +++ b/html/app/views/simple/Render.php @@ -10,7 +10,7 @@ * * ----------------------------------------------------------------------------- */ -class Render +class Render_example { /** Render::template($data) diff --git a/html/index.php b/html/index.php index d26d0a3..92b825a 100644 --- a/html/index.php +++ b/html/index.php @@ -28,11 +28,19 @@ require_once '../core/config/anom_settings.php'; // core framework constants require_once 'app/config/app_constants.php'; // application constants + // Enable Autoloader // ----------------------------------------------------------------------------- require_once AUTOLOADER; +// Enable sessions +// ----------------------------------------------------------------------------- +$session = new (SESSION_DRIVER)(); // Start a new session + + +// prepare output control and benchmarking +// ----------------------------------------------------------------------------- ob_start(); // handle output if (!PRODUCTION) Benchmark::add_spot('start'); // benchmark request's life @@ -44,11 +52,10 @@ if (!PRODUCTION) Benchmark::add_spot('start'); // benchmark request's life require_once INIT_APPLICATION; - // Application is ready! // ----------------------------------------------------------------------------- -Route::run(Registry::get('REQUEST')); // Run baby, run! +Route::run(Registry::get('REQUEST')); // Run baby, run! if (!PRODUCTION) Benchmark::add_spot('end'); // request ended -- cgit v1.2.3