[Guide]Server Status and Players Status on PHP-Nuke (my way)

Results 1 to 4 of 4
  1. #1
    Newbie BraveWarrior is offline
    MemberRank
    May 2006 Join Date
    2Posts

    [Guide]Server Status and Players Status on PHP-Nuke (my way)

    Well, i will show to you guys the way that i found to costumize a Server and Players Status on PHP-Nuke as i wanna. This one can work for how many servers you want to, i am teaching for two servers only.

    Step 1- The Scripts. They must be saved at your local shared folder. Ex: inside "www" folder.
    <-- Server Status Script -->
    (this file must be called status.php)
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Brave Warriors Server Status</title>
    <?
    $loginIP = "127.0.0.1";
    $gameIP = "xxx.xxx.xxx";
    $loginPORT= "2106";
    $gamePORT= "7777";
    $gamePORT2= "7778";
    ?>
    <style type="text/css">
    <!--
    .style1 {font-family: Times New Rooman**
    body {
    margin-left: 0px;
    margin-top: 0px;
    **
    .style5 {font-family: Times New Roman; font-weight: Strong; font-size: 12px; **
    .style6 {font-size: 12px; font-weight: strong; **
    -->
    </style>
    </head>

    <body background="youraddress/background.jpg">
    <table width="142" border="0" cellpadding="0" cellspacing="0" marginheight="0" marginwidth="0" margintop="0">
    <tr>
    <td width="200"><div align="Left" class="style5">
    <div align="left"><strong><font color="#770000">Login Server is Currently:</font></strong></div>
    </div></td>
    </tr>
    <tr>
    <td width="212"><div align="Left" class="style6"><span class="style1">
    <? error_reporting(0); $flogin = fsockopen ("$loginIP",$loginPORT, $errno, $errstr, 0);
    if ($flogin)
    {
    print "<span style=\"font-weight: Strong; font-size: 15px; color: #006600;\">ONLINE</span>";**

    else
    { print "<span style=\"font-weight: Strong; font-size: 15px; color: #FF0000;\">OFFLINE</span>";**

    ?>
    </span></div></td>
    </tr>
    <tr>
    <td width="200"><div align="Left" class="style5">
    <div align="Left"><strong><font color="#770000">PvE Server is Currently:</font></strong></div>
    </div></td>

    </tr>
    <tr>
    <td width="212"><div align="Left" class="style6"><span class="style1">
    <? error_reporting(0); $fgame = fsockopen ("$gameIP",$gamePORT, $errno, $errstr, 0);
    if ($fgame){print "<span style=\"font-weight: Strong; font-size: 15px; color: #006600;\">ONLINE</span>";**
    else {print "<span style=\"font-weight: Strong; font-size: 15px; color: #FF0000;\">OFFLINE</span>";**

    ?>
    </span></div></td>
    </tr>
    <tr>
    <td width="200"><div align="Left" class="style5">
    <div align="Left"><strong><font color="#770000">PvP Server is Currently:</font></strong></div>
    </div></td>

    </tr> <td width="212"><div align="Left" class="style6"><span class="style1">
    <? error_reporting(0); $fgame = fsockopen ("$gameIP",$gamePORT2, $errno, $errstr, 0);
    if ($fgame){print "<span style=\"font-weight: Strong; font-size: 15px; color: #006600;\">ONLINE</span>";**
    else {print "<span style=\"font-weight: Strong; font-size: 15px; color: #FF0000;\">OFFLINE</span>";**

    ?>
    </span></div></td>
    </table>
    </body>
    </html>
    <-- Players Status Script -->
    For the firist server:
    (this file must be called pveonline.php)
    <body background="youraddress/background.jpg">
    <?php
    $db_user = "xxxx"; //your sql username goes here
    $db_pass = "xxxx"; //your sql password goes here
    $db_name = "l2jdb"; //your database name goes here
    $db_serv = "localhost"; //the address of the database goes here
    $db = mysql_connect ( $db_serv, $db_user, $db_pass ) or die ("Coudn't connect to [$db_serv]");
    mysql_select_db ( $db_name );
    $querynumeroplayer="SELECT count(*) FROM characters WHERE online = '1'";
    $result = mysql_query($querynumeroplayer);
    $numeroonline = mysql_result ($result, 0, 0);
    echo"<font size=\"2\" color=\"#770000\">PvE Server: </font><font size=\"2\"><font color=\"#008000\">$numeroonline</font>"
    . "</font>"
    ."";
    ?>
    </body>
    For the second server:
    (this file must be called pvponline.php)
    <body background="youraddress/background.jpg">
    <?php
    $db_user = "xxxx"; //your sql username goes here
    $db_pass = "xxxx"; //your sql password goes here
    $db_name = "l2jdb"; //your database name goes here
    $db_serv = "localhost"; //the address of the database goes here
    $db = mysql_connect ( $db_serv, $db_user, $db_pass ) or die ("Coudn't connect to [$db_serv]");
    mysql_select_db ( $db_name );
    $querynumeroplayer="SELECT count(*) FROM characters WHERE online = '1'";
    $result = mysql_query($querynumeroplayer);
    $numeroonline = mysql_result ($result, 0, 0);
    echo"<font size=\"2\" color=\"#770000\">PvP Server: </font><font size=\"2\"><font color=\"#008000\">$numeroonline</font>"
    . "</font>"
    ."";
    ?>
    </body>
    Step 2- The blocks will be shown as iFrame(simple HTML code).
    To set a block with these lines you just need to add a new block at the administration menu. On "Tittle:" Choose a name and then on "Content:" paste the lines.
    They gonna be shown in only one block. There are the lines:

    <body>

    <iframe
    name="Server Status" src ="youraddress/status.php" marginheight="0" marginwidth="0" scrolling="no" border="0" frameborder="0" width="150" height="100">
    </iframe>

    <br>

    <iframe
    name="Players Online1" src ="youraddress/pveonline.php" marginheight="0" marginwidth="0" scrolling="no" border="0" frameborder="0" width="150" height="21">
    </iframe>

    <br>

    <iframe
    name="Players Online2" src ="youraddress/pvponline.php" marginheight="0" marginwidth="0" scrolling="no" border="0" frameborder="0" width="150" height="21">
    </iframe>

    </body>
    ---------------------------------------------
    What lines do you must to change:
    1-On status.php find:
    <?
    $loginIP = "127.0.0.1";
    $gameIP = "xxx.xxx.xxx";
    $loginPORT= "2106";
    $gamePORT= "7777";
    $gamePORT2= "7778";
    ?>
    1.1- Where 127.0.0.1 must be your loggin addres(normaly 127.0.0.1)
    1.2- xxx.xxx.xxx must be your Game IP
    1.3- 2106 must be your Login Port
    1.4- 7777 and 7778 must be your firist and second Game Port
    1.5-On status.php find:
    <body background="youraddress/background.jpg">
    where youraddress/background.jpg must be your background image addres. If you don't have any just remove this line.

    2-On pveonline.php find:
    <body background="youraddress/background.jpg">
    <?php
    $db_user = "xxxx"; //your sql username goes here
    $db_pass = "xxxx"; //your sql password goes here
    $db_name = "l2jdb"; //your database name goes here
    $db_serv = "localhost"; //the address of the database goes here
    2.1-where youraddress/background.jpg must be your background image addres. If you don't have any just remove this line.
    2.2- xxxx must be your sql username
    2.3- xxxx must be your sql password
    2.4- l2jdb must be your database name
    2.5- localhost must be your database address

    3- Do the same step on pvponline.php

    4- The iFrame code:
    On iFrame code find:
    name="Server Status" src ="youraddress/status.php"
    4.1- youraddress/status.php must be where your status.php file address
    4.2- on iFrame code find:
    name="Players Online1" src ="youraddress/pveonline.php"
    youraddress/pveonline.php must be where your pveonline.php file address
    4.3- on iFrame code find:
    name="Players Online2" src ="youraddress/pvponline.php"
    youraddress/pvponline.php must be where your pvponline.php file address

    Obs:
    There must be another way to do the script, but that is the best way that i found to costumize as i wanna.

    There is a example: lineage clanbrw com (where "space" means a "dot" lol)

    I hope that can help you, if you get any problem post here.
    Last edited by BraveWarrior; 31-05-06 at 04:46 AM.


  2. #2
    Sorcerer Supreme jotac is offline
    Member +Rank
    Jan 2006 Join Date
    In your pc.Location
    393Posts
    this is for 1 or 2 servers? O.o

  3. #3
    Elite Member dubidios is offline
    Member +Rank
    Oct 2005 Join Date
    MLocation
    105Posts
    share please.....It will be easier for all

    thanks!

  4. #4
    Newbie BraveWarrior is offline
    MemberRank
    May 2006 Join Date
    2Posts
    this one is for 2 servers, to do for only one server you just must to remove some lines

    on status.php:
    $gamePORT2= "7778";
    <td width="200"><div align="Left" class="style5">
    <div align="Left"><strong><font color="#770000">PvP Server is Currently:</font></strong></div>
    </div></td>

    </tr> <td width="212"><div align="Left" class="style6"><span class="style1">
    <? error_reporting(0); $fgame = fsockopen ("$gameIP",$gamePORT2, $errno, $errstr, 0);
    if ($fgame){print "<span style=\"font-weight: Strong; font-size: 15px; color: #006600;\">ONLINE</span>";**
    else {print "<span style=\"font-weight: Strong; font-size: 15px; color: #FF0000;\">OFFLINE</span>";**

    ?>
    </span></div></td>

    on iFrame code remove:
    <br>

    <iframe
    name="Players Online2" src ="youraddress/pvponline.php" marginheight="0" marginwidth="0" scrolling="no" border="0" frameborder="0" width="150" height="21">
    </iframe>

    </body>
    and then that'll be displayed for only one serve. you can also change the graphic by only editing simple HTML on a visual editor.

    about the Share i will do that after i come back from school.

    there is a screen shot if the website doesn't works.
    Attached Thumbnails Attached Thumbnails image.jpg  



Advertisement