03-25-2015, 08:56 AM
I am confused with the following coding.
I just read those in a tutorial.
But the login function is actually not returning anything.
So, how does that if condition works here?
I just read those in a tutorial.
PHP Code:
if ($this->user_model->login() == TRUE) {
redirect($dashboard);
}
But the login function is actually not returning anything.
PHP Code:
public function login ()
{
$user = $this->get_by(array(
'email' => $this->input->post('email'),
'password' => $this->hash($this->input->post('password')),
), TRUE);
if (count($user)) {
// Log in user
$data = array(
'name' => $user->name,
'email' => $user->email,
'id' => $user->id,
'loggedin' => TRUE,
);
$this->session->set_userdata($data);
}
}
So, how does that if condition works here?