Welcome Guest, Not a member yet? Register   Sign In
Can't stay logged in!
#1

[eluser]behnampmdg3[/eluser]
Hi;

Why do I get logged out after a few hours?

Code:
$config['sess_cookie_name']  = 'ci_session_GC-Flatmates%^&&#';
$config['sess_expiration']  = 720000;
$config['sess_expire_on_close'] = FALSE;
$config['sess_encrypt_cookie'] = FALSE;
$config['sess_use_database'] = FALSE;
$config['sess_table_name']  = 'ci_session_GC-Flatmates%^&&#';
$config['sess_match_ip']  = FALSE;
$config['sess_match_useragent'] = TRUE;
$config['sess_time_to_update'] = 300;



Code:
$newdata = array('member_id'  => $data['member_details'][0]->member_id, 'logged_in' => TRUE);
$this->session->set_userdata('logged_data', $newdata);



On desktop its a few hours.
On Iphone (even after 2 min), it logs me out.
Thanks
#2

[eluser]behnampmdg3[/eluser]
Anyone?
#3

[eluser]jonez[/eluser]
When you get logged out is it during an AJAX call or browsing from page to page?
#4

[eluser]behnampmdg3[/eluser]
[quote author="jonez" date="1388930981"]When you get logged out is it during an AJAX call or browsing from page to page?[/quote]Page to page redirect url
#5

[eluser]jonez[/eluser]
Did you write your own auth library or what are you using to check login status? I'm assuming you're checking a flag somewhere in your code that does a redir if the session is stale. Try var_dump($this->session->all_userdata()) when the redir occurs.

If you are using cookie sessions you can try enabling DB sessions and see if that makes a difference.
#6

[eluser]Unknown[/eluser]
Sorry - realised this is CodeIgnitor and not EE
#7

[eluser]behnampmdg3[/eluser]
Anyone???? Come on CI forum Smile
#8

[eluser]CroNiX[/eluser]
Code:
$config['sess_cookie_name']  = 'ci_session_GC-Flatmates%^&&#';
try changing it to just 'cisession' with no underscores or anything else.

Code:
$config['sess_time_to_update'] = 300;
Try making that 10 or 15 minutes instead of 5.

This won't have anything to do with it, but generally you want
Code:
$config['sess_encrypt_cookie'] = FALSE;
to be true

Also, what specific version of CI are you using?
#9

[eluser]behnampmdg3[/eluser]
[quote author="CroNiX" date="1389400596"]
Code:
$config['sess_cookie_name']  = 'ci_session_GC-Flatmates%^&&#';
try changing it to just 'cisession' with no underscores or anything else.

Code:
$config['sess_time_to_update'] = 300;
Try making that 10 or 15 minutes instead of 5.

This won't have anything to do with it, but generally you want
Code:
$config['sess_encrypt_cookie'] = FALSE;
to be true

Also, what specific version of CI are you using?[/quote]Hi; Here I changed these:

Code:
$config['sess_cookie_name']  = 'cisessiongcflat';
$config['sess_expiration']  = 720000;
$config['sess_expire_on_close'] = FALSE;
$config['sess_encrypt_cookie'] = TRUE;
$config['sess_use_database'] = FALSE;
$config['sess_table_name']  = 'cisessiongcflat';
$config['sess_match_ip']  = FALSE;
$config['sess_match_useragent'] = TRUE;
$config['sess_time_to_update'] = 600;

I am using CodeIgniter V 2.1.4 (Current version)
#10

[eluser]InsiteFX[/eluser]
FYI:

All the newer web browsers do not like the host being localhost and they may not save there cookies if it is localhost.

To fix the problem you need to move to using VirtualHosts and map your host to dev.com 127.0.0.1 in your host file.






Theme © iAndrew 2016 - Forum software by © MyBB