I am new to codeIgniter but I am facing a challenge with login functions.
Look at the code below and advice; This is my logincontroller
<?Php
class Logincontroller extends CI_Controller{
public function index(){
$this->load->view('login');
}
public function checklogin(){
$this->form_validation->set_rules('username', 'Username', 'required');
$this->form_validation->set_rules('password', 'Password', 'required|callback_verifyuser');
if ($this->form_validation->run()==false) {
$this->load->view('login');
}else{
redirect('homecontroller/index');
}
}
public function verifyuser(){
$username=$this->input->post('username');
$password=$this->input->post('password');
$this->load->model('loginmodel');
if($this->loginmodel->login($username,$password)) {
return true;
}else{
$this->form_validation->set_message('verifyuser', 'Incorrect Username or Password. Please try again');
return false;
}
}
}
?>
I use correct login details but it returns this error message "I 'Incorrect Username or Password. Please try again'
Any advice
Thanks