• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I get disconnected randomly from my login session

Do you have more than one ci site on the server? you may need to add a cookie prefix to avoid collisions and/or use unique cookie names.

ci site 1
Session Variables
$config['sess_cookie_name'] = 'cione';
Cookie Variables
$config['cookie_prefix'] = "appone";

ci site 2
Session Variables
$config['sess_cookie_name'] = 'citwo';
Cookie Variables
$config['cookie_prefix'] = "apptwo";

[quote author="XPerez" date="1347963083"]I had this problem also, and I discovered that the problem was originated by ajax calls, due to a different agent name. Seems that Firefox adds 'ajax' at bottom when detects ajax call, and other browsers make the same.

My solution is to set 'match_useragent' to FALSE.


This I think would not solve the problem. Because we have made that for ajax request it should not update the session anywway. And I have added logging in the if block where it does not match useragent, and log only my requests (not other users), but there are only few such cases, maybe when I login from different browser, don't know.

Quote:Do you have more than one ci site on the server?
I have made some small websites, which were only ones at the server, still was getting disconects.

i am also having the same problem..
i just have to clear the ci_sessions table to make it work normally again..
but sometimes it just randomly disappear again..

so there are no solution yet for this problem?

is this problem occurring with a auth system where logged in users are stored in a sepparate mysql table and session identifier is CI session_id hash?

keevitaja, if I understand what you asked correctly:
I save my users in a "users" table, my session in "ci_sessions".
There are no references between this two tables at all.

how does the auth system know, if user is logged in? you must store this information somewhere...

or you keep users id in session data?

I keep my user id in the session data.
Here's my login function:
function save_session($user) {
  $session_data = array (
   'userid' => $user->user_id,
   'user_first_name' => $user->first_name,

The non logged in users also get some session data (which country they're in, the language, etc). Then if they login I call this one.

sorry, i thought maybe problem is in updated session_id hash, but in your case it clearly is not.

I just don't know how to solve this problem.
Is anyone have a solution? Or simply is anyone know the cause or how to reproduce the bug?
It would be great..

Well since you're out of ideas, perhaps you should try setting $config['match_user_agent'] to FALSE, to see if it makes any difference. Failing that, the problem is most likely to do with your authorisation system, so I would suggest you debug that.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

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