mirror of
https://github.com/Znote/ZnoteAAC.git
synced 2025-10-20 04:43:26 +02:00
serverinfo cleanup, fix cache, query optimizations
This commit is contained in:
@@ -1,34 +1,27 @@
|
||||
<?php
|
||||
$cache = new Cache('engine/cache/asideServerInfo');
|
||||
if ($cache->hasExpired()) {
|
||||
$asideServerInfo = mysql_select_single("
|
||||
SELECT
|
||||
(SELECT COUNT(`id`) FROM `accounts`) as `accounts`,
|
||||
(SELECT COUNT(`id`) FROM `players`) as `players`,
|
||||
(SELECT COUNT(`player_id`) FROM `players_online`) as `online`
|
||||
");
|
||||
$cache->setContent($asideServerInfo);
|
||||
$cache->save();
|
||||
} else {
|
||||
$asideServerInfo = $cache->load();
|
||||
}
|
||||
?>
|
||||
<div class="well widget">
|
||||
<div class="header">
|
||||
Server Information
|
||||
</div>
|
||||
<div class="body">
|
||||
<ul>
|
||||
<?php
|
||||
$status = true;
|
||||
if ($config['status']['status_check']) {
|
||||
@$sock = fsockopen ($config['status']['status_ip'], $config['status']['status_port'], $errno, $errstr, 1);
|
||||
if(!$sock) {
|
||||
echo "<span style='color:red;font-weight:bold;'><center>Server Offline!</center></span><br/>";
|
||||
$status = false;
|
||||
}
|
||||
else {
|
||||
$info = chr(6).chr(0).chr(255).chr(255).'info';
|
||||
fwrite($sock, $info);
|
||||
$data='';
|
||||
while (!feof($sock))$data .= fgets($sock, 1024);
|
||||
fclose($sock);
|
||||
echo "<span style='color:green;font-weight:bold;'><center>Server Online!</center></span><br />";
|
||||
}
|
||||
}
|
||||
if ($status) {
|
||||
?>
|
||||
<li><a href="onlinelist.php">Players online:
|
||||
<?php echo user_count_online(); ?></a></li>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<li>Registered accounts: <?php echo user_count_accounts();?></li>
|
||||
<li><a href="onlinelist.php">Players online: <?php echo $asideServerInfo['online']; ?></a></li>
|
||||
<li>Registered accounts: <?php echo $asideServerInfo['accounts'];?></li>
|
||||
<li>Registered players: <?php echo $asideServerInfo['players'];?></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user