/** * Authenticate and request to join the specified shard */ function joinSessionFromIdPost($destSessionId) { $domainId = -1; if (!validateCookie($userId, $domainId, $charId)) { echo "Invalid cookie !"; die; } else { joinSessionFromId($userId, $domainId, $destSessionId); } }
$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);