Jump to content
  • 0

Status of the Web site server


kisoft

Question


  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  41
  • Reputation:   0
  • Joined:  08/02/13
  • Last Seen:  

Here is my concerns(marigolds), I would like to integrate(join) on my site which is on the host of the waiter(server) this : 

 

 

<?php

include("config.php");
 
$Status = ServerStatus();
/*
 * HTML Content (Edit what you wont)
 */
// Start HTML ?>
 
<table border="0">
  <tr>
    <td><?php echo $Str_Loginsrv; ?></td>
    <td><?php echo $Status[0]; ?></td>
  </tr>
  <tr>
    <td><?php echo $Str_Charsrv; ?></td>
    <td><?php echo $Status[1]; ?></td>
  </tr>
  <tr>
    <td><?php echo $Str_Mapsrv; ?></td>
    <td><?php echo $Status[2]; ?></td>
  </tr>
  <tr>
      <td><?php echo $Str_onlinepl; ?></td>
      <td><?php echo PlayerCount(); ?></td>
  </tr>
</table>
 
<?php // End HTML
 
 
/*
 * Functions (Script by EaScriptable.de.vu)
 * Non Licensed (do what you want)
 */
 
    /*
     * Server Status (Return Array of Login,Char,Map State)
     */
    function ServerStatus() {
        Global $Srv_Host, $Srv_Login, $Srv_Char, $Srv_Map, $Str_Online, $Str_Offline;
        // Disable Error Reporting (for this function)
        error_reporting(0);
        
        $Status = array();
        $LoginServer = fsockopen($Srv_Host, $Srv_Login, $errno, $errstr, 1);
        $CharServer = fsockopen($Srv_Host, $Srv_Char, $errno, $errstr, 1);
        $MapServer = fsockopen($Srv_Host, $Srv_Map, $errno, $errstr, 1);
        if(!$LoginServer){ $Status[0]= $Str_Offline;  } else { $Status[0] = $Str_Online; };
        if(!$CharServer){ $Status[1] = $Str_Offline;  } else { $Status[1] = $Str_Online; };
        if(!$MapServer){ $Status[2] = $Str_Offline;  } else { $Status[2] = $Str_Online; };
        return $Status;
    }
    
    /*
     * Online Player count (Return Array of Player Count as integer)
     */
    function PlayerCount() {
    Global $Srv_Host, $Srv_Username,$Srv_Password,$Srv_Database;           
    $Connection = mysql_connect($Srv_Host, $Srv_Username, $Srv_Password) or die(mysql_error());
    mysql_select_db($Srv_Database, $Connection);
    $query = "SELECT COUNT(*) as total FROM `char` WHERE online = '1'";
    $cresult = mysql_query($query, $Connection);
    mysql_close($Connection);
    $resarray = mysql_fetch_array($cresult);
    $playeronline = $resarray["total"];
    return $playeronline;
    }
?>
To visualize(display) the state of the server
and :
 
<?php
/*
 * Configurations file (rAthena Status)
 * Writen by Lawliet (EaScriptable.de.vu)
 * Non Licensed (do what you want)
 * 
 */
 
$Srv_Host = "192.168.0.4";
 
// Login, Char, Map Server Port
$Srv_Login = 6900;
$Srv_Char = 6121;
$Srv_Map = 5121;
// Database Settingsipmysql:127.0.0.1
$Srv_Database = "**************";
$Srv_Username = "************";
$Srv_Password = "*************";
 
// Status Text
$Str_Loginsrv =  "Login Server:";
$Str_Charsrv =  "Char Server:";
$Str_Mapsrv =   "Map Server:";
$Str_onlinepl = "Player Online:";
 
$Str_Online = '<font color="green">Online</font>';     // (Online) + COLOR
$Str_Offline = '<font color="red">Offline</font>';   // (Offline) + COLOR
?>

 

 

Which(Who) connects to the server etc...
But concerns(marigolds) it is because when I go on the internet page, he(it) marks me that the server refuses him(her) the access, have you a solution?
Edited by kisoft
Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

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...