CodeIgniter Forums
Increasing cookie's expiration time - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Development (https://forum.codeigniter.com/forumdisplay.php?fid=6)
+--- Forum: CodeIgniter 2.x (https://forum.codeigniter.com/forumdisplay.php?fid=18)
+--- Thread: Increasing cookie's expiration time (/showthread.php?tid=63131)



Increasing cookie's expiration time - _this - 09-29-2015

Hello,

I have an application made using latest CodeIgniter 2 release. I have a custom authentication system linked to an authentication API which is used globally for all our applications. It defines a session and a cookie which have a sess_expiration value of 2 hours (default).

I saw that when I browse (navigating through different controllers) my application for 2 hours long, I get disconnected because the cookie has expired.

Now, what I want is to be able to reset the sess_expiration value to 2 hours, each time a controller is called, but I can't find a method that allow me to do that, and I don't want to destroy the current session to create a new one because it would force me to redefine all userdata, which was set earlier by some of my controllers.

Is that even possible ?

Thanks in advance.

Regards,

$this.


RE: Increasing cookie's expiration time - Narf - 09-29-2015

There's sess_time_to_update, which tells CI how often to re-send the cookie (and refresh the expiration time that way).


RE: Increasing cookie's expiration time - _this - 09-29-2015

Narf,

Thanks to point me in the right direction !

I now understand a lot better how cookie expiration and update works.

I tried with very small values to see the process in action and it now works fine !

But I noticed in my privacy settings that there were a lot of cookies created by my app, each one matching with an update time... Does this means that the "old" cookie (the one which has not yet been updated) is cloned to a new one with higher expiration values ?

Thanks again !