Welcome Guest, Not a member yet? Register   Sign In
Sessions disappearing?
#1

[eluser]@li[/eluser]
Hi, I'm using the CodeIgniter session library, storing the sessions to the database.

I have a strange problem, whenever I set a session and redirect a user, using:

Code:
$this->session->set_userdata('foo', 'bar');

I'm able to access this variable just fine the first time around, but if I do a page refresh this session value is gone.. what's the reason behind this?

Edit: It seems that in config.php, changing this:


Code:
$config['sess_expiration']        = 7200;
to this:

Code:
$config['sess_expiration']        = 0;

fixes this issue, even though if the variable is set to 7200, that should mean that the session would be active for 7200 seconds (i.e 2 hours) while it actually disappears with each page load.
#2

[eluser]InsiteFX[/eluser]
There could be a number of things that are causing this.

1) Your server time could be off, check your server time!
2) Your browser is not setup for all cookies, check your browser cookie settings.
3) If your running IE then you need to change the cookie name from ci_session to cisession

InsiteFX
#3

[eluser]@li[/eluser]
I'm using chrome and this is on my dev machine with windows XP, the time is correct and cookies are enabled. Does the cookie name have to be changed with chrome?
#4

[eluser]WanWizard[/eluser]
No, but it needs to be configured in accordance with the RFC. Chrome is getting stricter by the minute, and rejects all cookies that are not compliant.

This means for example that you can't use 'localhost' as cookie domain, as it is illegal per the RFC.
#5

[eluser]Ninjabear[/eluser]
[quote author="@li" date="1302672382"]I'm using chrome and this is on my dev machine with windows XP, the time is correct and cookies are enabled. Does the cookie name have to be changed with chrome?[/quote]

Did you ever get this one sorted out @li?
#6

[eluser]cideveloper[/eluser]
[quote author="Ninjabear" date="1305053923"][quote author="@li" date="1302672382"]I'm using chrome and this is on my dev machine with windows XP, the time is correct and cookies are enabled. Does the cookie name have to be changed with chrome?[/quote]

Did you ever get this one sorted out @li?[/quote]

I really wish people would close out their threads if they have figured out their problems. Also if they do get an answer they like they should say so. That way people would know if an answer given was correct and helped. Why do you ask, Ninjabear?
#7

[eluser]InsiteFX[/eluser]
Add [SOLVED] in Post Title

InsiteFX
#8

[eluser]Ninjabear[/eluser]
[quote author="InsiteFX" date="1305072110"]Add [SOLVED] in Post Title

InsiteFX[/quote]

Doh




Theme © iAndrew 2016 - Forum software by © MyBB