• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Anything wrong with this code?

Tyson12302

New Member
Joined
Aug 6, 2014
Messages
264
Reaction score
4
PHP:
<div class="mod-tab">
                <div class="module">
                    <div class="module-2">
                        <div class="module-3">
                            <div class="module-4">
                                <div class="module-5 deepest">
                                        <div class="header-container-1">
                                        <div class="header-container-2">
                                            <div class="header-l"></div>
                                            <div class="header-r"></div>
                                            <h3 class="module"><span class="color">Infor</span>mation</h3>
                                        </div>
                                    </div>
                                    <div style="overflow: hidden;">
                                    <?PHP
                                   if($config['status']['serverStatus_online'] == 1)
                                   echo '<font color="limegreen"><b>Server Online</b></font>';
                                else
                                   echo '<font color="red"><b>Sever Offline</b></font>'; ?><br />
                                    Uptime: <?PHP if($config['status']['serverStatus_online'] == 1) echo $config['status']['serverStatus_uptime'].''; else echo '0h 0m'; ?><br />
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
Anything wrong with this code. My Server Status doesnt work. It stays at "Server Offline" even when my server is online.
 
PHP:
<div class="mod-tab">
                <div class="module">
                    <div class="module-2">
                        <div class="module-3">
                            <div class="module-4">
                                <div class="module-5 deepest">
                                        <div class="header-container-1">
                                        <div class="header-container-2">
                                            <div class="header-l"></div>
                                            <div class="header-r"></div>
                                            <h3 class="module"><span class="color">Infor</span>mation</h3>
                                        </div>
                                    </div>
                                    <div style="overflow: hidden;">
                                    <?PHP
                                   if($config['status']['serverStatus_online'] == 1)
                                   echo '<font color="limegreen"><b>Server Online</b></font>';
                                else
                                   echo '<font color="red"><b>Sever Offline</b></font>'; ?><br />
                                    Uptime: <?PHP if($config['status']['serverStatus_online'] == 1) echo $config['status']['serverStatus_uptime'].''; else echo '0h 0m'; ?><br />
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
Anything wrong with this code. My Server Status doesnt work. It stays at "Server Offline" even when my server is online.
Where is the file located?
 
PHP:
echo '<font color="red"><b>Sever Offline</b></font>'; ?><br />
If i change the "Server Offline" to Online it changes on the site no matter what i change it to. I don't get why it doesn't read my server status.
 
This my serverstatus.php
PHP:
<?PHP 
    if($config['status']['serverStatus_online'] == 1) 
        echo '<font color="limegreen"><b>Server Online</b></font>'; 
    else 
        echo '<font color="red"><b>Sever Offline</b></font>';
?><br />
Uptime: <?PHP if($config['status']['serverStatus_online'] == 1) echo $config['status']['serverStatus_uptime'].''; else echo '0h 0m'; ?><br />
Players Online: <?PHP i f($config['status']['serverStatus_online'] == 1) echo $config['status']['serverStatus_players'].''; else echo '0'; ?><br />
Record: <?PHP $record = $SQL->query('SELECT `record` FROM `server_record` ORDER BY `record` DESC LIMIT 1;'); foreach($record as $result) { echo ''.$result['record'].''; } ?><br />
<?PHP
    $plik = "online.txt";
    $czas = 60;
    $t = time();
    $ip = $HTTP_SERVER_VARS['REMOTE_ADDR'];    
    $u = explode("\n", str_replace("\r", "", @join("", @file($plik))));
    foreach($u as $i => $v) {
        $e = explode("|", $v);
        if($e[0] == $ip || $e[1] < $t) unset($u[$i]);
    }
    $u[] = $ip . "|" . ($t + $czas);
    $fp = fopen($plik, "w");
    flock($fp, 2);
    fputs($fp, join("\n", $u));
    flock($fp, 3);
    fclose($fp);
    echo 'Users on page: '.count($u);
?>
</a>
 
It is the same as my. i found this in config.php
PHP:
$config['status'] = array(
        'status_check' => true, //enable or disable status checker
        'status_ip' => '127.0.0.1',
        'status_port' => "7171",
        );
I changed that to true from false, and it didn't work. Also may i see the Information.php since im trying to get the Server Status on my Information widget.

Edit: I used my original code and it worked. I guess it was the Status Checker from false to true that fixed it. I guess that code i had didn't work for some reason.
 
Last edited:
Back
Top