Not redirecting to dashborad after login in codeigniter -
Not redirecting to dashborad after login in codeigniter -
i have got login issue sorted out. have got 1 issue when login not redirecting dashboard page redirect('dashboard)
right reason loads login page.
the sessions logged on.
sessions showing have sessions showing on login , dashboard see weather logged.
array ( [session_id] => ************** [ip_address] => ************** [user_agent] => ************** [last_activity] => ************** [user_data] => [islogged] => 1 [username] => admin )
controller login
public function index() { $this->load->library('users'); $this->load->library('form_validation'); $this->form_validation->set_rules('username', 'username', 'required'); $this->form_validation->set_rules('password', 'password', 'required'); if ($this->form_validation->run() == false) { $data['action'] = site_url("login"); $this->load->view('template/common/login', $data); } else { if($this->users->login() == false) { $data['action'] = site_url("login"); $this->load->view('template/common/login', $data); } else { $data = array( 'islogged' => true, 'username' => $this->input->post('username') ); $this->session->set_userdata($data); redirect('dashboard'); } } }
i have fixed own issue on got every thing working fine now. little problem in library file , on login controller.
public function index() { $this->form_validation->set_rules('username', 'username', 'required'); $this->form_validation->set_rules('password', 'password', 'required'); if($this->form_validation->run() == false) { $data['action'] = site_url('login'); $this->load->view('template/common/login', $data); } else { if($this->users->login() == true) { redirect('dashboard'); } else { $data['action'] = site_url('login'); $this->load->view('template/common/login', $data); } } }
codeigniter
Comments
Post a Comment