• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Lost session

[quote author="Derek Allard" date="1206646403"]Hi Mike.

Looking I don't see anything off hand. Where does $acl come from? Does it behave this way in all browsers? Have you tried another server by chance?[/quote]

Well.. acl comes from the database which I omitted. I didn't include the part where it gets the username and password then check db, etc ..

I will try a different server to see if server configuration is the cause of this problem.

Well ..it works fine using php session, I guess I will have to use that then .. haha.

I also experienced problems with CI session when I tried to set session variables before redirect. Then I tried Native Session library and had no problems so far. Hope this helps.

[eluser]Derek Allard[/eluser]
I'm glad you both have a solution. While you aren't the first I've seen to report this, to my knowledge nobody has ever been able to tell me why their setup doesn't work. If either of you track down why, please do let me know.

Well .. I upgraded my codeigniter to the most current one (I was using 1.5.4 before) and the problem was still there. So it has nothing to do with the version and I did tested it on a different server as well .. still no go.

So for now, I will stick with native session library for this project .. will try again later when I have time.



Although it's an old thread, I thought I should add something to it as I did come across this thread while looking for a solution to a similar problem.

Our resolution was different though.

It turns out that in CI's session library, by default a CI cookie for http://thedomain.com is not a cookie for http://www.thedomain.com.

We have run in this scenario where some people would login on the site through http://www.thedomain.com.

Then in some places of the site, they would be redirected to http://thedomain/something/ and find themselves logged out, which puzzled us for a while trying to solve it.

If that is your case you must modify the config file's cookie configuration to:

$config['cookie_domain'] = '.thedomain.com';

and problem solved.


I faced a problem with lost session too. Its happened after I reload my database from another server but now I don't understand why - table "partner_session" used for sessions saving doesn't changed so I think that is not a reason. Code is a kind of:
function __construct() {
  $this->project = $this->session->userdata('project');
  $this->service = $this->session->userdata('service');

function select() {
  $id = $this->uri->segment(3);
  if ($this->project = $this->Project->get_by_id($id)) {            
    $this->service = $this->Service->get_by_id($this->project->service_id);
    $this->session->set_userdata('service', $this->service);
    $this->session->set_userdata('project', $this->project);
Userdata from session doesn't loading! Is this a really CI's bug?..

UPD: log

ERROR - 2008-05-28 23:37:07 --> Severity: Notice --> unserialize() function.unserialize: Error at offset 1062 of 1626 bytes Z:\home\partner.mobistic.l\system\libraries\Session.php 215
ERROR - 2008-05-28 23:37:07 --> The session cookie data did not contain a valid array. This could be a possible hacking attempt.

just an idea... clear all your cookies, I think.

I've had a similar problem when I switched on the cookie encryption. Old cookies wouldn't be recognised.. causing that kind of error.

hope that helps


I've already done this, and it doesn't helped.. And when I switch in config to use or not to use database or encryption, a problem is still there.

I have _almost_ two identical databases, "sms" and "newsms". When I use first, all is ok. When I switch to second in database config, there is a lost session. And so, when I store only $this->partner variable in session, its ok. But when I save there also a $this->project and $this->service variables and do a redirect() after this, ALL session data is lost!

I to have had many problems with the CI session library. I made a post here a while back that was causing some of my original problems.


I have since removed the db sessions in order to solve that problem as stated in the post.

I have a site right now that has close to 2,000 users. For most of the users the site/session function correctly but for a small subset of those users IE will not accept the cookie CI is attempting to set....

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.