load->helper('cookie'); $this->load->library('session'); } public function index() { $user_info = $this->session->userdata('userInfo'); if ($user_info) { redirect('/frontend/lecture'); }else{ $this->load->view ( 'home'); if (isset($_POST['submit'])){ $this->signin(); } } } public function test() { if (isset($_POST['submit'])){ $this->signin(); } } public function signin() { $username = $this->input->post('username', TRUE); $password = $this->input->post('password', TRUE); $token = md5($username.self::TOKENPW); $this->load->model(array('user_model')); $data = $this->user_model->checkLogin('violet', $token, $username, $password); $arr_users = explode("&", $data); $str_status = ""; $str_fullname = ""; $fullname = ""; for ($i=0; $i $username, "logined_in" => TRUE); $this->session->set_userdata('userInfo', $userdata); redirect('/frontend/lecture'); break; case 1: echo "Thiếu thông tin đăng nhập !"; break; case 2: echo "Sai username hoặc password !"; break; case 3: echo "Sai username hoặc password !"; break; case 4: echo "Tài khoản chưa được Activated"; break; case 10: echo "Sai Token"; break; default: break; } } public function signout() { } public function lectureeditor() { $user_info = $this->session->userdata('userInfo'); if ($user_info){ $this->load->view('lecture_editor'); }else { redirect('/frontend/home/'); } } } /* End of file home.php */ /* Location: ./application/modules/frontend/controllers/home.php */