I have the below code to authenticate user to the application. I have been able to register a user on the system but my authentication code cannot redirect user in to the application after trying to login with the right details. The page only redirects the user back to the login page even though i am using the right user details.
Controller
var $salt = '%&)#$sfsf(abm@009011';
function authenticate() {
$username = $this->input->post('username');
$this->db->where('phone', $username);
$password = $this->db->where('password', md5(crypt($this->input->post('password'), $this->salt)));
$query = $this->db->get('user_login');
if ($query->num_rows = 1) {
//echo "success";
return true;
} else
return false;
}
What else could i be doing wrong in code ? PS: Beginner with CodeIgniter