undef HALF_FREQUENCY_SENDING_TO_CLIENT
[ryzomcore.git] / web / public_php / ring / join_session.php
blob0d44560ae39fd1c3f79e86495120d0df5fd032de
1 <?php
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
10 /**
11 * Join the specified session
13 function joinSessionResult($userId, $sessionId, $result, $shardAddr, $participantStatus)
15 if ($result != 0)
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>';
20 else
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"]);
38 /**
39 * Authenticate and request to join the specified shard
41 function joinSessionFromIdPost( $destSessionId )
43 $domainId = -1;
44 if (!validateCookie($userId, $domainId, $charId))
46 echo "Invalid cookie !";
47 die();
49 else
51 joinSessionFromId($userId, $domainId, $destSessionId);
55 /**
56 * Request to join the specified shard
58 function joinSessionFromId( $userId, $domainId, $destSessionId )
60 $domainId = -1;
61 if (!validateCookie($userId, $domainId, $charId))
63 echo "Invalid cookie !";
64 die();
66 else
68 echo "Welcome user $userId<BR>";
70 $domainInfo = getDomainInfo($domainId);
71 $addr = split(":", $domainInfo["session_manager_address"]);
72 $RSMHost = $addr[0];
73 $RSMPort = $addr[1];
75 // ask join to the session manager
76 $joinSession = new JoinSessionCb;
77 $res = "";
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>";
93 die();