es handelt sich um ein Script welches den aktuellen Status eines Counter Strike Source Servers ausliest. Ich bekomme dieses Script einfach nicht zum laufen:
Code: Alles auswählen
<?php
class hlserver
{
var $ip;
var $port;
var $fp;
var $serverinfo;
var $playerlist;
var $cvarlist;
function hlserver($server_address=0)
{
list($this->ip, $this->port) = explode(':', $server_address);
}
function connect()
{
$this->fp = fsockopen("udp://".$this->ip, $this->port);
}
// String-Command senden
function send_strcmd($strcmd)
{
fwrite($this->fp, sprintf('%c%c%c%c%s%c', 0xFF, 0xFF, 0xFF, 0xFF, $strcmd, 0x00));
}
// 1 Byte vom Server holen
function get_byte()
{
return ord(fread($this->fp, 1));
}
// 1 Zeichen (1 Byte) vom Server holen
function get_char()
{
return fread($this->fp, 1);
}
// einen int16-Wert (2 Bytes) vom Server holen
function get_int16()
{
$unpacked = unpack('sint', fread($this->fp, 2));
return $unpacked[int];
}
// einen int32-Wert (4 Bytes) vom Server holen
function get_int32()
{
$unpacked = unpack('iint', fread($this->fp, 4));
return $unpacked[int];
}
// einen float32-Wert (4 Bytes) vom Server holen
function get_float32()
{
$unpacked = unpack('fint', fread($this->fp, 4));
return $unpacked[int];
}
function get_4()
{
return fread($this->fp, 4);
}
// einen String vom Server holen
function get_string()
{
while(($char = fread($this->fp, 1)) != chr(0))
{
$str .= $char;
}
return $str;
}
// Challenger vom Server holen
function ch()
{
$this->connect();
$this->send_strcmd("W");
return $this->get_4();
fclose($this->fp);
}
// Infos vom Server holen
function infos()
{
$this->connect();
$this->send_strcmd("TSource Engine Query");
$this->get_int32();
$this->get_byte();
//$this->serverinfo["protokoll"] = $this->get_byte();
$this->get_byte();
$this->serverinfo["name"] = $this->get_string();
$this->serverinfo["map"] = $this->get_string();
$this->serverinfo["directory"] = $this->get_string();
$this->serverinfo["discription"]= $this->get_string();
//$this->serverinfo["steam_id"] = $this->get_int16();
$this->get_int16();
$this->serverinfo["players"] = $this->get_byte();
$this->serverinfo["maxplayers"] = $this->get_byte();
$this->serverinfo["bot"] = $this->get_byte();
fclose($this->fp);
return $this->serverinfo;
}
// Player-Liste vom Server holen
function players()
{
$challenge = $this->ch;
$this->connect();
$this->send_strcmd("U".$challenge);
$this->get_int32();
$this->get_char();
$playercount = $this->get_byte();
for($i=0; $i < $playercount; $i++)
{
$this->playerlist[$i]["index"] = $this->get_byte();
$this->playerlist[$i]["name"] = $this->get_string();
$this->playerlist[$i]["frags"] = $this->get_int32();
$this->playerlist[$i]["time"] = date('H:i:s', round($this->get_float32(), 0)+82800);
}
fclose($this->fp);
return $this->playerlist;
}
/*
// Rules-Liste (CVARs) vom Server holen
function cvars()
{
$this->connect();
$this->send_strcmd("V");
$this->get_int32();
$this->get_char();
$cvarcount = $this->get_int16();
for($i=0; $i < $cvarcount; $i++)
{
$this->cvarlist[$this->get_string()] = $this->get_string();
}
fclose($this->fp);
return $this->cvarlist;
}
*/
};
?>
Code: Alles auswählen
Fatal error: Maximum execution time of 30 seconds exceeded in C:\Programme\Apache Group\Apache2\htdocs\server\server.inc on line 70