ISt nicht schwer.
Spieler Liste
PHP Code:
<?php
if(get_option('tme_dbname') && get_option('tme_dbhost') && get_option('tme_dbuser') && get_option('tme_dbpass')){
$dbname = stripslashes(get_option('tme_dbname'));;
$dbhost = stripslashes(get_option('tme_dbhost'));;
$dbuser = stripslashes(get_option('tme_dbuser'));;
$dbpass = stripslashes(get_option('tme_dbpass'));;
$db_tabele = "stats";
$db_field_player = "player";
$db_field_joins = "joins";
$db_field_lastjoin = "lastjoin";
$db_field_playtime = "playtime";
$db_field_firstjoin = "firstjoin";
$db_field_chatchar = "chatchar";
$db_field_chats = "chats";
$db_field_placed = "placed";
$db_field_broke = "broke";
$datums_format = 'd.m.Y';
$zeit_format = 'H:i';
function intervall($sek) {
$i = sprintf('%d H%s,'.
' %d Min%s %d Sek%s',
$sek / 3600,
floor($sek) != 1 ? '':'',
$sek / 60 % 60,
floor($sek / 60 % 60) != 1 ? '':'',
$sek % 60,
floor($sek % 60) != 1 ? '':''
);
return $i;
}
mysql_connect( $dbhost, $dbuser, $dbpass);
mysql_select_db($dbname);
$res = mysql_query('select * from '.$db_tabele);
while($dsatz = mysql_fetch_assoc($res))
{
$spieler = $dsatz[$db_field_player];
$skin = 'https://minotar.net/avatar/'.$spieler.'/30';
$timestamp_last = $dsatz[$db_field_lastjoin];
$datum = date($datums_format,$timestamp_last);
$timestamp_first = $dsatz[$db_field_firstjoin];
$datum_first = date($datums_format,$timestamp_first);
$broken = $dsatz[$db_field_broke];
$placed = $dsatz[$db_field_placed];
$playtimte = intervall($dsatz[$db_field_playtime]);
echo'<tr>';
echo'<td style="color: black">'.$spieler.'</td>';
echo'<td><img src="'.$skin.'"></td>';
echo'<td style="color: black">'.$datum.'</td>';
echo'<td style="color: black">'.$datum_first.'</td>';
echo'<td style="color: black">'.$playtimte.'</td>';
echo'<td style="color: black">'.$broken.'</td>';
echo'<td style="color: black">'.$placed.'</td>';
}
}else{
echo'<tr>';
echo'<td><a style="color: black">Datenbank Einstellungen nicht gefunden<a></td>';
}
?>
</tr>
<tbody>
</table>
Online/Offline
PHP Code:
<?php
if (get_option('tme_PORT')) {
$port = stripslashes(get_option('tme_PORT'));;
} else {
$port = 25565; }
if (get_option('tme_IP')) {
$ip = stripslashes(get_option('tme_IP'));;
} else {
$ip = "217.198.131.160"; }
$txt = ("<a style='color: black'>Spieler: </a>");
$server = ("<a style='color: black'>Server Status: </a>");
print $iptxt;
$fp = @fsockopen($ip, $port, $errno, $errmsg, 10);
if (!$fp) {
$status = ($server ."<a style='color: #FF7D2D'>OFFLINE</a>");
$parts[0] = "Keine Informationen";
$parts[1] = 0;
$parts[2] = 0;
} else {
$status = ($server ."<a style='color: #858720'>ONLINE</a>");
fwrite($fp, "\xFE");
$answer = fread($fp, 256);
if ($answer[0] != "\xFF") {
$parts[0] = "Keine Informationen";
$parts[1] = 0;
$parts[2] = 0;
fclose($fp);
} else {
$text = substr($answer, 3);
$text = mb_convert_encoding($text, 'auto', 'UCS-2');
$parts = explode("\xA7", $text);
$spieler = ($txt . "<a style='color:black'> (" . $parts[1] . "/" . $parts[2] . ")</a>");
$MOTD = ("<a style='color: black'>" . $parts[0] ."</a>");
Global $status, $spieler, $MOTD;
}
}
?>