Location: PHPKode > scripts > Server Status class > server-status-class/example1.php
<html>
<head>
<title>Server Status</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<?php
include 'serverstatus.php';
	$test = new status;
	// Enable logging?
	$test->log = FALSE; // Default is false
	$test->AddService('localhost', 21, 'FTP', 'tcp');
	$test->AddService('localhost', 22, 'SSH', 'tcp');
	$test->AddService('localhost', 23, 'Telnet', 'tcp');
	$test->AddService('localhost', 25, 'SMTP', 'tcp');
	$test->AddService('localhost', 80, 'HTTP', 'tcp');
	$test->AddService('localhost', 110, 'POP3', 'tcp');
	$test->AddService('localhost', 3306, 'MySQL', 'tcp');
	$test->AddService('localhost', 2082, 'CPanel', 'tcp');
	$test->AddService('localhost', 2086, 'WHM', 'tcp');
	$test->CheckStatus(1);
	$data = $test->GetStatus();

?>
<br>
<table width="50%" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#000000">
  <tr align="center" bgcolor="#0066CC">
    <th colspan="3"><font color="#FFFFFF">Server Status</font></th>
  </tr>
  <tr align="center" valign="top" bgcolor="#666666">
    <th><font color="#FFFFFF">Host</font></th>
    <th><font color="#FFFFFF">Service</font></th>
    <th><font color="#FFFFFF">Status</font></th>
  </tr>
<?php
for($i = 0; $i <= count($data) - 1; $i++)
{
if($data[$i]['status'])
{
	$img = '<img src="on.gif" width=15 height=15>';
	$img = $on = '<font color="#00FF00" size="5">&#8226;</font>';
}
else
{
	$img = $off ='<font color="#FF0000" size="5">&#8226;</font>';
	// $img = '<img src="off.gif" width=15 height=15>';
}
?>
  <tr align="center" valign="middle" bgcolor="#CCCCCC">
    <td align="left"><?php echo $data[$i]['ip']; ?></td>
    <td align="left"><?php echo $data[$i]['service']; ?></td>
    <td align="center"><?php echo $img; ?></td>
  </tr>
<?php
}
?>
</table>
<br>
<div align="center">
<strong>Key:</strong> <?php echo $on; ?> means the
  service is up. <?php echo $off; ?> means the service
  isn't up.<BR><BR>
</div>
</body>
</html>
Return current item: Server Status class