# Site Last Updated Program
# Version 1.1
# Lastup README File
# By Mike Calabrese
# http://www.mikecalabrese.com
# 07-26-2003

# This application 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.

This application is designed to tell a visitor to a web site the last time 
that the site was updated.  It consists of 2 Perl scripts, writelastup.pl 
and lastup.pl, an entry to the .profile file of the webmaster and an 
SSI (server side include) call from the page that you wish to place the 
last updated timestamp on.

The way that this program works is as follows:
1) When you telnet to your web site, there is a line of code in your .profile 
file that calls up a Perl script called writelastup.pl.  This Perl script, 
in turn, writes the current local time stamp to a file called lastupdate. 
The file consists of 8 sets of numbers that represent the day of the week, 
the month, the date, the year, the hour, the minute the second and the 
daylight savings indicator that the site was last updated.
 
2) A server side include call (SSI) is placed on a given web page on your 
site.  When a user requests that page, the SSI call executes a Perl script 
called lastup.pl. This Perl script reads in the contents of the lastupdate 
file, performs various manipulations on the numbers in this file, then 
outputs the correctly formatted date and time that the web site was updated.  
The server side include call pulls this information into the web page for 
the user to see. Please note that, on most web sites, the html page has to 
have the extension .shtml in order for the SSI call to work.

If you are downloading the compressed directory lastup.tar.gz, the directory 
structure is already in place.  Just follow the instructions to expand the 
file at the download page.  Just follow the file permission and configuration 
instructions listed in the next few paragraphs.

If you are cutting and pasting the file, create a directory in your cgi-bin 
area called lastup.  Chmod this directory to 755.  On some systems you may 
have to chgrp this directory to the proper group name for your site.  
Inside this directory place the Perl scripts writelastup.pl and lastup.pl.  
Also create a zero bytes file called lastupdate.  Chmod the 2 Perl scripts 
to 755 and the lastupdate file to 777.  On some systems you may have to 
change the Perl script extensions from .pl to .cgi.  On some systems you 
may have to chgrp these files to the proper group name for your site.  

The following configuration changes need to be made to these files:

In writelastup.pl make sure that the path to Perl is correct.  Typing 
"which perl" at the command line will answer this.  Also, be sure that you 
specify the exact UNIX path to your lastupdate file.

In lastup.pl again make sure that the path to Perl is correct.  Also, be sure 
that you specify the exact UNIX path to your lastupdate file.


Next you have to place a line at the end of your .profile file with the 
exact UNIX path to writelastup.pl.  Here is an example of what that line 
should look like:

/cgi-bin/lastup/writelastup.pl

WARNING: in some cases, if you incorrectly modify your .profile file, you 
subsequently may not be able to  log into your site.  Please check with your 
system administrator if you have any doubts about modifying your .profile 
file.  This line invokes the writelastup.pl script when you telnet into your 
site.

Next, insert the following command on the web page that you want the last 
updated time stamp to occur.  Again, this page has to to have the extension 
.shtml as it's extension:

<!--#exec cgi="/cgi-bin/lastup/lastup.pl"-->

Make sure that the exact HTML path to lastup.pl is shown in the above com-
mand.  You can test the program by manually running the writelastup.pl 
script from your /cgi-bin/lastup directory and then looking at the re-
sulting output from the SSI call.  Then, to test the call from the .profile 
file, simply log out of your server, then log in again, then reload the web 
page with the SSI call.  You should then see the updated time stamp.  Chang-
ing of font sizes, types or colors as well as allignment can be accomplished 
by placing the proper tags around the SSI call on your web page.

This application was tested successfully in a Linux/Apache environment.  

Enhancements for Version 1.1 include adding the exact UNIX path to lastupdate 
within the lastup.pl file.