Sessions....... :( - 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: Sessions....... :( (/showthread.php?tid=1730) |
Sessions....... :( - El Forum - 06-22-2007 [eluser]Unknown[/eluser] I am taking a stab at CI, and I have hit a bit of a wall. I created a user login function in my user controller, and it works dandy right up until I navigate away from the landing after sucessfully authenticating. My sessions disapear. I will be using sessions to secure pages, so if your session user id value is not populated then you will be redirected to log in. Anyhow here is what I have. Code: function login() Sessions....... :( - El Forum - 06-23-2007 [eluser]Flayra[/eluser] As far as I can see there's nothing wrong with your code. However, I suggest you set the Session library to autoload (in config/autoload.php) since you need it on every page to keep the sessions running - that might be why it disappears after leaving this page. Sessions....... :( - El Forum - 07-07-2007 [eluser]Doosje[/eluser] Same here, Whenever i use the redirect / header function .. my session is initialized all over again. It looses the 'userdata' section somehow. I;ve loaded session in the autoload btw. using: PHP VERSION 5.2.1 & Apache 2.0 CI->1.5.3 update: i've made a error .... my fault ..forget my post .. Sessions....... :( - El Forum - 07-07-2007 [eluser]Developer13[/eluser] I came across what I believe to be is a similar issue to yours with one of my applications... but it would only happen on a specific server and sometimes the problem would exist and other times it wouldn't (don't ask -- I don't know!). Anyhow, I would recommend setting the following in your system/application/config/config.php: $config['cookie_prefix'] = "http://www"; $config['cookie_domain'] = ".domainnamehere.com"; $config['cookie_path'] = "/"; That might solve your problem. |