Welcome Guest, Not a member yet? Register   Sign In
Session ID not regenerating
#1

Hey

I'm having problems with the session ID not regenerating. This is my config

Code:
$config['sess_driver'] = 'database';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 60; // 15 minutes
$config['sess_save_path'] = 'ci_sessions';
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 30; // 5 minutes
$config['sess_regenerate_destroy'] = TRUE;

I set it to really short timeframes for experimentation. When I register a user, I set a session variable called user_id then load a different page. At registration the output for session variables is

Code:
session_id() = kvrphe8...
timestamp (from ci_sessions) = 1523413499
user_id = user87B...
If i wait exactly 40 seconds then query these same variables via ajax (without reloading the page), I get

Code:
session_id() = kvrphe8...
timestamp (from ci_sessions) = 1523413499
user_id =user87B...

Why isn't the session id regenerating after 30 seconds? If i wait more than 60 seconds the session is destroyed as expected, and the session_id() changes. But shouldn't it change every 30 seconds in this instance? I would also expect the session to be destroyed at 30 seconds because sess_regenerate_destroy = TRUE, but that obviously isnt happening either.

Thanks
Reply
#2

sess_expiration = Time in seconds (integer)

You are saying 60 seconds which is 1 minute.

For 15 minutes the sess_expiration = 900
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#3

Regeneration is intentionally skipped for AJAX requests.
Reply
#4

(04-11-2018, 05:08 AM)Narf Wrote: Regeneration is intentionally skipped for AJAX requests.

Why is that?
Reply
#5

(04-11-2018, 12:24 PM)dave friend Wrote:
(04-11-2018, 05:08 AM)Narf Wrote: Regeneration is intentionally skipped for AJAX requests.

Why is that?

Because people don't understand how sessions work, use way more AJAX than they need and then complain about lost sessions in the process.
Reply
#6

(04-12-2018, 03:56 AM)Narf Wrote: Because people don't understand how sessions work, use way more AJAX than they need and then complain about lost sessions in the process.

Thanks, that's what I thought and would a little technical detail be possible. thx
Reply




Theme © iAndrew 2016 - Forum software by © MyBB