Hi i am currently building a admin section for my website but i am stuck at a certain point, right now my user authentication is working and my form validation is working great, when i log in as admin i want it to display the admin dash and when a user logs in i want to show the dash but with diffrent links.
So what i want to do now is just modify my current login function to accommodate the diffrent roles here is my login function:
public function do_login()
{
$data['error'] = 0;
if ($_POST) {
$username = $this->security->xss_clean($this->input->post('username', true));
$password = $this->security->xss_clean($this->input->post('password', true));
$user = $this->Login_m->verify($username, $password);
if (!$user) {
$data['error'] = 1;
} else {
$data = array(
'userID' => $user['userID'],
'username' => $user['username'],
'first' => $user['firstName'],
'last' => $user['lastName'],
'logged_in' => true
);
$this->session->set_userdata($data);
redirect(base_url().'admin');
}
}
$data['title'] = "Please Login";
$data['content'] = 'login_view';
$this->load->view('templates/login/template', $data);
}
Please help me solve this, thanks