Welcome Guest, Not a member yet? Register   Sign In
Re-loading library?
#5

[eluser]guidorossi[/eluser]
I thought that the cookies created by set_cookie should be independent of the $config...

I've tryied turning expire on close to FALSE but it only affects the ci_session cookie and not the other one...

Anyway, I've solved this issue by using the native PHP setcookie() insted of set_cookie...

Code:
private function set_remember_me($id)
    {
        $this->ci->load->library('encrypt');

        $token = md5(uniqid(rand(), TRUE));
        $expire = time()+60*60*24*7; // Set the remember cookie for a week

        $remember_code = $this->ci->encrypt->encode(serialize(array($id, $token, $expire)));

        $cookie = array(
            'name' => 'rememberme',
            'value' => $remember_code,
            'expire' => $expire
        );

        // For DB insertion
        $cookie_db_data = array(
            'id' => $id,
            'remember_code' => $token
        );
        
        //$this->ci->input->set_cookie($cookie);
        
        setcookie('rememberme', $remember_code, $expire);
        
        $this->ci->auth_model->edit_user($cookie_db_data);
    }


Messages In This Thread
Re-loading library? - by El Forum - 04-04-2011, 11:08 PM
Re-loading library? - by El Forum - 04-04-2011, 11:34 PM
Re-loading library? - by El Forum - 04-05-2011, 01:15 PM
Re-loading library? - by El Forum - 04-05-2011, 11:00 PM
Re-loading library? - by El Forum - 04-05-2011, 11:39 PM



Theme © iAndrew 2016 - Forum software by © MyBB