Transfering session data between servers
Moderator: General Moderators
-
DudeBori82
- Forum Commoner
- Posts: 26
- Joined: Thu Nov 18, 2004 10:09 am
- Location: Florida
Transfering session data between servers
In the process of navigating through my site, the user travels between two servers. As they navigate, session arrays store the data I need, but it's lost when they go to the new server. What is the best way to "copy" or "transfer" data to a new session on the other server. Or possibly transfer the session between servers. (The data is stored in arrays, so using POST method is difficult and tedious.)
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
a ghetto way is to transfer the data behind the scenes.. either posting it (recommend encryption) using one of the request functions, or through the database (ideal) if the database is accessible between the servers. However, the session id may be a pain to transfer, if they truly are different domains...
it shouldnt be difficult to post the data to the other server at all if you use the right methods.
$data = serialize($_SESSION);
now post $data to the other server
you wil need to restore the data like
$_SESSION = unserialize($_POST['data']);
you may need to use stripslashes if magic quotes is on.
and like feyd said, encrypt it.
$data = serialize($_SESSION);
now post $data to the other server
you wil need to restore the data like
$_SESSION = unserialize($_POST['data']);
you may need to use stripslashes if magic quotes is on.
and like feyd said, encrypt it.