Urk. First, never, EVER do this:
$session_id = $_REQUEST['session_id'];
This causes a security flaw, which we call "session fixation" (more details: http://en.wikipedia.org/wiki/Session_fixation ).
You seem to be very hard on security. If you need to exchange data from site 1 to site 2, you must do this through one consumption bridge:
one). Click the link to site 1 in the handler file, call redir.php.
2). Redir.php first validates existing session data.
3). Redir.php writes the corresponding information to the DB string along with some identifier (for example, MD5 hash of the user ID + "_" + current time), plus the "consumed" flag, sets false.
4). Redir.php redirects 301 to site 2 along with the identifier.
5). Site 2 reads the corresponding row from the database.
6). If the data is good and not yet "absorbed", return success and mark the data as consumed.
7). If the data was destroyed, enter some kind of error.
There are more complex ways to do this, but I think it handles what you are trying to do.
John green
source share