The character ".$_POST["charName"]." have been invited in session ".$_POST["sessionId"]."."; } else { echo "

Failed to invite player ".$_POST["charName"]." in session ".$_POST["sessionId"]." : ".$resultString."

"; } } } $step = 0; $domainId = -1; if (!validateCookie($userId, $domainId, $charId)) { echo "Invalid cookie !"; die(); } echo "Welcome user $userId
"; $domainInfo = getDomainInfo($domainId); $addr = split(":", $domainInfo["session_manager_address"]); $RSMHost = $addr[0]; $RSMPort = $addr[1]; if (isset($_POST["execute"])) { // lookup in the database to convert character name into global $DBHost, $RingDBUserName, $RingDBPassword, $RingDBName; $link = mysqli_connect($DBHost, $RingDBUserName, $RingDBPassword) or die ("Can't connect to database host:$DBHost user:$RingDBUserName"); mysqli_select_db($link, $RingDBName) or die ("Can't access to the table dbname:$RingDBName"); // extract the character that have the specified name $charName = mysqli_real_escape_string($link, $_POST['charName']); $query = "select char_id, char_name from characters where char_name = '$charName'"; $result = mysqli_query($link, $query) or die ("Can't execute the query: ".$query); if (mysqli_num_rows($result) == 0) { echo "

Can't find the character ".$_POST["charName"]."

"; } else { $row = mysqli_fetch_assoc($result); $currentSession = $row['char_id']; $currentchar = $row['char_name']; // send the invitation info to the session manager $invitePioneer = new InvitePioneerCb; $res = ""; $invitePioneer->connect($RSMHost, $RSMPort, $res); // $rsmProxy = new CRingSessionManagerWebProxy; // TODO: not sure it works with a char slot > 0 $invitePioneer->inviteCharacter(($userId*16) + getCharSlot(), $_POST["sessionId"], $row[0], $_POST["mode"]); echo "wait result..."; // wait the the return message // $rsmSkel = new CRingSessionManagerWebSkel; if (!$invitePioneer->waitCallback()) echo "

No response from server


"; else echo "Result received..."; } } else { // buid a form to gather info about the character to invite echo "

Invite a player in the session ".$_POST["sessionId"]."

"; echo "
Type in character name:
"; echo ""; echo ""; echo ""; echo ""; echo ""; echo "
"; } ?>

Return to main