[eluser]Kraig[/eluser]
This makes no sense....ok first I validate the user login
-Then I check to see if they checked Remember Me..if they did this is the code that runs (it works, because cookies are being added to my browser)
Code:
if($this->input->post('rememberMe') && $this->input->post('rememberMe') == '1')
{
setcookie('username',$username,time()+80);
setcookie('password',md5($password),time()+80);
setcookie('is_logged_in','true',time()+80);
}
-Then as users move from page to page it asks if they are logged in. Here's my function for that:
Code:
// Login check function
public function loggedin()
{
if($this->session->userdata('username'))
{
return true;
}
// Login with cookie
elseif ($this->input->cookie('username', TRUE) && $this->input->cookie('password', TRUE))
{
$username = $this->input->cookie('username', TRUE);
$password = $this->input->cookie('password', TRUE);
$this->load->model('membership_model');
$q = $this->membership_model->validate();
if($q)
{
setcookie('username',$username,time()+80);
setcookie('password',md5($password),time()+80);
setcookie('is_logged_in','true',time()+80);
}
return true;
}else{
return false;
}
}
Why is the elseif in my loggedin() function not working? I know that the cookies are being made by my first code snippet, because I can see them in my browser. However, the loggedin function is not going through, thus leaving a false validation.
I don't think that the CI way of doing cookies
Code:
$this->input->cookie('username', TRUE)
is actually working.