[eluser]Ñuño Martínez[/eluser]
I'm not sure how to call that.
I had two different applications that use CodeIgniter. I'm sure nobody will use them at same time, but I've discovered that when I start application#1 the application#2's session is removed.
I'm using a helper to check the user login with sessions. The code is this:
Code:
function SessionExists ($Redirect = true)
{
log_message ('info', 'Checks session...');
$CI =& get_instance ();
$CI->load->library ('session');
if ($CI->session->userdata ('logged_in'))
if ($CI->session->userdata ('user') !== false &&
$CI->session->userdata ('key') !== false)
return true;
log_message ('info', "Can't find session.");
if ($Redirect) {
log_message ('debug','Redirect to '.$CI->config->item('base_url').'login.');
header ('location: '.$CI->config->item ('base_url').'login');
die ('<p>Redirecting...</p>');
}
return false;
}
I think this code is self-explaining. This just checks if there's a session with the variables, the "user" and "key" will be checked by the application itself.
Is something wrong there?