How works 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: How works sessions ? (/showthread.php?tid=52421) |
How works sessions ? - El Forum - 06-10-2012 [eluser]Vadorequest[/eluser] Hi, I'm sorry for my bad english, I'm French. I don't understand how works the CI sessions. (I autoload the 'session' library) When I will change the current language in my website and the language used is invalid I do: Code: add_error('La langue sélectionnée est incorrecte ou non gérée.'); The add_error function is defined in helpers/error_helpers.php: Code: /** If I do Code: var_dump($CI->session->all_userdata()); But, if after, in my view, I do: Code: <?php $CI =& get_instance(); echo "<pre>";var_dump($CI->session->all_userdata());?> He displayed only the basic session data (user agent, etc.) others vars has been destroyed. In my BDD I have: session_id: f17c49e7aafa6734d03d5666ea01eeca user_data: a:2:{s:9:"user_data";s:0:"";s:6:"errors";a:1:{i:0;a:2:{s:7:"message";s:55:"La langue sélectionnée est incorrecte ou non gérée.";s:9:"displayed";b:0;}}} But the current session_id is not: f17c49e7aafa6734d03d5666ea01eeca After every refresh my session_id changes. Normally ? This my current config in config/config.php: Code: $config['sess_cookie_name'] = 'ci_session'; Can you help me ? Thanks. How works sessions ? - El Forum - 06-10-2012 [eluser]web-johnny[/eluser] You have tho change the Code: $config['sess_expiration'] = 0; to a numeric value. For example: Code: $config['sess_expiration'] = 500; How works sessions ? - El Forum - 06-10-2012 [eluser]Vadorequest[/eluser] In the doc (under $config): | 'sess_expiration' = the number of SECONDS you want the session to last. | by default sessions last 7200 seconds (two hours). Set to zero for no expiration. I've 300 before but I've changed after, no change I think. I test again. How works sessions ? - El Forum - 06-10-2012 [eluser]Vadorequest[/eluser] $config['cookie_prefix'] = ''; $config['cookie_domain'] = ''; $config['cookie_path'] = '/'; It's better as that ^^ Before I have config with vars but it's do a problem. But I've always a problem... My BDD is updated with local session php but my vars in user_data as been destroyed >< user_data also. Code: array(4) { The key 'user_data' is not exists. But in BDD I've: Code: a:2:{s:9:"user_data";s:0:"";s:6:"errors";a:1:{i:0;a:3:{s:7:"message";s:46:"La langue sélectionnée n'est pas autorisée.";s:9:"displayed";b:0;s:4:"type";s:5:"error";}}} If I do var_dump just after I've update the session php I have: Code: array(5) { But my key 'errors' dissapear after a new load page. Thanks for your help. |