+ Reply to Thread
Results 1 to 1 of 1

Thread: PHP Help

  1. #1
    Member
    Join Date
    Apr 2008
    Posts
    45

    PHP Help

     
    I didn't write this code but I was curious if I could make it display Ping and the number of Players connected as well as the Online/Offline status it already displays.

    Code:
    <?php
    // Language constants.  Translate into your native language if needed.
    $language = array(
        'server_online' => 'Age of War is <font color="#04B404">Online</font>.',
        'server_offline' => 'Age of War is <font color="#FF0000">Offline</font>.',
    );
    
    // Connection timeout in seconds.  If the script cannot connect to a server before this timeout,
    // then that server is considered to be offline.  Don't make this too big or your website could
    // take a long time to load.
    $timeout = 1;
    
    $RunUo = array(
        'check' => true,             // Should we check the status of the RunUo server? (true or false)
        'ip' => 'play.uoageofwar.com',         // IP of the RunUo server
        'port' => 2593,              // Port of the RunUo server
    );
    
    $output = "";
    
    if ($RunUo['check']) {
        if ($fp = @fsockopen($RunUo['ip'], $RunUo['port'], $errno, $errstr, $timeout)) {
            fclose($fp);
            $RunUo_online = true;
            $output .= "<p>\n";
            $output .= "  ".$language['server_online']."\n";
            $output .= "</p>\n";
        } else {
            $RunUo_online = false;
            $output .= "<p>\n";
            $output .= "  ".$language['server_offline']."\n";
            $output .= "</p>\n";
        }
    }
    
    echo $output;
    ?>
    If you look here, you'll notice third party websites are able to do it so I'm curious if you could do something similar like a Ping/Active Connection check.

    UOGateway - Age of War

    Here is my website if you want to get an idea of how the status looks on the left
    Age Of War | Ultima Online PvP the way it should be.

    I would like for it to look like.

    Age of War is Online

    Players: X
    Ping: X

    In advanced, thanks.
    Last edited by Evanonian; April 4th, 2012 at 04:51 AM.
    "The ultimate measure of a man is not where he stands in moments of comfort, but where he stands at times of challenge and controversy."

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. php help
    By sr71000 in forum Webmastering and Programming
    Replies: 2
    Last Post: February 26th, 2007, 02:03 PM
  2. php coding assistance with templete.php
    By herbal_lavender in forum Webmastering and Programming
    Replies: 2
    Last Post: December 29th, 2005, 09:35 AM
  3. index.php?mode=something.php
    By RyanD in forum Webmastering and Programming
    Replies: 16
    Last Post: October 20th, 2004, 10:20 PM
  4. PHP - Help?
    By Blazer06 in forum Webmastering and Programming
    Replies: 8
    Last Post: September 5th, 2003, 12:29 AM
  5. Need php help
    By iNeb in forum Webmastering and Programming
    Replies: 9
    Last Post: April 10th, 2003, 11:38 PM

Tags for this Thread

Posting Permissions

  • You may post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Recommended Sites: ResellerRatings Store Reviews