Answer by Mitchell McKenna for Is it possible to regenerate Code Igniter sessions manually?

September 2 2010, 8:46pm

CI automatically regenerates the session id every x seconds, which you can set in your config.

You could create a new function in Session.php the same as sess_update() but with the following removed from the top & the function renamed to regenerate_id().

// We only update the session every five minutes by default if (($this->userdata['last_activity']+$this->sess_time_to_update) >= $this->now) { return; }

This will regenerate the session id, update users_activity and keep the users data. Just call it by $this->session->regenerate_id();