Welcome Guest, Not a member yet? Register   Sign In
CI session
#1

[eluser]griffithtp[/eluser]
Does CI 1.7 session library actually work?

I have created my session table (session_id, ip_address, user_agent, last_activity, user_data) and when set userdata with $this->session->set_userdata('logged_user', $username) it stores in the db table fine as serialized string but cannot get it back using $this->session->userdata('logged_user').
I then thought I should call $this->session->userdata('user_data') and deserialize it but still is empty.

I also noticed when a page request is sent (i.e. refresh or going from login page to landing page) a new session is created and stored in db table.
I'd guess that's probably why I never can get my custom userdata session back?
Is this a reported bug in CI 1.7 or is it just me being dum?
#2

[eluser]griffithtp[/eluser]
Okay after I went back into Session.php in the /system/libraries I noticed the local variables don't take the configs properly from config.php
Having taken out and left default empty config, it works again..
Need to update Session.php to take config.php settings?
#3

[eluser]Rey Philip Regis[/eluser]
If your asking if CI 1.7 Session library works, well all I can say is that it really works. Cause Ive used it somehow for a day haha. Well, I have a certain data that is needed to store in a session, so I used CI session library but I found out that it only hold 4kb of data and is not practical to use it in my application, so I used PHPSession library.

Good day.
#4

[eluser]simshaun[/eluser]
[quote author="Rey Philip Regis" date="1227668128"]If your asking if CI 1.7 Session library works, well all I can say is that it really works. Cause Ive used it somehow for a day haha. Well, I have a certain data that is needed to store in a session, so I used CI session library but I found out that it only hold 4kb of data and is not practical to use it in my application, so I used PHPSession library.

Good day.[/quote]

Were you storing sessions in the database (new in 1.7) or in a cookie (pre 1.7 behavior)?

Database is capable of handling MUCH more than 4kb of data.
Its the cookies that can't.
#5

[eluser]kirrie[/eluser]
I think your session expiration time is not enough long to hold sessions. check $config['sess_expiration'] setting in config.php. and check this too, http://ellislab.com/forums/viewthread/70036/
#6

[eluser]manilodisan[/eluser]
I can confirm that something's wrong with CI's session lib. We often get kicked out when sending multiple requests at once or random. I'm not sure why...
#7

[eluser]Padraig Kennedy[/eluser]
We have been experiencing random log outs, particularly on some of our more AJAX heavy pages that make multiple requests per second.

The problem occurs if a request is made while another request is causing sess_update() to run. The database gets updated with the new session ID, but sess_read() has already pulled the old session ID from the cookie, which has not yet been updated. sess_read() tries to find the old session ID in the database, fails, and then destroys the session.

This can be recreated by using the database for sessions, setting $config["sess_time_to_update"] very low and making multiple requests.

The quick solution is to set $config["sess_time_to_update"] very high, but that's a bad call for security reasons. A better fix would be for the Session class to keep the old session records around for an additional few seconds before removing them.
#8

[eluser]Ty Bex[/eluser]
CI 1.7.0
Everytime my page refreshes I get a new session.
I don't know if this a bug or what. But so far CI sessions are not working for me.
Anyone else experience this?
#9

[eluser]Ricardo Rodrigues[/eluser]
I have the same problem as reported in first post.

If I reload my login view I see all session userdata correct but when I redirect to mainpage everything disappear.

If I disable DB session, it works.

Can you detail what local variables do you have changed?
#10

[eluser]lectrotext[/eluser]
I've been experiencing similar dropped sessions. I am not using the DB solution, but instead session cookie. I am typically allowing a user to set a session/"remember me" for a month. However upon coming back to the site the next day the session_cookie is still there, but the userdata is gone. I've upped the sess_time_to_update to equal the actual cookie expiration. I will report back on that within the next couple of days.




Theme © iAndrew 2016 - Forum software by © MyBB