#viewip.pl
#print "content-type: text/html\n\n";
use Time::Local;
$today = timelocal(localtime);
$datafile=`cat ../hosts/iplist.txt | sort -r | sort -u -t ',' -k 2,2 > ../hosts/latestip.txt`;
my $count = 0;
open (DATA,"/home/myplace/hosts/latestip.txt") || die ("Can't Open data File \n");
@data=;
close DATA;
&header_response;
$x=0;
foreach $line (@data) {
$x++;
($ip, $hostname , $datetime)=split(/\,/,$line);
print "| $hostname | $ip | $datetime | \n";
$count++;
}
&footer_response;
####################################################################################################
sub header_response
{
print "Content-type: text/html\n\n";
print "test\n";
print "\n";
print qq^\n^;
print "Our IP Info
\n";
print "
\n";
print "\n";
print "| Host Name | IP address | Last Boot Windows |
\n\n";
return;
}
sub footer_response
{
print "
\n";
print "
\n";
print " \n";
return;
}