In my codeigniter project i have added KCK finder.
it needs some of session values which is controlled by codeigniter. how can i access CI session values from extern
Bens answer with include('index.php') and getting CI instance is not bad but in my situation these actions are too slow.
As i have codeigniter set to use files i made this solution which is a bit faster:
function CIsession()
{
$pathToSessionFiles = 'path/to/files/set/in/codeigniter/config/';
$h = md5($_SERVER['REMOTE_ADDR']); // $config['sess_match_ip'] = TRUE;
foreach( glob($pathToSessionFiles . '*' ) as $f )
{
if( strpos($f, $h) ) { $s[ $f ] = filemtime($f); }
}
arsort($s);
$s = array_keys($s);
$s = reset($s);
$s = file($s);
$s = reset($s);
$s = explode(';', $s);
foreach($s as $k => $v)
{
$s[$k] = str_getcsv($v, ":", '"');
$s[$k][0] = substr(reset($s[$k]), 0, strpos(reset($s[$k]), '|'));
$s[reset($s[$k])] = end($s[$k]);
unset($s[$k]);
}
return $s;
}
Hope it helps someone!