2 require_once('../tools/validate_cookie.php');
3 include_once('../login/config.php');
4 include_once('../tools/domain_info.php');
5 include_once('ring_session_manager_itf.php');
8 class JoinSessionCb
extends CRingSessionManagerWeb
11 * Join the specified session
13 function joinSessionResult($userId, $sessionId, $result, $shardAddr, $participantStatus)
17 echo "<h1>Error ".$result." : '".$shardAddr."' while trying to join a session </h1>";
18 echo '<p><p><a href="web_start.php">Back to menu</a>';
22 // ok, we have the info to connect !
23 // generate the lua script
24 $cookie=convertCookieForActionHandler($_COOKIE["ryzomId"]);
25 $luaScript='runAH(nil, "on_connect_to_shard", "cookie='.$cookie.'|fsAddr='.$shardAddr.'")';
26 //echo 'luaScrip : '.$luaScript.'<br>';
27 echo '<lua>'.$luaScript.'</lua>';
29 echo 'You are allowed in the session <br>';
35 if (isset($_POST["sessionId"]))
36 joinSessionFromIdPost($_POST["sessionId"]);
39 * Authenticate and request to join the specified shard
41 function joinSessionFromIdPost( $destSessionId )
44 if (!validateCookie($userId, $domainId, $charId))
46 echo "Invalid cookie !";
51 joinSessionFromId($userId, $domainId, $destSessionId);
56 * Request to join the specified shard
58 function joinSessionFromId( $userId, $domainId, $destSessionId )
61 if (!validateCookie($userId, $domainId, $charId))
63 echo "Invalid cookie !";
68 echo "Welcome user $userId<BR>";
70 $domainInfo = getDomainInfo($domainId);
71 $addr = split(":", $domainInfo["session_manager_address"]);
75 // ask join to the session manager
76 $joinSession = new JoinSessionCb
;
78 $joinSession->connect($RSMHost, $RSMPort, $res);
79 // $rsmProxy = new CRingSessionManagerWebProxy;
81 // $charSlot = getCharSlot(); // if ingame (!=15), the RSM will check if this character has the right to connect to the specified session
82 // $charId = ($userId<<4) + $charSlot;
83 echo $charId." of user ".$userId." joigning session ".$destSessionId."<br>";
84 $joinSession->joinSession($charId, $destSessionId, $domainInfo["domain_name"]);
86 // wait the the return message
87 // $rsmSkel = new CRingSessionManagerWebSkel;
88 if ($joinSession->waitCallback() == false)
90 echo "No response from server, joinSession failed<br>";