Re: [Phplib-users] Sharing sessions between domains
Brought to you by:
nhruby,
richardarcher
|
From: Peter C. <pe...@kr...> - 2003-01-27 21:24:50
|
A very boring question, obviously!
For the record, I sorted by problem by changing session4::start (code at end of message). The main change was to move the call to session_id to before the session_start, so that the session id can be forced - the session Id is pulled from $_GET if present. There's no need to change fallback_mode.
Cheers
Peter
Modified function:
/**
* Start a new session or recovers from an existing session
*
* @return boolean session_start() return value
* @access public
*/
function start() {
if ( $this->mode=="cookie"
&& $this->fallback_mode=="cookie") {
ini_set ("session.use_only_cookie","1");
}
$this->set_tokenname();
$this->put_headers();
// We have been provided with a session ID (used when traversing domains)
// - moved before session_start to allow id to be forced (PAC 27Jan03)
if (isset($_GET[$this->name]))
$this->id = session_id($_GET[$this->name]);
else
$this->id = session_id();
$ok = session_start();
# $this->id = session_id(); //PAC moved before session_start
// If register_globals is off -> restore session variables to global scope
if(!(bool) ini_get('register_globals')) {
if(is_array($_SESSION)) {
foreach ($_SESSION as $key => $value) {
global $$key;
$$key=$value;
}
}
}
return $ok;
} // end func start
|