I need to transfer user session over servers. i.e. If the user is logged on to server1, and if the user exists on server2, then I need to transfer the user session data to server2. For this, I used the following technique
From server1, redirect the user to http: //server2/auth_from_server1.php? Sessionid = 12345 On server2 (internally, in the auth_from_server1.php PHP code), execute the request http: //server1/secret/check_session_id.php with sessionid, 12345. On server1, in the implementation of check_session_id.php, check the identifier and return OK, FAILURE and the session-related data that you want to transfer, for example, username, ... On server2, when the call returns with OK, save the transferred session data and give the user a cookie and a session for this server.
But when the callback function calls auth_from_server1.php, the value in the session identifier is null. I tried to check sessionid as
if(isset($_SESSION['sessionId'])) echo 'true'; else echo 'false';
But $ _SESSION ['sessionId'] is null. On the login page, I set the value for the session id as
$_SESSION['sessionId'] = session_id();
Thanks in advance....
php session sessionid
Damodaran
source share