Welcome Guest, Not a member yet? Register   Sign In
Why does the session id keep changing?
#1

[eluser]mvdg27[/eluser]
Hi,

I'm working with the session class, and I notice that the session id keeps changing. I'd actually prefer (or better I need) the session id to stay the same, once assigned. Can this behavior be changed?

Thanks is advance.

-Michiel
#2

[eluser]Pascal Kriete[/eluser]
How often it happens is dedicated by the 'sess_time_to_update' config value. The default is 300 seconds. Increasing that would work, but it's not a very safe practice.

Can you elaborate on the problem? What prevents you from setting your own persistent value?
Code:
$this->session->set_userdata('uid', $userid);
#3

[eluser]mvdg27[/eluser]
Hi Imparo,

hmm .. do I feel stupid now!! I was indeed using the session id as an identifier in my database for the user. But off course I can create a unique code myself. The thought just never crossed my mind :S

Anyway, this solves my problem completely!! Thanks a lot!

Michiel
#4

[eluser]ray73864[/eluser]
i am creating a shopping cart system and instead of using the session itself for storing the cart, i store it in the database, after realising that every 5mins the cart was disappearing for some reason, i now create a 'fancy_session_id' which is basically just an md5() of time()+time() 'md5(time()+time())' and use that for the cart, then when the user logs in, i assign the cart to their userid.




Theme © iAndrew 2016 - Forum software by © MyBB