CodeIgniter Forums

Full Version: Using session ID as foreign key for temporary rows, too volatile since 3.x?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
We are using the session ID to piggyback off of the session GC. Search results have a column linking them to the current session, the idea was to have the user have access to those rows during his session and when the sessions get cleaned so do the search results. This has worked pretty well in CI2.x the past years, but since upgrading to 3.x the session ID seems to be more volatile and it changes during a request, before being added to the sessions table (causing foreign key errors when inserting)
I'm starting to think this is not a reliable value to link to anymore.

Can we utilise the 'sess_time_to_update' config setting to get the desired behaviour or should I start investigating a different way of tracking "while a user is logged in"? (FYI we use Ion_auth for authentication)

Thanks in advance,
Alex
Why not just create your own id and store it in the session?
(09-14-2018, 03:13 AM)InsiteFX Wrote: [ -> ]Why not just create your own id and store it in the session?

I could, but I'd have to do my own garbage collection instead of being able to rely on foreign key rules.