auth_model = $this->load_model('auth'); $this->load_lang('auth'); } public function index(): void { $this->load_controller('index')->index(); } public function login(): void { if ($this->auth_model->session()) $this->redirect('/home'); parent::index(); $data = $this->auth_model->get_data(); $this->view('head', $data); $this->view('auth/main', $data); $this->view('footer', $data); } public function logout(): void { if ($this->auth_model->session()) $_SESSION['jwt'] = NULL; $this->redirect('/auth/login'); } public function update(): void { $key = $this->post_data('key'); $value = $this->post_data('value'); if (!$key || !$value) $this->error(400); $_SESSION[$key] = $value; } } ?>