In codeigniter after login I am storing all the data into session and redirecting to forum controller. But I am losing all values in forum controller.
When I try after reducing some values from session it works perfectly.
Now my question is - why this is happening? Is there any upper limit of values to be store in session in codeIgniter?
Even I try to search I found like
redirect('forum', 'refresh');
But it is not working. And my project is half developed so I can't use "PHP Native Session class" of codeignter.
By default CodeIgniter stores the session data in a cookie, which has an upper limit of 4KB in size. If you are trying to store more than 4KB of data in the session you will start running into issues.
The easiest solution is probably to store the session details in the DB. The CodeIgniter session documentation details the process for storing the session in the DB - it's a matter of setting up a table, and changing a couple of config parameters.
The CI session stores everything in a cookie, with optional encryption. So apparently it is possible to reach that limit. That's if you store something like 2K bytes; if it is just login information, that shouldn't be a problem. If you do use something as big as that, well, I guess you shouldn't.
Anyway, I don't think this is the problem, as I had a similar problem (I don't remember the exact cause of this). The solution I found was to use the Native PHP Session class, and added one method to it: all_userdata or whatever it was called. With that, everything worked just like it would with the normal Session (no need to change anything).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With