[eluser]Pascal Kriete[/eluser]
It's pretty simple - if your validation looks like this:
Code:
$rules['username'] = "trim|required|max_length[20]|xss_clean";
$rules['password'] = "required|callback_checkLogin";
You would make a checkLogin function that looks like this:
Code:
function checkLogin($pw)
{
$this->load->model('User_model');
$un = $this->input->post('username');
if($this->User_model->checkCredentials($un, $pw))
{
$this->session->set_userdata('logged_in', TRUE);
return true;
}
else
{
$this->validation->set_message('checkLogin', 'Credentials do not match.');
return false;
}
}
Then in your internal pages you would check if the session data is set to true - and if it isn't you would redirect.