Jump to content
  • 0
Takuyakii

Convert old status.php into newest

Question

Can someone re convert this into new or any compatibility because this is so old files.

Please help me Thank you

<?php if (!defined('FLUX_ROOT')) exit; 

$title = Flux::message('ServerStatusTitle');
$cache = FLUX_DATA_DIR.'/tmp/ServerStatus.cache';

if (file_exists($cache) && (time() - filemtime($cache)) < (Flux::config('ServerStatusCache') * 600)) {
    $serverStatus = unserialize(file_get_contents($cache));
}
else {
    $serverStatus = array();
    foreach (Flux::$loginAthenaGroupRegistry as $groupName => $loginAthenaGroup) {
        if (!array_key_exists($groupName, $serverStatus)) {
            $serverStatus[$groupName] = array();
        }

        $loginServerUp = $loginAthenaGroup->loginServer->isUp();

        foreach ($loginAthenaGroup->athenaServers as $athenaServer) {
            $serverName = $athenaServer->serverName;

            $sql = "SELECT COUNT(char_id) AS players_online FROM {$athenaServer->charMapDatabase}.char WHERE online > 0";
            $sth = $loginAthenaGroup->connection->getStatement($sql);
            $sth->execute();
            $res = $sth->fetch();

            $serverStatus[$groupName][$serverName] = array(
                'loginServerUp' => $loginServerUp,
                'charServerUp' => $athenaServer->charServer->isUp(),
                'mapServerUp' => $athenaServer->mapServer->isUp(),
                'playersOnline' => intval($res ? $res->players_online : 0)
            );
        }
    }
    
    $fp = fopen($cache, 'w');
    if (is_resource($fp)) {
        fwrite($fp, serialize($serverStatus));
        fclose($fp);
    }
}
$online = "<img src='".$this->themePath('img/online.png')."' alt=\"Online\"/>";
$offline = "<img src='".$this->themePath('img/offline.png')."' alt=\"Offline\"/>";
?> 
<?php foreach ($serverStatus as $privServerName => $gameServers): ?>
<?php foreach ($gameServers as $serverName => $gameServer): ?>

<div style="width:100%; height:100%; margin:0 auto;">
<div class="online_count">
<table width="100%" border="0">
  <tr>
    <td align="center">
	<p style="font-size:35px; margin-top:0px; font-weight:normal; font-family:'Visitor TT2 BRK'" align="center">
	<?php echo $gameServer['playersOnline'] ?>
	</p>
</td>
  </tr>
</table>
</div>
<div class="online_peak">
<table width="100%" border="0">
  <tr>
    <td align="center">
<font style="font-size:12px; font-weight:normal; font-family:'Visitor TT2 BRK'; color:#00CCFF;"><?php include('highest_peak.php'); ?></font>
	</td>
  </tr>
</table>
</div>
<div class="server_time">
<table width="100%" border="0">
  <tr>
    <td align="center">
<font style="font-size:12px; font-weight:normal; font-family:'Visitor TT2 BRK'; color:#CCC;"><?php include('status_time.php'); ?></font>
	</td>
  </tr>
</table>
</div>
		<div style="position:absolute; margin-left:285px; height:40px; width:200px; border:none;">
	<div class="char"><?php if ( $charserver[0] == $online ) { echo $online; } else { echo $offline; } ?></div>
	<div class="map"><?php if ( $mapserver[0] == $online ) { echo $online; } else { echo $offline; } ?></div>
	<div class="login"><?php if ( $loginserver[0] == $online ) { echo $online; } else { echo $offline; } ?></div>
			</div>
		</div>

    <?php endforeach ?>
<?php endforeach ?>

 

Edited by Takuyakii
Link to comment
Share on other sites

1 answer to this question

Recommended Posts

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.