Page 1 of 1

PhP "server status" script

Posted: Wed Dec 23, 2009 4:49 pm
by Orbit Storm
Okay.. so I've recently designed a script that essentially use for server status:


Code: Select all


/////////////////////////////////
/////      Copyright © 2009        /////
///// Orbit Storm & Bloodcraft /////
/////    Server Status Script    /////
///////////////////////////////

<?php
      $server_ip = ""; //Place your server's IP address inside the quotes.
      $server_port = ; //Place your server's port number one space after the equal sign.
      $x = "The server is: ";

      if(fsockopen($server_ip, $server_port, $errno, $errstr, 30))
      {
           $x .= "<b style=\"color:green;\">Online</b>."; //You may add an "online" image in place of the plain text format.
      }   
      else
      {   
           $x .= "<b style=\"color:red;\">Offline</b>."; //You may add an "offline" image in place of the plain text format.
      }

      echo $x;
?> 

Any questions, advice, tips, etc you may direct to me via this thread.