Jump to content
  • 0

Server Status Problem


Azrael-

Question


  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  23
  • Reputation:   3
  • Joined:  11/14/17
  • Last Seen:  

Help me on these because it seems that it's not showing the status correctly. All IP/s correctly inserted on Servers.php

Status.php

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

$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();
            
            $sqlwoestatus = "SELECT value FROM mapreg WHERE varname = '$\woeStatus' LIMIT 0 , 1";
            $sthwoestatus = $loginAthenaGroup->connection->getStatement($sqlwoestatus);
            $sthwoestatus->execute();
            $woestatusresult = $sthwoestatus->fetch();

            $serverStatus[$groupName][$serverName] = array(
                'loginServerUp' => $loginServerUp,
                'charServerUp' => $athenaServer->charServer->isUp(),
                'mapServerUp' => $athenaServer->mapServer->isUp(),
                'woeStatus' => intval($woestatusresult ? $woestatusresult->value : 0),
                '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/serverOnline.png') . " />";
$offline = "<img src=". $this->themePath('img/serverOffline.png') . " />";
$woeOnline = "<img src=". $this->themePath('img/woeOnline.png') . " />";
$woeOffline = "<img src=". $this->themePath('img/woeOffline.png') . " />";
    foreach ($serverStatus as $privServerName => $gameServers): 
        foreach ($gameServers as $serverName => $gameServer): 
            if ($gameServer['loginServerUp']) { $loginonline = true; } else { $loginonline = false; } 
            if ($gameServer['charServerUp']) { $charonline = true; } else { $charonline = false; }
            if ($gameServer['mapServerUp']) { $maponline = true; } else { $maponline = false; } 
            $onlinecount = $gameServer['playersOnline'];
            $woe_status = $gameServer['woeStatus'];
        endforeach;
    endforeach;
?>



image.png.0ec359524f9d22bcb6504a57fd599a08.png

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  1137
  • Reputation:   290
  • Joined:  04/29/13
  • Last Seen:  

Similar thread

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  23
  • Reputation:   3
  • Joined:  11/14/17
  • Last Seen:  

Hi @Cyro,

All Ports and IP's on Servers.php are correct. Php Socket Connections is also allowed.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  13
  • Topics Per Day:  0.00
  • Content Count:  80
  • Reputation:   2
  • Joined:  04/27/16
  • Last Seen:  

On 11/14/2017 at 3:21 PM, Azrael- said:

Hi @Cyro,

All Ports and IP's on Servers.php are correct. Php Socket Connections is also allowed.

I'm Still looking for a solution on it :) 

Add me on Discord :)

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  13
  • Topics Per Day:  0.00
  • Content Count:  55
  • Reputation:   3
  • Joined:  04/02/12
  • Last Seen:  

You have to make sure that your default ports are allowed for outbound

Link to comment
Share on other sites

×
×
  • Create New...