Welcome Guest, Not a member yet? Register   Sign In
[Problem] Session data recreated on each page load
#1

[eluser]ZachM[/eluser]
Hello everyone.

I have been developing a very large commercial project in CodeIgniter starting about a week back after I made the decision to move my old code over to the system, and at first, I thought everything was just magical. The system is wonderful and it is definately a joy to use.

However I have recently hit a roadblock today. After I created another application running under the same CodeIgniter instance (for cross-subdomain session storage), my application has decided to suddenly stop operating normally.

Apparently, every time I load a page in my application a new session ID is created therefore losing an previous data. Now I have tried tons of things under the sun, but maybe the professionals here can give me a helping hand because I really do not want to revert back to my old pre-CI code.

Code:
$config['sess_cookie_name']        = 'ci_session';
$config['sess_expiration']        = 7200;
$config['sess_encrypt_cookie']    = TRUE;
$config['sess_use_database']    = TRUE;
$config['sess_table_name']        = 'ci_sessions';
$config['sess_match_ip']        = FALSE;
$config['sess_match_useragent']    = TRUE;
$config['sess_time_to_update']     = 300;

$config['cookie_prefix']    = '';
$config['cookie_domain']    = '';
$config['cookie_path']        = "/";

A few additional things to note (things I have tried that didn't work):

- Set the session to never expire
- Disabled use database
- Disabled encryption
- Changed the cookie domain
- Changed sess_time_to_update
- Removed the second application and went back to the first application only
- Tried under Chrome, IE, and Firefox
- Changed my cookie path, domain, and prefix settings to mess around with it

If anyone knows the solution, I will be eternally grateful, becuase as you can see I am stumped.
#2

[eluser]ZachM[/eluser]
Not that anyone here cared, but I solved my problem. All I had to do was change the name of the cookie from the default ci_session and then I removed the following code:

Code:
$this->session->sess_destroy();

Because that particular code was somehow producing the effect explained above. Very disastrous, but now that it is fixed all is well.

Cheers.
#3

[eluser]Fabdrol[/eluser]
Where did you remove that line? If you did in your session library, you just destroyed your app.
Cheerio!
#4

[eluser]ZachM[/eluser]
What a funny joke...no, I removed that in my own code.
#5

[eluser]Fabdrol[/eluser]
Still, you'll probably get problems later on.
I've had the same thing a while back, thought I 'fixed' it by getting rid of session destroy...

Result was that the session cookies gotten way to big after a while, somehow piling up stuff from previous, undestroyed, sessons.

cheers!




Theme © iAndrew 2016 - Forum software by © MyBB