![]() |
CI Sessions - No user data - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: CI Sessions - No user data (/showthread.php?tid=40065) |
CI Sessions - No user data - El Forum - 03-29-2011 [eluser]robjstanley[/eluser] Hey, I have a problem to do with CI Sessions. I have a login section which creates a users login and all is fine while under the userpanel controller. If a user clicks outside that controller, say for instance back to home a new session gets generated with all the same information such as browser, ip etc but no user data. The problem with this is that this session seems to take over the previous and i have no access to the user who is logged in as the session userdata is null. Ive been trying to figure out why CI is creating this session and where it could be coming from but i have no idea. Has anyone experienced something like this before? or any tips on resolving or finding problem. Any help would be greatly appreciated. CI Sessions - No user data - El Forum - 03-29-2011 [eluser]robjstanley[/eluser] Even if there was a way to work out where the session is being set i could find the problem but if i remove all sections of my code where a session is set i still find it creates one. CI Sessions - No user data - El Forum - 03-29-2011 [eluser]toopay[/eluser] Have you check your configuration of "Session Variables" section at your config file? CI Sessions - No user data - El Forum - 03-29-2011 [eluser]robjstanley[/eluser] Code: $config['sess_cookie_name'] = 'ci_session'; that is what i have set. CI Sessions - No user data - El Forum - 03-29-2011 [eluser]robjstanley[/eluser] Is there something i'm missing or do sessions in CI not spread over all controllers? it only works over the controller it was initialised in. CI Sessions - No user data - El Forum - 03-29-2011 [eluser]toopay[/eluser] are you set your session in autoload? CI Sessions - No user data - El Forum - 03-29-2011 [eluser]robjstanley[/eluser] Yes CI Sessions - No user data - El Forum - 03-29-2011 [eluser]toopay[/eluser] so, that must answer your question "...but if i remove all sections of my code where a session is set i still find it creates one." Now, your problems i believe is : whenever you attempt to save some variable to session userdata, it simply not save that. Hmm, i've experiencing same issues several month ago, and i found something wrong with my server host (in other word, environment issues). The session lib only work if i set $config['sess_expiration'] to '80000' or simply '0'. CI Sessions - No user data - El Forum - 03-29-2011 [eluser]robjstanley[/eluser] I don't think you understand what i mean. CI is creating a session, without me actually typing Code: $this->session->set_userdata(); CI Sessions - No user data - El Forum - 03-29-2011 [eluser]toopay[/eluser] I know what you mean. If you setting session in autoload, that mean everytime you load a controller, CI will create a session, with minimal data (ip address, browser, sess id, ts). userdata, is different problems. You using $this->session->set_userdata(), to save some variable in session array section, which called 'userdata'. And in your case, everytime you attempt to save some variable in it, failed. Right? |