Welcome Guest, Not a member yet? Register   Sign In
session problems
#1

[eluser]smick[/eluser]
Hello, I've been using Codeigniter for a while and it seems every time I go to do a new install I run into the problem of sessions not working.

I've got everything set identically to other sites I've used sessions on but for whatever reason it's not working.

my config file is set like this:

Code:
$config['base_url'] = "http://www.example.com/stage2/";

$config['sess_cookie_name']        = 'something';
$config['sess_expiration']        = 60 * 60 * 24 * 30;
$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']    = "http://example.com/stage2";
$config['cookie_path']        = "/";


I've tried removing the www. from the base url, to match the cookie_domain, I've tried adding and removing the slash from cookie_domain, I've tried using $config['sess_expiration'] = 0; $config['sess_expiration'] = 7200;, etc., I've tried everything I can think of. I've been deleting cookies between tests. I'm running out of inspiration here.

What is up with sessions in CI that they just never work for me on new installs?

I'm testing sessions like this:

Code:
$session_data = array(
'logged_in'  => true,
'user_id'=>$user->id,
'member_first'=>$user->member_first,
'member_last'=>$user->member_last,
'member_admin'=>$user->member_admin,
'member_type'=>$user->member_type
);

if($this->session->set_userdata($session_data)) { echo("worked"); }
else {echo("failed"); }

it prints "failed" every time, though the session data is accessible on the first load. If I remove the session set call, the session data disappears. This sounds like the cookie isn't saving. My server time is correct.

What am I doing wrong?


Messages In This Thread
session problems - by El Forum - 05-17-2010, 12:29 AM
session problems - by El Forum - 05-17-2010, 12:40 AM
session problems - by El Forum - 05-17-2010, 01:00 AM



Theme © iAndrew 2016 - Forum software by © MyBB