I right now have a comet page, that if i call session_start at the top then the session freezes, my work-around that do is this:
function getTables($sessionID = null){
if(!isset($this->output)){
$this->output = array();
}
if(!isset($this->output[$this->sessID])){
$this->output[$this->sessID] = array();
}
$hostname = php_uname("n");
$sess_ini = session_save_path();
chdir($sess_ini);
if(false === ($save = @file_get_contents("sess_$this->sessID"))){
$cwd = getcwd();
chdir($this->location);
return (isset($this->returnJSON[$this->sessID])?$this->returnJSON[$this->sessID]
:json_encode(array(
'sess_local'=>"$sess_ini/sess_$this->sessID",
'save'=>$save,
'hostname'=>$hostname,
'cwd'=>$cwd,
'reg_local'=>$this->location,
)
)
);
}
chdir($this->location);
//session_id($sessionID);
$sessions = explode("|",$save);
$_SESSION['all'] = array();
foreach($sessions as $key=>$sess){
if(trim($sess)=='all' && isset($sessions[$key+1])){
$_SESSION['all'] = unserialize(trim(urldecode($sessions[$key+1])));
break;
}
}
...
Is there a better way for me to be getting the session vars thats not going into the session files?
Your work around can be much simpler:
You could write some helper functions, like: