load->database(); $this->load->model('user_model'); $this->load->model('authAssignment_model'); } public function login($error = NULL) { if ($this->session->userdata('is_login') == true) { redirect('site/dashboard'); } if ($this->input->post()) { $this->form_validation->set_rules('username', 'Username', 'trim|required|min_length[5]|max_length[50]'); $this->form_validation->set_rules('password', 'Password', 'trim|required|min_length[5]|max_length[22]'); $is_check = $this->check_account(); if ($this->form_validation->run() && $is_check === true) { $this->user_model->last_login($this->session->userdata('id'), $this->session->userdata('__ci_last_regenerate')); redirect('site/dashboard'); } } $data['error'] = $error; $data['title'] = 'Login'; $data['js_page'] = $this->js_page; $data['breadcrumbs'][] = ''; $this->load->view('site/login', $data); } public function dashboard($error = NULL) { $data['error'] = $error; $data['title'] = 'Dashboard'; $data['breadcrumbs'][] = ['label' => 'Dashboard', 'active' => 'active']; $data['main_content'] = 'site/dashboard'; $this->load->view('layouts/main_layout', $data); } public function check_account() { $username = $this->input->post('username'); $password = $this->input->post('password'); $query = $this->user_model->check_account($username, $password, false); if ($query === 1) { $this->session->set_flashdata('alert', '