Glizer:DE/Stats
Glizer Statistiken[Bearbeiten]
Damit die Statistiken für deinen Server funktionieren benötigst du ein spezielles Skript welches die Informationen ausliefert.
Dieses Beispiel ist für LogBlock, iConomy und MySQL - Installiere LogBlock und iConomy auf deinem Minecraft Server mit MySQL-Support und lade dieses PHP Skript auf deinen Webserver. Dann füge die URL in deinen Server Detail auf glizer.de ein.
Beachte das dieses Skript schon etwas älter ist, iConomy als inaktive vermerkt ist und es viel Anpassungen an deinen Server benötigt.
<?php $database = '##DATABASE##'; $link = mysql_connect('##HOST##', '##USERNAME##', '##PASSWORD##',true); if (!$link) { die('Could not connect to database'); } $action = mysql_query('SET CHARACTER SET utf8',$link); mysql_select_db($database,$link); if(!$_REQUEST['data']) die(); $usr = mysql_escape_string($_REQUEST['data']); $qry = 'SELECT TYPE , SUM(created) AS created, SUM(destroyed) AS destroyed FROM ( ( SELECT TYPE , count(type) AS created, 0 AS destroyed FROM `lb-main` INNER JOIN `lb-players` USING (playerid) WHERE playername = \.$usr.'\' AND TYPE >0 GROUP BY TYPE ) UNION ( SELECT replaced AS TYPE , 0 AS created, count(replaced) AS destroyed FROM `lb-main` INNER JOIN `lb-players` USING (playerid) WHERE playername = \.$usr.'\' AND replaced >0 GROUP BY replaced) ) AS t GROUP BY TYPE ORDER BY SUM(created) + SUM(destroyed) DESC;'; $res = mysql_query($qry); $data = array(); while($r = mysql_fetch_assoc($res)) { $data['p'] += $r['created']; $data['d'] += $r['destroyed']; $data['b'][$r['TYPE']] = array($r['created'],$r['destroyed']); } $qry = 'SELECT count(*) as chests FROM `lb-world` INNER JOIN `lb-players` USING (playerid) WHERE playername = \.$usr.'\' AND type = replaced and replaced = 54'; $r = mysql_fetch_assoc(mysql_query($qry)); $data['c'] = $r['chests']; $qry = 'SELECT balance from iConomy WHERE username = \.$usr.'\; $r = mysql_fetch_assoc(mysql_query($qry)); $data['m'] = $r['balance']; $qry = 'SELECT count(*) as t from protections WHERE owner = \.$usr.'\; $r = mysql_fetch_assoc(mysql_query($qry)); $data['s'] = $r['t']; echo json_encode($data);