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, $DBUserName, $DBPassword, $RingDBName;
$link = mysql_connect($DBHost, $DBUserName, $DBPassword) or die ("Can't connect to database host:$DBHost user:$DBUserName");
mysql_select_db ($RingDBName) or die ("Can't access to the table dbname:$RingDBName");
// extract the character that have the specified name
$query = "select * from characters where char_name = '".$_POST["charName"]."'";
$result = mysql_query ($query) or die ("Can't execute the query: ".$query);
if (mysql_num_rows ($result) == 0)
{
echo "Can't find the character ".$_POST["charName"]."";
}
else
{
$row = mysql_fetch_row($result);
$currentSession = $row[0];
$currentchar = $row[1];
// 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 "
";
}
?>
Return to main