#!/usr/local/bin/perl
# Site Last Updated Program
# lastup.pl
# Version 1.1
# By Mike Calabrese
# http://www.mikecalabrese.com
# 07/26/2003
# This program is available for free on an AS-IS basis. I am not
# responsible for consequential damages, loss of income or whatever
# else that may happen as a result of the use of this program.
# Open the file with the last update data
open(MYFILE, "/exact/unix/path/to/cgi-bin/lastup/lastupdate");
$update = <MYFILE>;
# Split the timestamp into a space delimited array
@update = split (/ /,$update);
# Assign variables to the elements
$theday = substr($update[0],0);
$themonth = substr($update[1],0);
$thenumday = substr($update[2],0);
$theyear = substr($update[3],0);
$thehour = substr($update[4],0);
$theminute = substr($update[5],0);
$thesecond = substr($update[6],0);
$thetzone = substr($update[7],0);
# Set up associative arrays for the proper days and months
%properday = ('0',Sunday,'1',Monday,'2',Tuesday,'3',
Wednesday,'4',Thursday,'5',Friday,'6',Saturday);
%propermonth = ('0',January,'1',February,'2',March,'3',
April,'4',May,'5',June,'6',July,'7',August,'8',
September,'9',October,'10',November,'11',December);
# Adjust the year to read 2000
$theyear = $theyear + 1900;
# Adjust the hour for leading zeros
if ($thehour < 10) {
$thehour = "0$thehour";
}
# Adjust the minute for leading zeros
if ($theminute < 10) {
$theminute = "0$theminute";
}
# Adjust the second for leading zeros
if ($thesecond < 10) {
$thesecond = "0$thesecond";
}
# Adjust the hour for the given time zone
# if your server and you are in the same time zone,
# comment out the following line
$thehour = $thehour + 1;
# Determine whether Daylight Savings or not
if ($thetzone = 1 {
$thetzone = "EDT";
}else{
$thetzone = "EST";
}
# Give the output using the proper months and days
print "Content-type: text/html\n\n";
print "This site was last updated\:\n";
print "<BR>\n";
print "$properday{$theday}\, $propermonth{$themonth} $thenumday\,\n";
print " $theyear<BR>\n";
print "at $thehour\:$theminute\:$thesecond $thetzone\n";