Server Status Script

Results 1 to 10 of 10
  1. #1
    Enthusiast Nortie is offline
    MemberRank
    Aug 2007 Join Date
    49Posts

    Server Status Script

    Here is a PHP script you can use for every game to check it's online status, I build this in cause of many people are always curious if the server is online or offline.

    Most likely the login and the game server itself got another port they use, so give in the right port at $port and $port2
    Live test:
    http://www.nortfor.com/ostatus/

    Hopefully you like it:
    PHP Code:
    <?php 
      $serverip 
    "YOUR SERVER-IP HERE";
      
    $serverip2 "YOUR SERVER-IP HERE";
     
      
    $port "PORT OF SERVER";
      
    $port2 "PORT OF SERVER";
      echo 
    statuscheck($serverip$port);
      echo 
    statuscheck2($serverip2$port2);

    function 
    statuscheck($serverip$port) {
     
    $sockres = @fsockopen($serverip$port$errno$errstr1);
     if (!
    $sockres) {
      return 
    "
      
     <tr>
      <td>
       <img src=indexoff_01.gif width=175 height=45 alt=IOffline><br></td></tr>"
    ;
     } else {
      @
    fclose($sockres);
      return 
    "<tr><td>
       <img src=indexon_01.gif width=175 height=45 alt=IOnline><br></td></tr>"
    ;
     }
    }
    function 
    statuscheck2($serverip2$port2) {
     
    $sockres = @fsockopen($serverip2$port2$errno$errstr1);
     if (!
    $sockres) {
      return 
    "
      <tr><td>
       <img src=indexoff_02.gif width=175 height=45 alt=ROffline><br></td><tr>"
    ;
     } else {
      @
    fclose($sockres);
      return 
    "<tr><td>
       <img src=indexon_02.gif width=175 height=45 alt=ROnline><br></td></tr>
    "
    ;
     }
    }

    ?>
    The images I used and the PHP file are attached into this post. This script is actually written for VBulletin to use with. If you want to use your own images it's possible. I just attached these if you'll need them.

    if you dont get it to work, post your question here.


    Please comment it.

    Nortie
    Attached Files Attached Files


  2. #2
    Gamma Daevius is offline
    MemberRank
    Jun 2007 Join Date
    NetherlandsLocation
    3,252Posts

    Re: Server Status Script

    Ah nice. I will use it :D. I always wanted to do some server connection/data transfer with PHP and some server, but never did any research :P. Thanks :D, now I can work on some complex stuff for data transfer for my project loller :D

  3. #3
    Proficient Member Maitokahvi is offline
    MemberRank
    Sep 2007 Join Date
    In Zoo :PLocation
    155Posts

    Re: Server Status Script

    Nice. Can you make worldlog server.

  4. #4
    Enthusiast Nortie is offline
    MemberRank
    Aug 2007 Join Date
    49Posts

    Re: Server Status Script

    Quote Originally Posted by Maitokahvi View Post
    Nice. Can you make worldlog server.
    What do you mean by a worldlog server, I can sure give it a try, if you give me more specific information about it.

  5. #5
    Proficient Member Maitokahvi is offline
    MemberRank
    Sep 2007 Join Date
    In Zoo :PLocation
    155Posts

    Re: Server Status Script

    Images and for those images online script

  6. #6
    Proficient Member Maitokahvi is offline
    MemberRank
    Sep 2007 Join Date
    In Zoo :PLocation
    155Posts

    Re: Server Status Script

    i think better script is.
    <?
    Error_reporting(0);
    $fp = @fsockopen('ip here', porthere, $errno, $errstr, 2);
    if($fp){ '<font color=green>Online</font>'; }
    else{ echo '<font color=red>Offline</font>'; }
    ?>

  7. #7
    Enthusiast Nortie is offline
    MemberRank
    Aug 2007 Join Date
    49Posts

    Re: Server Status Script

    I think you could also use text instead of images, but it's just what you want for yourself. You could use error_reporting... but use it like this than: ERROR_REPORTING(E_ALL);

    using 0 won't help much tho.

    and I my scripts I always keep it easy for others to use, but I guess it wont make any more clear for other users in here, thats why I used a variable to input the IP and the portnumber, I'll call it "customer service"

  8. #8
    Proficient Member Maitokahvi is offline
    MemberRank
    Sep 2007 Join Date
    In Zoo :PLocation
    155Posts

    Re: Server Status Script

    okey.

  9. #9
    Enthusiast Nortie is offline
    MemberRank
    Aug 2007 Join Date
    49Posts

    Re: Server Status Script

    Yep, if you trying to help people out, you must know you need to keep it easy for others to use, and don't have them to make many difference into your script, 1 mistake could destroy your whole script of not working anymore

  10. #10
    Member SS4 Goku is offline
    MemberRank
    Jun 2007 Join Date
    The NetherlandsLocation
    90Posts

    Re: Server Status Script

    Thanks it helped me.

    OFFTOPIC: I can't find the search button :S lol after 3 weeks....



Advertisement