Welcome Guest, Not a member yet? Register   Sign In
Sessions Issue
#1

[eluser]Haydenzone[/eluser]
Hello all,

I'm running into issues using CI's session class when using it on my school's development servers. It seems that cookies for the sessions are being created, but they just aren't being retrieved by the server. The code is located in a subdirectory, but the base domain is "dev.mcs.sdsmt.edu".

Here is the code for setting the user data for the session:

Code:
$result = $this->user->getUser($username); //User model
$this->session->set_userdata($result[0]);
redirect('/dashboard/index','refresh');

Here's my config file for sessions and cookies:

Code:
$config['sess_cookie_name']  = 'cisession';
$config['sess_expiration']  = 7200;
$config['sess_expire_on_close'] = FALSE;
$config['sess_encrypt_cookie'] = FALSE;
$config['sess_use_database'] = FALSE;
$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'] = ".mcs.sdsmt.edu";
$config['cookie_path']  = "/";
$config['cookie_secure'] = FALSE;

Any help is greatly appreciated. Thanks in advance!
#2

[eluser]InsiteFX[/eluser]
See cookie_path add the sub-directory there!
#3

[eluser]skunkbad[/eluser]
It should be noted that many questions about sessions in the last few weeks were dealing with setting cookie data immediately before a redirect, and that not working well with all browsers. The php documentation says that you should set the cookie after the redirect. See docs on setcookie.
#4

[eluser]Haydenzone[/eluser]
I think I figured it out. It had nothing to do with the server that I was running on. For some reason, the session did not like the array that I passed to it from the model.

Thanks for your help guys!!
#5

[eluser]Chathuranga Tennakoon[/eluser]
change sess_expiration value as follows

Code:
$config['sess_expiration']  = 0;






Theme © iAndrew 2016 - Forum software by © MyBB