[code=php]<body bgcolor="#000000">
<?php
require("GbxRemote.inc.php");
// functions.
function catchError($errno, $errstr, $errfile, $errline){
}
set_error_handler('catchError');
function MwTimeToString($MwTime)
{
if ($MwTime == -1) {
return "???";
} else {
$minutes = floor($MwTime/(1000*60));
return $minutes.":".floor(($MwTime-$minutes*60*1000)/1000);
}
}
function ParseArgument(&$ArgumentValue, $ArgumentName, $DefaultValue)
{
if (array_key_exists($ArgumentName, $_POST)) {
$ArgumentValue = $_POST[$ArgumentName];
} else if (array_key_exists($ArgumentName, $_GET)) {
$ArgumentValue = $_GET[$ArgumentName];
} else {
$ArgumentValue = $DefaultValue;
}
}
// parse the arguments.
ParseArgument( $AuthLogin, 'authLogin', "SuperAdmin" );
ParseArgument( $AuthPassword, 'authPassword', "SuperAdmin" );
ParseArgument( $OldAuthLogin, 'oldAuthLogin', $AuthLogin );
ParseArgument( $OldAuthPassword, 'oldAuthPassword', $AuthPassword );
ParseArgument( $port, 'port', 5000 );
ParseArgument( $MSLogin, 'mslogin', "" );
ParseArgument( $MSPassword, 'mspassword', "" );
if (array_key_exists('action', $_POST)) {
$Action = $_POST['action'];
/*} else if (array_key_exists('action', $_GET))
$Action = $_GET['action'];*/
} else {
$Action="";
}
echo "<center><h1><font color='#00ff00'> [DTO]<font color='White'>Full Speed <font color='#0099FF'>Server</font></h1></center>";
echo "<center><h1><font color='#FF0000'> (Dedicated) </Font></h1></center>";
echo <<<END
<form name="input" action="Serverinfo.php" method="post">
<input type="submit" value="Refresh">
</form>
END;
// ----------------------------------------------------------------
// connect
// ----------------------------------------------------------------
$client = new IXR_Client_Gbx;
if (!$client->Init($port)) {
trigger_error("[".$client->getErrorCode()."] ".$client->getErrorMessage());
}
if (!$client->query("Authenticate", $AuthLogin, $AuthPassword)) {
trigger_error("[".$client->getErrorCode()."] ".$client->getErrorMessage());
$AuthLogin = $OldAuthLogin;
$AuthPassword = $OldAuthPassword;
}
else
{
$OldAuthLogin = $AuthLogin;
$OldAuthPassword = $AuthPassword;
}
// ----------------------------------------------------------------
// status info
// ----------------------------------------------------------------
if (!$client->query('GetStatus')) {
trigger_error("[".$client->getErrorCode()."] ".$client->getErrorMessage());
}
else
{
$Status = $client->getResponse();
echo "<font color='#0099FF'>Status: </font>". $Status['Name'] . "<BR>";
if ($Status['Code'] == 1) {
} else if ( ($Status['Code'] == 3) || ($Status['Code'] == 4) || ($Status['Code'] == 5) ) {
if (!$client->query('GetCurrentChallengeInfo')) {
trigger_error("[".$client->getErrorCode()."] ".$client->getErrorMessage());
}
else
{
$CurrentChallengeInfo = $client->getResponse();
$tekst = $CurrentChallengeInfo['Name'];
$output = str_replace("$00f","<font color='#0000FF'>", $tekst . "</font>");
// etc.
echo "Current challenge :" . $output . "</font><BR><BR>";
}
// ----------------------------------------------------------------
// in game actions
// ----------------------------------------------------------------
if( $Status['Code'] == 4 )
{
}
else
{
echo "";
}
echo "<font color='#FF0000'>Players:</font><BR>";
if (!$client->query('GetPlayerList', 50, 0)) {
trigger_error("[".$client->getErrorCode()."] ".$client->getErrorMessage());
}
else
{
$PlayerList = $client->getResponse();
echo "<TABLE cellspacing=5>";
foreach ($PlayerList as $player) {
$PlayerName = $player['NickName'];
$PlayerRanking = $player['LadderRanking'];
$PlayerIsInOfficialMode = ($player['IsInOfficialMode']!=0) ? "Official" : "Not Official";
echo <<<END
<TR><TD><font color='White'>$PlayerName</font></TD><TD><font color='White'>$PlayerIsInOfficialMode</TD><TD><font color='White'>$PlayerRanking</TD>
END;
}
echo "</TABLE>";
}
echo "<font color='#FF0000'>Podium:</font><BR>";
if (!$client->query('GetCurrentRanking', 50, 0)) {
trigger_error("[".$client->getErrorCode()."] ".$client->getErrorMessage());
}
else
{
$CurrentRanking = $client->getResponse();
echo "<TABLE cellspacing=5>";
foreach ($CurrentRanking as $Ranking) {
$PlayerName = $Ranking['NickName'];
$PlayerRank = $Ranking['Rank'];
$PlayerBestTime = $Ranking['BestTime'];
$PlayerLadder = $Ranking['LadderScore'];
echo <<<END
<TR><TD><font color='White'>$PlayerRank</TD><TD><font color='White'>$PlayerName</TD><TD><font color='White'>$PlayerLadder</TD><TD><font color='White'>$PlayerBestTime</TD></TR>
END;
}
echo "</TABLE><BR>";
}
} else if ($Status['Code'] == 2) {
echo "server busy..<BR><BR>";
}
}
// ----------------------------------------------------------------
// challenges
// ----------------------------------------------------------------
echo "<h3>Tracks op de server:</h3>";
if (!$client->query('GetChallengeList', 50, 0)) {
trigger_error("[".$client->getErrorCode()."] ".$client->getErrorMessage());
}
else
{
$ChallengeList = $client->getResponse();
echo "<TABLE cellspacing=5>";
foreach ($ChallengeList as $challenge) {
$FileName = $challenge['FileName'];
echo <<<END
<TR><TD><font color='#00FF00'>$FileName</TD></TR>
END;
}
}
$client->Terminate();
?>
Could someone please help me becouse i'm braincracking for more than a week about it now 😕[/code]