PHP Classes

File: sstatus.class.php

Recommend this page to a friend!
  Classes of Markus K.   SStatus   sstatus.class.php   Download  
File: sstatus.class.php
Role: Class source
Content type: text/plain
Description: Class File
Class: SStatus
Check whether a remote server is accessible
Author: By
Last change: Add new functions
Date: 16 years ago
Size: 1,863 bytes
 

Contents

Class file image Download
<?

########################################
######### SStatus Script ########
######### by Markus Köplin ########
########################################
######### Questions? Ask me! ########
######### ICQ: 200915138 ########
########################################


class sstatus
   
{
   
############ This shows the "About" ############
       
function about() {
        echo
'<center>';
        echo
'######################################<br />';
        echo
'########### Server Status Script ###########<br />';
        echo
'######################################<br />';
        echo
'Used to check Server Status and many more ;)<br />';
        echo
'</center>';
        }
       
############ This checks the given IP-Adress ############
       
function server($addr){
         if(
strstr($addr,"/")){$addr = substr($addr, 0, strpos($addr, "/"));}
         return
$addr;
        }
       
   
############ This is the main function ############
       
function status($addr="",$port=80,$timeout=3) {
        if(
$addr=="") $addr = $_SERVER['REMOTE_ADDR'];
       
$churl = fsockopen($addr, $port, $errno, $errstr, $timeout);
             if (!
$churl)
                 {
                    echo
'Server is Offline'; ############ Server is now offline ############
               
}
             else
                 {
                     echo
'Server is Online'; ############ Server is now online ############
                 
}
            }
       
        function
portcheck($addr,$timeout,$port) {
                if(
$addr=="") $addr = $_SERVER['REMOTE_ADDR']; ############ If Ip-Address not given replace it with own IP ############
               
$churl = @fsockopen($addr, $port, $errno, $errstr, $timeout);
                        if (!
$churl)
                        {
                            echo
"Port $port do not run"; ############ This port is not used ############
                       
}
                        else
                        {
                            echo
"Port $port run"; ############ This port is used and marked red ############
                       
}
                   
                }
            }
?>