auth_model = $this->load->model('apps/auth'); } public function index(): void { if ($this->main->session) { $this->redirect('/home'); } else { $this->redirect('/auth/login'); } } public function login(): void { if ($this->main->session) { $this->redirect('/home'); } parent::index(); $data = $this->auth_model->get_data(); $this->view('header_empty', $data); $this->view('apps/auth/login', $data); $this->view('footer', $data); } public function logout(): void { if ($this->main->session) { $_SESSION['jwt'] = NULL; } $this->redirect('/auth/login'); } public function update(): void { if (!$this->is_ajax()) { $this->error(400); } if (!isset($_POST['key']) || !isset($_POST['value'])) { $this->error(400); } $key = $_POST['key']; $value = $_POST['value']; $_SESSION[$key] = $value; } } ?>