$row = mysqli_fetch_assoc($result); $sessionId = $row['session_id']; $state = $row['state']; echo "Found your session: {$sessionId} ({$state})<br>"; if ($state == "ss_planned") { // First, start the session startSession($charId, $domainId, $sessionId); global $SessionId, $SessionToolsResult; if ($SessionToolsResult === false) { die("Failed to start the session"); } $sessionId = $SessionId; echo "edit_session.php : the session have been started<br>"; } } // check that we character have a participation in the session and invite him if needed $query = "SELECT count(*) FROM session_participant WHERE session_id = {$sessionId} AND char_id = {$charId}"; $result = mysqli_query($link, $query) or die("Can't execute the query: " . $query); $num = mysqli_num_rows($result); if ($num != 1) { die("Invalid result whil checking participation for char {$charId} in session {$sessionId}<br>"); } $value = mysqli_fetch_row($result); if ($value[0] == 0) { // the character have not is own invitation ! echo "Missing participation for character {$charId} owner of session {$sessionId}, adding it<br>"; inviteOwnerInSession($charId, $domainId, $sessionId); } echo "edit_session.php : invitation ok<br>"; // Join the session joinSessionFromId($userId, $domainId, $sessionId);
function invokeResult($userId, $resultCode, $resultString) { global $rsmProxy, $rsmSkel, $userId, $charId, $callbackClient, $SessionId, $DomainId, $SessionToolsResult; if ($resultCode != 0) { $SessionToolsResult = false; echo "<h1>Error " . $resultCode . " : '" . $resultString . "' while trying to start the session " . $SessionId . "</h1>"; echo '<p><p><a href="web_start.php">Back to menu</a>'; } else { // ok, the session is started, invite the session owner in the session $SessionToolsResult = false; echo "Start of session {$SessionId} success, now inviting character {$charId} in the sesison<br>"; inviteOwnerInSession($charId, $DomainId, $SessionId); } }