Clan Adverts

Custom PHPNuke Scripts

 

Server Status

Description: Very simple server status
Version: 1.0
Added on: 24 February 2007
Author: unkown
Difficulty Level: Very Easy
Views: 306
Detailed Profile

Code:
<?php
error_reporting(0); // we used this function not to see errors

if (isset($Check)){

$fp = fsockopen($host, $port, $errno, $errstr, 4); // we establish the connection with the remote server

// connection type
if ($port == 80){ $type = "Website"; }
else if ($port == 21){ $type = "FTP"; }
else if ($port == 3306){ $type = "MySQL"; }


if($fp){ // IF THIS IS TRUE

echo "<font color="#009966"><b>".$host." ".$type." IS ONLINE</b></font>";
}

else { // IF THIS IS FALSE
echo "<font color="#DD0000"><b>".$host." ".$type." IS OFFLINE</b></font>";
}

}

else {
?>

<!--FORM-->
<form method="post" action="">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>

<td width="34%"><input name="host" type="text" size="30"></td>
<td width="33%">
<select name="port">
<option value="80" selected="selected">Website</option>
<option value="21">FTP</option>
<option value="3306">MySQL</option>
</select>
</td>
<td width="33%"><input type="submit" name="Check"></td>

</tr>
</table>
</form>

<?
}
?>