diff --git a/src/classes/page.php b/src/classes/page.php index d59da4c4..118d5e84 100644 --- a/src/classes/page.php +++ b/src/classes/page.php @@ -215,4 +215,62 @@ class Page +
+ + + + +
+ +
+ + + +

+ +
+
+ message($content, $header, 'error'); + } + + public function warning(string $content, string $header = ''): void + { + $this->message($content, $header, 'warning'); + } + + public function info(string $content, string $header = ''): void + { + $this->message($content, $header, 'info'); + } } diff --git a/src/pages/login.php b/src/pages/login.php index 1e39d725..3ab019ac 100644 --- a/src/pages/login.php +++ b/src/pages/login.php @@ -1,7 +1,7 @@ */ @@ -25,9 +25,9 @@ if (isset($_POST['email'], $_POST['password'])) { AND `password` = "' . $password . '";' )->fetch(); - if (false === $user) { - # code... - } else { + $success = false !== $user; + + if ($success) { $_SESSION['user'] = $user; } } @@ -44,6 +44,12 @@ $page->navigation();

title ?>

+ error('Invalid credentials!', 'Error'); + } + ?> +