Welcome Guest, Not a member yet? Register   Sign In
Can someone please explain this?
#1

[eluser]35mm[/eluser]
Why is the cookie expiry time not setting? They are being set to expire at the end of browser session. Basically time()+xxxxx is failing. If I enter an actual number it works. This is running in a model. Is there some reason why time()+xxxx won't work in a model? Been staring at this for to long!
Code:
// set cookies
  if($remember === TRUE){
                    $cookie_expire = time()+2419200; // 1 month
  }else{
                    $cookie_expire = time()+10800; // 3 hrs
  }
                // user cookie
                $user_username = $session_new['username'];
                $this->load->library('user_agent');
                $new_useragent = $this->session->userdata('user_agent');
                $user_ID = $session_new['user_id'];
                $cookie_user = array(
                    'name'   => 'user',
                    'value'  => md5($user_username) . '_' . $user_ID . '_' . $cookie_expire . '_' . md5($new_useragent),
                    'expire' => $cookie_expire
                );
                $this->input->set_cookie($cookie_user);
#2

[eluser]Aken[/eluser]
Quote:The expiration is set in seconds, which will be added to the current time. Do not include the time, but rather only the number of seconds from now that you wish the cookie to be valid. If the expiration is set to zero the cookie will only last as long as the browser is open.




Theme © iAndrew 2016 - Forum software by © MyBB