From: Sam White Date: Wed, 10 Nov 2021 21:01:55 +0000 (+0000) Subject: Add mechanism to check user logged in status. X-Git-Url: https://git.dalvak.com/public/?a=commitdiff_plain;h=e57c37981242b05bc3e8dcaf610fe34845c5765b;p=ycra.git Add mechanism to check user logged in status. --- diff --git a/public_html/includes/auth.php b/public_html/includes/auth.php new file mode 100644 index 0000000..3b1608e --- /dev/null +++ b/public_html/includes/auth.php @@ -0,0 +1,6 @@ + diff --git a/public_html/includes/template.php b/public_html/includes/template.php index 38ab376..2371f75 100644 --- a/public_html/includes/template.php +++ b/public_html/includes/template.php @@ -2,6 +2,8 @@ require_once('includes/utils.php'); require_once('includes/html-templating.php'); require_once('includes/navbar.php'); + +if (function_exists('pre_html')) pre_html(); ?> diff --git a/public_html/login.php b/public_html/login.php index 022ddeb..36c1b39 100644 --- a/public_html/login.php +++ b/public_html/login.php @@ -24,6 +24,10 @@ function validate_login(&$errors, $data) { return empty($errors) ? $record['id'] : false; } +function pre_html() { + session_start(); +} + function page_title() { return 'Login'; } @@ -38,7 +42,8 @@ function content() { $uid = validate_login($errors, $_POST); if ($uid) { esc('Login successful!.'); - die(); + $_SESSION['user'] = $uid; + return; } $params['email_address'] = $_POST['email_address']; }?>