• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Unsuccessful Login

#1
Exclamation 
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
Reply

#2
If the username/password are indeed correct your $this->loginmodel->login() are broken.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2018 MyBB Group.