php Serverinfo-Script Rumble 0.2a |
|
Was fürn Gothi.
Wenn ich das richtig verstanden habe, ist das ne Serverübersicht für die HP? :p
---------------------------------------------------------------------------
<!--
Rumble server query 0.2
Credits:
Mount (porting to rumble)
[XE]Tommis (testing)
Falcon (for the orginal script)
Changelog:
0.2 Added some tweaks
0.1 Release
--->
<?php
// server information
$ServerIP = "213.202.216.146"; // FILL HERE YOUR IP
$ServerPort = "22222"; // FILL HERE YOUR PORT
$display = "1"; // 1 = Default design 2 = Own design
##################### DO NOT EDIT BEYOND THIS POINT! #############################
$fp = fsockopen("udp://" . $ServerIP, $ServerPort + 123, $errno, $errstr);
function nick($nick) {
$nick=str_replace("<","<.",$nick);
return $nick;
}
// check if connection succeeded
if (!$fp) {
echo "$errstr ($errno)<br>\n";
exit;
} else {
// connection was established!
fputs ($fp, "s");
$c = '';
// get data..
do {
$c .= fread ($fp,1);
$fpstatus = socket_get_status($fp);
} while ($fpstatus["unread_bytes"] );
// close the connection; we don't really need it anymore
fclose ($fp);
$playerquery = strchr($c,"?");
$serverquery = substr($c,0, strlen($c) - strlen($playerquery));
$players = explode ("?",$playerquery);
unset($players[0]); // Remove Array number 0 because nothing is entered by explode.
// sort all data.
$serverquery = str_replace("","<=>",$serverquery);
$serverquery = str_replace("","<=>",$serverquery);
$serverquery = str_replace("","<=>",$serverquery);
$serverquery = str_replace("","<=>",$serverquery);
$serverquery = str_replace("","<=>",$serverquery);
$serverquery = str_replace("","<=>",$serverquery);
$serverquery = str_replace("","<=>",$serverquery);
$serverquery = str_replace("","<=>",$serverquery);
$serverquery = str_replace("_","<=>",$serverquery);
$serverquery = str_replace("_","<=>",$serverquery);
$serverquery = str_replace("_","<=>",$serverquery);
$serverquery = str_replace("_","<=>",$serverquery);
$serverquery = str_replace("_","<=>",$serverquery);
$serverquery = str_replace("_","<=>",$serverquery);
$serverquery = str_replace("_","<=>",$serverquery);
$serverquery = str_replace("_","<=>",$serverquery);
$serverquery = str_replace("_","<=>",$serverquery);
$serverquery = str_replace("","<=>",$serverquery);
for($i=0;$i<(count($serverquery));$i++){
$explodedata = explode("<=>",$serverquery);
}
}
// define some more variables
$string = "$ServerPort";
$stringlength = strlen($string);
$server_name_ip = $ServerPort;
$server_name_ip .= $explodedata[2][$stringlength];
$server_name = str_replace("$server_name_ip","",$explodedata[2]);
$server_name = explode("", $server_name);
$server_name = $server_name[0];
$max_players = explode("", $explodedata[7]);
$max_players = $max_players[0];
$gversion = explode("", $explodedata[4]);
$gversion = $gversion[0];
foreach (array_keys($players) as $player) { $players_in++; }; // get number of players in the server
foreach (array_keys($players) as $player) {
$pcount++;
$player = substr($players[$player],1,strlen($players[$player]) - 6);
$player = explode("0", $player);
$playersin[$pcount] = $player[0];
}
// *** START OUTPUTTING DATA ***//
if (!$serverquery) {
echo "Server offline";
} else {
// server is online and data was parsed
if ($display == '1')
{
echo "Servername: $server_name <BR>";
echo "Rumble Version: $gversion <BR>";
echo "Players: $players_in/$max_players <br>";
echo "Server IP: $ServerIP <BR>";
echo "Server Port: $ServerPort <BR>";
echo "<br>";
echo "<strong>Players:</strong><br />";
// Player List
$pcount = 0;
foreach (array_keys($players) as $player) {
$pcount++;
echo "$pcount "; // Player number
$player = substr($players[$player],1,strlen($players[$player]) - 6);
$player = explode("Neutral", $player);
echo nick($player[0]);
echo "<br>";
}
}
}
?>
Dieser Beitrag wurde 2 mal editiert, zum letzten Mal von Truesp!n: 16.04.2006 00:57.
|