n00b session problems |
[eluser]pdriessen[/eluser]
I made the follow test controller: Code: <? Code: session_id: 100c0ab06df21aeaa2e4b183ebb22fa8 The output and the error message are correct. The only problem is that when i refresh the page, I get a new session_id number and the previous set test_key had gone... Anybody knows what I do wrong?
[eluser]stommert[/eluser]
hi, the first thing i noticed was a missing constructor with a reference to the controller class. Code: function __construct() { but that was not the question. Do you use a database session? What does your config file look like? You are aware of the fact that the session_id changes every x minutes? I hope these pointers will help
[eluser]pdriessen[/eluser]
I added de constructor... I don't use a database session yet, this is my first try of sessions in CI. I am familiar with sessions in PHP. I didn't autoload the session library. That's why I load it in the beginning of the function. Normally when you create a session in PHP. The session_id stays the same as long as your around on a specific website. It is not usual that you get a new session_id every time you change from page.
[eluser]stommert[/eluser]
hi, check the 'how sessions work' section from this page. it might have some thing to do with your cookie settings in your config file. the way sessions work in CodeIgniter is different from the way they work in 'normal' php, for various reasons (security, scalability). That is why the session_id changes every 5 minutes (by default). I hope you can make it work
[eluser]pdriessen[/eluser]
oh... ok, thanks! That's why I said it was a n00b question. I did everything like in the 'how sessions work' section. But indeed I made a mistake in de config file. Thank you very much! |
Welcome Guest, Not a member yet? Register Sign In |