|
You last visited: Today at 23:37
Advertisement
Suche MC Server Status?
Discussion on Suche MC Server Status? within the Minecraft forum part of the Other Online Games category.
05/14/2013, 07:07
|
#1
|
elite*gold: 0
Join Date: Nov 2010
Posts: 2,582
Received Thanks: 183
|
Suche MC Server Status?
Guten Morgen,
da ich heute bei meinen Server von WordPress nach WBB gewechselt habe, suche ich einen neuen Server Status. Mein alter Server Status konnte die Spielerzahl, die Namen der Spieler und halt wie viele Slots vorhanden sind anzeigen, nun ist die Frage ob sowas auch geht mit html oder php???
Ich habe nachdem ich gegoogelt habe schon ein kleineren gefunden aber dieser zerstört das halbe Portal wenn der Server offline ist.
Hat jemand eine Ahnung woher ich einen Server Status bekommen kann?=
Gruß
|
|
|
05/14/2013, 07:47
|
#2
|
elite*gold: 0
Join Date: Apr 2010
Posts: 10,289
Received Thanks: 3,613
|
PHP Code:
function serverInfo($ip, $port, $timeout) { $fp = @fsockopen($ip, $port, $errno, $errstr, $timeout); if(!$fp) { return array("online" => false, "player" => "-", "max" => "-"); } fwrite($fp, "\xFE"); $answer = fread($fp, 256); if ($answer[0] != "\xFF") { fclose($fp); return array("online" => false, "player" => "-", "max" => "-"); } $text = substr($answer, 3); $text = mb_convert_encoding($text, 'auto', 'UCS-2'); $parts = explode("\xA7", $text); fclose($fp); return array("online" => true, "player" => $parts[count($parts)-2], "max" => $parts[count($parts)-1]); }
Beispiel:
PHP Code:
$info = serverInfo("url", 7171, 5 * 1000); echo $info[0]." ".$info[1]."/".$info[2];
Sollte so funktionieren, wenn nicht einfach nochmal Bescheid geben.
Lg Shawak
|
|
|
05/14/2013, 08:09
|
#3
|
elite*gold: 0
Join Date: Nov 2010
Posts: 2,582
Received Thanks: 183
|
Ich habe ja nur eine Portalbox und da ich der totale PHP Noob bin, habe ich das was du mir geschrieben hast einfach in die Box gepackt und bei URL die Server IP reingetan.
Das funktioniert aber nicht.
PS: JA PHP ist aktiviert für die Box^^
|
|
|
05/14/2013, 08:20
|
#4
|
Moderator
elite*gold: 558
Join Date: Feb 2010
Posts: 6,546
Received Thanks: 1,418
|
Ich meine der Port sollte der Port sein, auf dem dein Server läuft.
Kommt irgendein Fehler oder einfach garnichts?
Edit:
Hier gibt es eine fertige Klasse dafür und ein Verwendungsbeispiel ist auch dabei:
Und zu meiner Anmerkung oben: Der Port ist frei wählbar, als Standard ist aber 25565 eingestellt.
|
|
|
05/14/2013, 08:27
|
#5
|
elite*gold: 0
Join Date: Nov 2010
Posts: 2,582
Received Thanks: 183
|
Quote:
|
function serverInfo($ip, $port, $timeout) { $fp = @fsockopen($ip, $port, $errno, $errstr, $timeout); if(!$fp) { return array("online" => false, "player" => "-", "max" => "-"); } fwrite($fp, "\xFE"); $answer = fread($fp, 256); if ($answer[0] != "\xFF") { fclose($fp); return array("online" => false, "player" => "-", "max" => "-"); } $text = substr($answer, 3); $text = mb_convert_encoding($text, 'auto', 'UCS-2'); $parts = explode("\xA7", $text); fclose($fp); return array("online" => true, "player" => $parts[count($parts)-2], "max" => $parts[count($parts)-1]); } $info = serverInfo("178.77.64.210", 7171, 5 * 1000); echo $info[0]." ".$info[1]."/".$info[2];
|
Das wird in der Box angezeigt.
Zu deinen Link, alle Dateien die dort sind müssen aber auf meinen Webspace sein oder?
|
|
|
05/14/2013, 08:45
|
#6
|
Moderator
elite*gold: 558
Join Date: Feb 2010
Posts: 6,546
Received Thanks: 1,418
|
Du bräuchtest nur die MinecraftQuery.class.php
Wo genau die auf deinen Webspace muss weis ich nicht, weil ich nicht weis wo und wie WBB die einbinden würde (bzw. in welchem Ordner man sich mit der Box befindet), das muss man ausprobieren.
Wenn das da so angezeigt wird, wird das ganze nicht als PHP sondern als Text verstanden.
Mach mal <?php .... ?> außenrum. Also <?php function serverInfo [...] ".$info[1]."/".$info[2]; ?>
|
|
|
05/14/2013, 08:58
|
#7
|
elite*gold: 0
Join Date: Nov 2010
Posts: 2,582
Received Thanks: 183
|
Wenn ich <?php dahin packe kommt nun der Error:
Parse error: syntax error, unexpected T_FUNCTION, expecting T_STRING in /var/www/web838/html/lib/data/boxes/scripts/customBox12.php on line 1
|
|
|
05/14/2013, 09:10
|
#8
|
elite*gold: 0
Join Date: Apr 2010
Posts: 10,289
Received Thanks: 3,613
|
Quote:
Originally Posted by Dustin22
Wenn ich <?php dahin packe kommt nun der Error:
Parse error: syntax error, unexpected T_FUNCTION, expecting T_STRING in /var/www/web838/html/lib/data/boxes/scripts/customBox12.php on line 1
|
Kannst du eventuell mal den Ausschnitt der zeigen und die 5 Zeilen davor/danach?
|
|
|
05/14/2013, 09:23
|
#9
|
elite*gold: 0
Join Date: Nov 2010
Posts: 2,582
Received Thanks: 183
|
Code:
<?php function function serverInfo($ip, $port, $timeout) {
$fp = @fsockopen($ip, $port, $errno, $errstr, $timeout);
if(!$fp) {
return array("online" => false, "player" => "-", "max" => "-");
}
fwrite($fp, "\xFE");
$answer = fread($fp, 256);
if ($answer[0] != "\xFF") {
fclose($fp);
return array("online" => false, "player" => "-", "max" => "-");
}
$text = substr($answer, 3);
$text = mb_convert_encoding($text, 'auto', 'UCS-2');
$parts = explode("\xA7", $text);
fclose($fp);
return array("online" => true, "player" => $parts[count($parts)-2], "max" => $parts[count($parts)-1]);
}
$info = serverInfo("178.77.64.210", 7171, 5 * 1000);
echo $info[0]." ".$info[1]."/".$info[2];?>
Das ist der gesamte Code der nun bei dem Error kommt
|
|
|
05/14/2013, 09:32
|
#10
|
Moderator
elite*gold: 558
Join Date: Feb 2010
Posts: 6,546
Received Thanks: 1,418
|
Ich glaube er meinte die ersten 5 Zeilen aus der customBox12.php
Du solltest den Port (7171) mal durch deinen Port aus den serverproperties ersetzen. (query.port)
Edit:
Du kannst es ja mal so probieren:
Code:
<?php
class MinecraftQueryException extends Exception
{
// Exception thrown by MinecraftQuery class
}
class MinecraftQuery
{
/*
* Class written by xPaw
*
* Website: http://xpaw.ru
* GitHub: https://github.com/xPaw/PHP-Minecraft-Query
*/
const STATISTIC = 0x00;
const HANDSHAKE = 0x09;
private $Socket;
private $Players;
private $Info;
public function Connect( $Ip, $Port = 25565, $Timeout = 3 )
{
if( !is_int( $Timeout ) || $Timeout < 0 )
{
throw new InvalidArgumentException( 'Timeout must be an integer.' );
}
$this->Socket = @FSockOpen( 'udp://' . $Ip, (int)$Port, $ErrNo, $ErrStr, $Timeout );
if( $ErrNo || $this->Socket === false )
{
throw new MinecraftQueryException( 'Could not create socket: ' . $ErrStr );
}
Stream_Set_Timeout( $this->Socket, $Timeout );
Stream_Set_Blocking( $this->Socket, true );
try
{
$Challenge = $this->GetChallenge( );
$this->GetStatus( $Challenge );
}
// We catch this because we want to close the socket, not very elegant
catch( MinecraftQueryException $e )
{
FClose( $this->Socket );
throw new MinecraftQueryException( $e->getMessage( ) );
}
FClose( $this->Socket );
}
public function GetInfo( )
{
return isset( $this->Info ) ? $this->Info : false;
}
public function GetPlayers( )
{
return isset( $this->Players ) ? $this->Players : false;
}
private function GetChallenge( )
{
$Data = $this->WriteData( self :: HANDSHAKE );
if( $Data === false )
{
throw new MinecraftQueryException( "Failed to receive challenge." );
}
return Pack( 'N', $Data );
}
private function GetStatus( $Challenge )
{
$Data = $this->WriteData( self :: STATISTIC, $Challenge . Pack( 'c*', 0x00, 0x00, 0x00, 0x00 ) );
if( !$Data )
{
throw new MinecraftQueryException( "Failed to receive status." );
}
$Last = "";
$Info = Array( );
$Data = SubStr( $Data, 11 ); // splitnum + 2 int
$Data = Explode( "\x00\x00\x01player_\x00\x00", $Data );
$Players = SubStr( $Data[ 1 ], 0, -2 );
$Data = Explode( "\x00", $Data[ 0 ] );
// Array with known keys in order to validate the result
// It can happen that server sends custom strings containing bad things (who can know!)
$Keys = Array(
'hostname' => 'HostName',
'gametype' => 'GameType',
'version' => 'Version',
'plugins' => 'Plugins',
'map' => 'Map',
'numplayers' => 'Players',
'maxplayers' => 'MaxPlayers',
'hostport' => 'HostPort',
'hostip' => 'HostIp'
);
foreach( $Data as $Key => $Value )
{
if( ~$Key & 1 )
{
if( !Array_Key_Exists( $Value, $Keys ) )
{
$Last = false;
continue;
}
$Last = $Keys[ $Value ];
$Info[ $Last ] = "";
}
else if( $Last != false )
{
$Info[ $Last ] = $Value;
}
}
// Ints
$Info[ 'Players' ] = IntVal( $Info[ 'Players' ] );
$Info[ 'MaxPlayers' ] = IntVal( $Info[ 'MaxPlayers' ] );
$Info[ 'HostPort' ] = IntVal( $Info[ 'HostPort' ] );
// Parse "plugins", if any
if( $Info[ 'Plugins' ] )
{
$Data = Explode( ": ", $Info[ 'Plugins' ], 2 );
$Info[ 'RawPlugins' ] = $Info[ 'Plugins' ];
$Info[ 'Software' ] = $Data[ 0 ];
if( Count( $Data ) == 2 )
{
$Info[ 'Plugins' ] = Explode( "; ", $Data[ 1 ] );
}
}
else
{
$Info[ 'Software' ] = 'Vanilla';
}
$this->Info = $Info;
if( $Players )
{
$this->Players = Explode( "\x00", $Players );
}
}
private function WriteData( $Command, $Append = "" )
{
$Command = Pack( 'c*', 0xFE, 0xFD, $Command, 0x01, 0x02, 0x03, 0x04 ) . $Append;
$Length = StrLen( $Command );
if( $Length !== FWrite( $this->Socket, $Command, $Length ) )
{
throw new MinecraftQueryException( "Failed to write on socket." );
}
$Data = FRead( $this->Socket, 2048 );
if( $Data === false )
{
throw new MinecraftQueryException( "Failed to read from socket." );
}
if( StrLen( $Data ) < 5 || $Data[ 0 ] != $Command[ 2 ] )
{
return false;
}
return SubStr( $Data, 5 );
}
}
$Query = new MinecraftQuery( );
try
{
$Query->Connect( '178.77.64.210', 25565 );
print_r( $Query->GetInfo( ) );
print_r( $Query->GetPlayers( ) );
}
catch( MinecraftQueryException $e )
{
echo $e->getMessage( );
}
?>
Das ist jetzt die Klasse, die ich geschickt hatte. Du kannst den Code einfach so in deine Box einfügen, die Datei wird nicht benötigt.
Wenn das eine einigermaßen vernünftige Ausgabe produziert können wir dir dann auch die richtigen Sachen ausgeben lassen und vielleicht auch noch formatieren. Aber die Arbeit will ich mir erst machen, wenn ich weis das es geht.
|
|
|
05/14/2013, 09:41
|
#11
|
elite*gold: 0
Join Date: Nov 2010
Posts: 2,582
Received Thanks: 183
|
Der Status von dir ComputerBaer funktioniert, nur zeigt er alle Plugins an, was nicht so schön aussieht 
Hier was rausskomt:
Quote:
|
Array ( [HostName] => ~~ MinecraftPower.de ~~ [GameType] => SMP [Version] => 1.5.2 [Plugins] => Array ( [0] => GroupManager 2.0 (2.10.1) (Phoenix) [1] => WorldEdit 5.5.4 [2] => ChatControl 2.1.0 [3] => RankSigns 0.1 [4] => Vault 1.2.24-b304 [5] => PlayerHeads 3.1.0093 [6] => Restarter 1.2 [7] => LogBlock 1.70 [8] => WorldGuard 5.7.3 [9] => ColoredTablist 1.9 [10] => Lottery 1.0 [11] => RocketBoots 0.9.1.2 [12] => iConomy 7.0 [13] => Permissions 3.1.6 [14] => CraftBook 1921-10e0998 [15] => ZavAutoMessager 2.5 [16] => Votifier 1.9 [17] => Essentials Pre2.11.1.2 [18] => EssentialsProtect Pre2.11.1.2 [19] => EssentialsSpawn Pre2.11.1.2 [20] => EssentialsAntiBuild Pre2.11.1.2 [21] => LWC 4.3.2 (b858-git-MANUAL) (March 16, 2013) [22] => dynmap 1.5-612 [23] => ChestShop 3.50-t0059 [24] => EssentialsChat Pre2.11.1.2 [25] => PlotMe 0.13 [26] => Multiverse-Core 2.5-b641 [27] => AuthMe 2.7.12 [28] => Multiverse-Portals 2.4-b548 [29] => AntiCheat 1.5.8 ) [Map] => world [Players] => 1 [MaxPlayers] => 64 [HostPort] => 25565 [HostIp] => 178.77.64.210 [RawPlugins] => CraftBukkit on Bukkit 1.5.2-R0.2-SNAPSHOT: GroupManager 2.0 (2.10.1) (Phoenix); WorldEdit 5.5.4; ChatControl 2.1.0; RankSigns 0.1; Vault 1.2.24-b304; PlayerHeads 3.1.0093; Restarter 1.2; LogBlock 1.70; WorldGuard 5.7.3; ColoredTablist 1.9; Lottery 1.0; RocketBoots 0.9.1.2; iConomy 7.0; Permissions 3.1.6; CraftBook 1921-10e0998; ZavAutoMessager 2.5; Votifier 1.9; Essentials Pre2.11.1.2; EssentialsProtect Pre2.11.1.2; EssentialsSpawn Pre2.11.1.2; EssentialsAntiBuild Pre2.11.1.2; LWC 4.3.2 (b858-git-MANUAL) (March 16, 2013); dynmap 1.5-612; ChestShop 3.50-t0059; EssentialsChat Pre2.11.1.2; PlotMe 0.13; Multiverse-Core 2.5-b641; AuthMe 2.7.12; Multiverse-Portals 2.4-b548; AntiCheat 1.5.8 [Software] => CraftBukkit on Bukkit 1.5.2-R0.2-SNAPSHOT ) Array ( [0] => Arnaen )
|
|
|
|
05/14/2013, 09:54
|
#12
|
Moderator
elite*gold: 558
Join Date: Feb 2010
Posts: 6,546
Received Thanks: 1,418
|
Gut, das könne wir jetzt ja bearbeiten.
Sollte ungefähr so sein:
Code:
$Info = $Query->GetInfo( );
echo 'Aktuelle Spielerzahl: ' . $Info['Players'] . '<br />';
echo 'Slots: ' . $Info['MaxPlayers'] . '<br />';
echo 'Spieler: ' . join(', ', $Query->GetPlayers( ))';
Edit:
Du ersetzt diese Zeilen durch den Text oben:
Code:
print_r( $Query->GetInfo( ) );
print_r( $Query->GetPlayers( ) );
|
|
|
05/14/2013, 10:01
|
#13
|
elite*gold: 0
Join Date: Nov 2010
Posts: 2,582
Received Thanks: 183
|
Großes Dank an ComputerBaer#
Er hat mir den Server Status gemacht
bitte closen
|
|
|
 |
Similar Threads
|
Reg Page Edited Server Status + Extra Status
08/26/2012 - SRO Coding Corner - 22 Replies
This is a new realease of the reg page created by Xsense
Download XAMP apache friends - xampp for windows
Reg Page Files (By Tazdingo And Xsense) : Multiupload.com - upload your files to multiple file hosting sites!
1. Install XAMP
2. Go to the PHP folder of the xampplite (C:\xampplite\php) and search PHP.ini
3. In the PHP.ini search ;extension=php_mssql.dl and delete ";"
|
[Suche/Search] Rollback der Status / Roll of status back
05/07/2011 - Metin2 Private Server - 0 Replies
EN:
Hallo all e*pvp community. I have got 2010 serverfiles and I want to know quest function that rolls status points back. As you see on this movie
YouTube - Redystrybucje statystyk
DE (Google Translate):
Hallo alle e * PvP Community. Ich habe 2010 Serverfiles bekam, und ich möchte Quest-Funktion, Status Punkte Rollback wissen. Wie Sie sehen auf diesem Film
YouTube - Redystrybucje statystyk
|
[Suche] Server Status Script.PHP
02/05/2011 - WoW Private Server - 0 Replies
Hallo Community,
ich bin seid ein paar Tage auf der Suche nach einem Script was ich per
PHP auf meine Seite einbinden kann was mir den Status und evlt die Uptime
des WoW Pservers anzeigt. Finde aber leider nichts gutes.
Hat wer so ein Script was gut funktioniert und nicht so super Serverlastig ist ?
Freue mich über jede Hilfe !
|
Suche zuiaipk Server Status
08/27/2009 - Metin2 Private Server - 10 Replies
...Sorry für den 2ten Thread in 30 Mins aber ist wichtig und da ich auch nur fast immer helfe und nix suche oder frage, wird das ja wohl erlaubt sein xD
Also wie gesagt ich würde gerne den Zuiaipk Server Status haben..
Wer ihn hat oder weiß wie ich dran komme bitte in den Thread schreiben... Gibt natürlich Thanx, wenn das nicht genug ist kann auch noch was anderes Bieten^^
zb. Sura accs auf zuiaipk auf jedem acc ist ein sura level 75+^^
mfg
|
[Server Status] Server Status Programs From A Couple Servers.
11/05/2008 - Conquer Online 2 - 9 Replies
Hey i dont know in what section to post it so i hope that the mods will move it to the good section but i made this server status program i will make later more server status programs for other servers.
PhoenixCo:
Server Checker
Qonquer
Qonquer Server Checker
Screenshot:
http://i286.photobucket.com/albums/ll115/aschwinh /sdfsdfsdf.jpg
|
All times are GMT +1. The time now is 23:38.
|
|