For some reason a user can login with any password, first I thought I forgot to check for the password but I didn't... and I just cant find the problem
here is the model:
/*#######################################################*/
function validate()
/*#######################################################*/
{
$this->db->where('username', $this->input->post('username'));
$this->db->where('password', md5($this->input->post('password')));
$q = $this->db->get('user_extra');
if($q->num_rows() == 1):
return true;
else:
return false;
endif;
}//end of function validate()
The controller
/*#######################################################*/
function validate_credentials()
/*#######################################################*/
{
$this->load->model('membership_model');
$this->load->library('form_validation');
$this->form_validation->set_rules('username', 'Name', 'trim|required');
$this->form_validation->set_rules('password', 'password', 'trim|required');
if(!$this->membership_model->validate()):
$this->form_validation->set_message('check_login', 'Login not correct, please try again.');
endif;
if($this->form_validation->run() == FALSE):
$this->index();
else:
$this->membership_model->userinfo($this->input->post('username'));
//should redirect to last view
redirect($this->session->flashdata('redirect_url'));
endif;
}// end of validate_credentials()