Snippet Name: Server Stats via PHP
Description: Get server stats on a web page in a nice display format.
Comment: (none)
Language: PHP
Highlight Mode: PHP
Last Modified: March 01st, 2009
|
<?PHP
FUNCTION server_stats() {
$server_software_get = GETENV('SERVER_SOFTWARE');
$server_software = EXPLODE(" ", $server_software_get);
$server_name = GETENV('SERVER_NAME');
$gateway_interface = GETENV('GATEWAY_INTERFACE');
$server_protocol = GETENV('SERVER_PROTOCOL');
$server_port = GETENV('SERVER_PORT');
?>
<table border="0" cellspacing="0" bgcolor="#000000">
<tr>
<td><table border="0" cellspacing="0">
<tr>
<td colspan="2" bgcolor="#FF8000"><p
align="center"><font size="2" face="Verdana Ref"><strong>Server
Statistics</strong></font></p>
</td>
</tr>
<tr>
<td bgcolor="#FFFFFF" valign="top"><font size="2"
face="Verdana Ref">Server Software:</font></td>
<td bgcolor="#FFFFFF"><font size="2"
face="Verdana Ref">
<?
FOR ($i = 0; $i < COUNT($server_software); $i++) {
ECHO $server_software[$i];
ECHO "<br>";
}
?>
</font></td>
</tr>
<tr>
<td bgcolor="#FFFFFF"><font size="2"
face="Verdana Ref">Server Name:</font></td>
<td bgcolor="#FFFFFF"><font size="2"
face="Verdana Ref"><?ECHO $server_name;?></font></td>
</tr>
<tr>
<td bgcolor="#FFFFFF"><font size="2"
face="Verdana Ref">Server Protocol:</font></td>
<td bgcolor="#FFFFFF"><font size="2"
face="Verdana Ref"><?ECHO $server_protocol;?></font></td>
</tr>
<tr>
<td bgcolor="#FFFFFF"><font size="2"
face="Verdana Ref">Server Port:</font></td>
<td bgcolor="#FFFFFF"><font size="2"
face="Verdana Ref"><?ECHO $server_port;?></font></td>
</tr>
<tr>
<td bgcolor="#FFFFFF"><font size="2"
face="Verdana Ref">Server CGI Revision:</font></td>
<td bgcolor="#FFFFFF"><font size="2"
face="Verdana Ref"><?ECHO $gateway_interface;?></font></td>
</tr>
</table>
</td>
</tr>
</table>
<?
}
?>
|