pushkidman Posted May 8, 2014 Share Posted May 8, 2014 Hey there! I am wondering, is it possible to fetch data from PHP session, that was created in on another browser/computer? Let's say I know session_id() (it's stored in the database). I've googled a lot for that, but could not find any proper answer I've only found one solution, which said, that I had to restart session with new session_id(), but data from another computer is not in the array, when I output it. Link to comment https://forums.phpfreaks.com/topic/288346-sessions-across-multiple-browserscomputers/ Share on other sites More sharing options...
requinix Posted May 8, 2014 Share Posted May 8, 2014 Calling session_id() before session_start() should do the trick. What's your code? Link to comment https://forums.phpfreaks.com/topic/288346-sessions-across-multiple-browserscomputers/#findComment-1478781 Share on other sites More sharing options...
pushkidman Posted May 8, 2014 Author Share Posted May 8, 2014 if (!$User->getSessionKey()) { $User->setSessionKey(Roller::Session()->getId())->save(); } else { Roller::Session()->restart($User->getSessionKey()); } .... class Roller_Core_Session { public function init() { session_start(); global $_SESSION; if(!isset($_SESSION[$this->_sessionNamespace]) || !is_array($_SESSION[$this->_sessionNamespace])) { $_SESSION[$this->_sessionNamespace] = array(); } } public function restart($id) { session_id($id); $this->init(); } .... Link to comment https://forums.phpfreaks.com/topic/288346-sessions-across-multiple-browserscomputers/#findComment-1478782 Share on other sites More sharing options...
pushkidman Posted May 8, 2014 Author Share Posted May 8, 2014 Here's the above code. I've tried doing it this way, yet I still don't get data from another session... Link to comment https://forums.phpfreaks.com/topic/288346-sessions-across-multiple-browserscomputers/#findComment-1478783 Share on other sites More sharing options...
requinix Posted May 9, 2014 Share Posted May 9, 2014 Have you checked to see if you're getting the right session ID in your browser? Link to comment https://forums.phpfreaks.com/topic/288346-sessions-across-multiple-browserscomputers/#findComment-1478905 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.