CodeIgniter Forums
Session ID not regenerating - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=11)
+--- Thread: Session ID not regenerating (/showthread.php?tid=70449)



Session ID not regenerating - gloosemore - 04-10-2018

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


RE: Session ID not regenerating - InsiteFX - 04-11-2018

sess_expiration = Time in seconds (integer)

You are saying 60 seconds which is 1 minute.

For 15 minutes the sess_expiration = 900


RE: Session ID not regenerating - Narf - 04-11-2018

Regeneration is intentionally skipped for AJAX requests.


RE: Session ID not regenerating - dave friend - 04-11-2018

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

Why is that?


RE: Session ID not regenerating - Narf - 04-12-2018

(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.


RE: Session ID not regenerating - dave friend - 04-12-2018

(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