#!/usr/bin/perl
print "Content-type: text/html\n\n";
#Location of Perl
$output = `whereis perl`;
@locations = split(" ",$output);
foreach $line (@locations)
{
$whereperl .= "$line<br>";
}
#Location of Sendmail
$output = `whereis sendmail`;
@locations = split(" ",$output);
foreach $line (@locations)
{
$wheresendmail .= "$line<br>";
}
#Location of Current Directory
$currentdirectory = `pwd`;
#Perl Variables
$perlversion = $];
#Perl Os
$perlos = $^O;
#Module Paths
foreach $line (@INC)
{
$modulepaths .= "$line<br>";
}
#Environment Variables
$environment = qq~
<table width="100%" border="1" cellspacing="0" cellpadding="2" bordercolor="#000000">
<tr>
<td colspan="2" bgcolor="#0033CC">
<div align="center" class="tabletitle">Environment Variables</div>
</td>
</tr>
~;
@allkeys = keys(%ENV);
foreach $key (@allkeys)
{
$value = $ENV{$key};
if ($value eq "") {$value = "-";}
$environment .= qq~
<tr>
<td width="150" class="tableitems">$key</td>
<td class="tablevalue">$value</td>
</tr>
~;
}
$environment .= qq~
</table>
~;
$documentroot = $ENV{'DOCUMENT_ROOT'};
if ($documentroot ne "")
{
@lines = `du -c -k $documentroot`;
$lastline = @lines-1;
($diskusage) = split/[\t| ]/,$lines[$lastline];
}
#Server Software
$serverip = $ENV{'SERVER_ADDR'};
$servername = $ENV{'SERVER_NAME'};
$serverport = $ENV{'SERVER_PORT'};
$serversoftware = $ENV{'SERVER_SOFTWARE'};
$serveruptime =`uptime`;
#Localtime
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
@months = ("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
$date = sprintf("%02d-%s-%04d",$mday,$months[$mon],$year+1900);
$time = sprintf("%02d:%02d:%02d",$hour,$min,$sec);
$localtime = "$date, $time";
#GMTtime
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = gmtime(time);
@months = ("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
$date = sprintf("%02d-%s-%04d",$mday,$months[$mon],$year+1900);
$time = sprintf("%02d:%02d:%02d",$hour,$min,$sec);
$gmttime = "$date, $time";
print qq~
<html>
<head>
<title>Perlonline.com - Perlinfo.cgi</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
.tabletitle { font-family: Arial, Helvetica, sans-serif; font-size: 14px; font-weight: bold; background-position: center; color: #FFFFFF}
.tableitems { font-family: Arial, Helvetica, sans-serif; font-size: 12px}
.tablevalue { font-family: Arial, Helvetica, sans-serif; font-size: 12px; font-weight: bolder}
-->
</style>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<table width="100%" border="1" cellpadding="2" cellspacing="0" bordercolor="#000000">
<tr bgcolor="#0033CC">
<td colspan="2" class="tabletitle">
<div align="center">Server Information</div>
</td>
</tr>
<tr>
<td class="tableitems" width="150" valign="top">Name</td>
<td class="tablevalue">$servername</td>
</tr>
<tr>
<td class="tableitems" width="150" valign="top">IP</td>
<td class="tablevalue">$serverip</td>
</tr>
<tr>
<td class="tableitems" width="150" valign="top">Listing Port</td>
<td class="tablevalue">$serverport</td>
</tr>
<tr>
<td class="tableitems" width="150" valign="top">Document Root</td>
<td class="tablevalue">$documentroot</td>
</tr>
<tr>
<td class="tableitems" width="150" valign="top">Disk Usage by Root</td>
<td class="tablevalue">$diskusage Kb</td>
</tr>
<tr>
<td class="tableitems" width="150" valign="top">Software's Installed</td>
<td class="tablevalue">$serversoftware</td>
</tr>
</table>
<br>
<table width="100%" border="1" cellspacing="0" cellpadding="2" bordercolor="#000000">
<tr bgcolor="#0033CC">
<td colspan="2" class="tabletitle">
<div align="center">Perl Information</div>
</td>
</tr>
<tr>
<td class="tableitems" width="150" valign="top">Perl version</td>
<td class="tablevalue">$perlversion</td>
</tr>
<tr>
<td class="tableitems" width="150" valign="top">Compiled For</td>
<td class="tablevalue">$perlos</td>
</tr>
<tr>
<td class="tableitems" width="150" valign="top">Module Paths</td>
<td class="tablevalue">$modulepaths</td>
</tr>
</table>
<br>
<table width="100%" border="1" bordercolor="#000000" cellpadding="2" cellspacing="0">
<tr bgcolor="#0033CC">
<td colspan="2" class="tabletitle">
<div align="center">Location of Important Unix Programs</div>
</td>
</tr>
<tr>
<td class="tableitems" width="150" valign="top">Perl</td>
<td class="tablevalue">$whereperl</td>
</tr>
<tr>
<td class="tableitems" width="150" valign="top">Sendmail</td>
<td class="tablevalue">$wheresendmail</td>
</tr>
</table>
<br>
<table width="100%" border="1" cellspacing="0" cellpadding="2" bordercolor="#000000">
<tr bgcolor="#0033CC">
<td colspan="2" class="tabletitle">
<div align="center">Time</div>
</td>
</tr>
<tr>
<td class="tableitems" width="150" valign="top">Server Time (Local)</td>
<td class="tablevalue">$localtime</td>
</tr>
<tr>
<td class="tableitems" width="150" valign="top">Server Time (GMT)</td>
<td class="tablevalue">$gmttime</td>
</tr>
</table>
<br>
$environment
<p align="center" class="tablevalue"> </p>
<p align="center" class="tablevalue">All rights Reserved 2001. <a href="http://www.perlonline.biz">Perlonline.biz</a></p>
</body>
</html>
~;