Jump to content
  • 0

Convert old status.php into newest


Takuyakii

Question


  • Group:  Members
  • Topic Count:  38
  • Topics Per Day:  0.02
  • Content Count:  206
  • Reputation:   10
  • Joined:  08/30/19
  • Last Seen:  

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

  • 0

  • Group:  Forum Manager
  • Topic Count:  282
  • Topics Per Day:  0.06
  • Content Count:  3123
  • Reputation:   1617
  • Joined:  03/26/12
  • Last Seen:  

Can you explain a little more as to what you're actually asking to be changed? If you're needing an updated status.php file, you can just grab it from the Github Repo.

Link to comment
Share on other sites

×
×
  • Create New...