ich habe ein kleines Problem mit meinem Forum.
Möchte eine neue Box mit Server Stats dazufügen, das Problem ist das Script ist in PHP.
serverstats.php
Code: Alles auswählen
<?
//config
$cfg['server_ip'] = "xxx.xxx.xxx.xxx";
$cfg['server_port'] = 7171;
//server packet that needs to be sent to get info
$info = chr(6).chr(0).chr(255).chr(255).'info';
//making socket connection to an ip and port 7171
$sock = @fsockopen($server_ip, 7171, $errno, $errstr, 1);
//show source request
if($_REQUEST['action']=='source'){
highlight_file(__FILE__);
}
else{
if ($sock)
{
//writes the info gotten by sending the server packet.
fwrite($sock, $info);
$data='';
while (!feof($sock))
{
$data .= fgets($sock, 1024);
}
fclose($sock);
//players online and max (ex. Players online: 24 / 100)
preg_match('/players online="(\d+)" max="(\d+)"/', $data, $matches);
echo '<p>Status:<b><font color="#00FF00"> Online</font></b>';
echo '<br />Players: '.$matches[1].' / '.$matches[2];
//Uptime (Uptime: 23h 12m)
preg_match('/uptime="(\d+)"/', $data, $matches);
$d = floor($matches[1] / 86400);
$Rest1 = $matches[1]-($d*86400);
$h = floor($Rest1 / 3600);
$Rest2 = $Rest1-($h*3600);
$m = floor($Rest2 / 60);
$Rest3 = $Rest2-($m*60);
$s = floor($Rest3);
echo '<br />Uptime: '. $d .'d '. $h .'h '. $m. 'm '. $s .'s</p>';
}
else
{
echo '<p>Server Status:<b><font color="#FF0000"> Offline</font></b></p>';
}
}
?>
Code: Alles auswählen
<div class="tabhead">
<span class="dt">Server Stats</span></div>
<div class="tabcell">
<span class="dn">
<!-- INCLUDE serverstats.php -->
</span></div>
Wie kann ich also .php Datein includen so das sie angezeigt werden?