Webmaster Forum  

Go Back   Webmaster Forum > Website Design Forum > Website Design Forum
User Name
Password
Register FAQ Members List Calendar Transactions Store Search Today's Posts Mark Forums Read


Checking Your Server Status

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 08-10-2005, 09:13
admans
Senior Member


Join Date: Jul 2005
Posts: 248
Trader Rating: (0)
Points: 22 (Donate)
5 F$/Referral Refer Friends
admans is on a distinguished road
Default Checking Your Server Status

Checking Your Server Status

This a pretty simple script that will check the status of your server, or it can be used so that anyone can enter the IP or domain of there server and it will check all the common ports.

Here is an example:
http://status.eX13.net

The Code:

PHP Code:
<?php $up = @fsockopen("$ip"80$errno$errstr30);  
    if(
$up)
    {  
       echo 
'Online';  
    }
    else
    {
       echo 
'Offline';
    } 
?>


ok well simple all this does is open a connection to "$ip" on port 80, and then if $up (if the connection was successful) it will echo Online if not it will echo Offline.

If you wanted to use the code for just one server you can replace $ip with either the domain name or the IP. If using the domain name you do not include http:// you would just type domainname.com

The $errno and $errstr are both standard error parameters. The last number "30" is how long the connection should stay open until it is classed as timed out.

If you wanted to make it so that anyone can check the status of there site all you would do is at the top of the page add:

PHP Code:
 $ip$_POST['ip'];
    if(
is_null($ip))
    {
    die();
    }
    else
    {
    echo 
"Server Status Report For $ip";
    } 


What this does is retrieve the posted variable "$ip" and checks if the variable is empty if nothing was entered the script will terminate if something is entered the script will simply carry on what it is meant to be doing.

Now all that needs to be done is too add a form at the top of the page. The form needs a textbox field and a submit button.

PHP Code:
 <form name="form1" method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>">
      <
div align="center">
    <
p>
          <
input name="ip" type="text" value="">
          <
input type="submit" name="Submit" value="Submit">
    </
p


This form will show a text box where anyone can enter any the domain or IP and then when the Submit button is click it will post the data into its self using the command:
PHP Code:
 action="<?php echp $_SERVER['PHP_SELF'] ?>" 

Then the posted information will replace the variable $ip. You could use the code to show more than one port. By simply using the same "fsockopen" command but changing the Port number.

Heres a list of command ports:
HTTP - 80
FTP - 21
SSH - 22
MYSQL - 3306
CPANEL - 2082
WHM - 2086
POP3 - 110
SMTP - 25


Im sure this code will come in handy for someone.
__________________

http://img76.imageshack.us/img76/6450/sc2but4ng.gif | http://img495.imageshack.us/img495/...ogorwtan0je.gif | <a href="http://webtools.sc2.info"><img src="http://img129.imageshack.us/img129/8682/sc2webtan7ju.gif" border="1" width="100" alt="Free Webtools for all" /></a> | <a href="http://www.indexrated.com"><img src="http://img398.imageshack.us/img398/4813/listed1pb.gif" border="1" width="100" alt="Index Rated Directory - Rating Quality Sites" /></a>

Get all Games,Apps and Wallpapers Nokia, Samsung and Sony Erricson!!

admans is offline
Reply With Quote
  #2  
Old 08-31-2005, 16:28
commes
Senior Member

commes's Avatar

Join Date: Aug 2005
Location: Regina, Sask, Canada
Posts: 295
Trader Rating: (1)
Points: 76 (Donate)
5 F$/Referral Refer Friends
commes is on a distinguished road
Send a message via MSN to commes
Default Re: Checking Your Server Status

thats a pretty handy tool that you got there
__________________
Classic Auto's | Your Ad Here | Your Ad Here | Your Ad Here | Your Ad Here |
Your Ad Here | Your Ad Here | Your Ad Here | Your Ad Here | Your Ad Here |
Your Ad Here | Your Ad Here | Your Ad Here | Your Ad Here | Your Ad Here |
commes is offline
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


Resources : | Advertise at FHF | itextLink.com| Reseller Hosting| TextDot| iNamePros| Any Webmaster| Web Host| Dep3|


All times are GMT -4. The time now is 02:06.


Powered by: vBulletin
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.