views:

24

answers:

1

Hi everyone,

As above: Is it possible to regenerate Code Igniter sessions manually? I'm looking for something similar to session_regenerate_id in PHP sessions, so that I could call it manually when a user went through privilege escalation.

Thanks,

Lemiant

+3  A: 

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();

Mitchell McKenna
Thank You for your response.
lemiant

related questions