Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- ## Settings
- // array of servers (IP, Port, Service Name)
- $servers = array (
- array ('89.187.131.194', '2106', 'Login Server'),
- array ('188.40.142.18', '7779', 'Game Server')
- );
- //end array
- //sql info for user count
- $timeout = 1;
- $host = '188.40.142.18:3306'; //Hostname
- $user = 'user'; //Mysql Username
- $pass = 'pass'; //Mysql Password
- $dbgs = 'nameofdb'; //Database Game Server
- //end info
- ## Connect to MySql Using Settings
- //mysql connect
- $conn = mysql_connect($host, $user, $pass) or die(mysql_error());
- mysql_select_db($dbgs, $conn) or die(mysql_error());
- //end mysql connect
- ##Count the players in the database
- //count players
- $sql = "SELECT * FROM `players` WHERE `online` = 1 ";
- $result = mysql_query($sql, $conn) or die(mysql_error());
- $count = 0;
- while ($dados = mysql_fetch_array($result)) {
- $count++;
- }
- //end count
- ## Display
- //display server status
- foreach ($servers as $server) {
- $fp = @fsockopen($server[0], $server[1], $errno, $errstr, $timeout);
- if (!$fp) {
- echo $server[2], ': <font color="#FF0000">Offline</font><br>
- ';
- } else {
- echo $server[2], ': <font color="#00DF00">Online </font><br>
- ';
- fclose($fp);
- }
- }
- echo '<font color="#000000">Verze: 1.5.1.10</font>';
- //end server status display
- //display player count
- echo '<br><font size=2><b>Players Online: </b></font> : <font size=2 color=#33FF00><b>'.$count, '</b></font>';
- echo '<br>
- <font color="#000000">Raty:</font><br><font color="#000000">|</font><font color="#FF8C00">3</font><font color="#000000">|</font><font color="#FF8C00">3</font><font color="#000000">|</font><font color="#FF8C00">2</font><font color="#000000">|</font><font color="#FF8C00">3</font><font color="#000000">|</font><font color="#FF8C00">2</font><font color="#000000">|</font><font color="#FF8C00">2</font><font color="#000000">|</font>';
- //end display
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement