#!/usr/local/bin/perl
# A CGI program in the ExpiRed family. It places different pictures on a
# web page depending on the modification file stamp on a specified file.
# Original code by Anders Hultman 1996-12-20.
# Distributed under the GNU General Public Licence
# The program should be referenced to by an tag
# After the actual URL of the script the following should be appended:
# /full_path_to_file?time_limit_in_days
# Example:
#
########################################################################
# Configure the program by changing these three image file locations:
# Image to be placed if the file is older than the time limit
# or if the limit is not valid (e.g. not a number or not given):
$old = "/icons/ExpiRed.gif";
# Image to be placed if the file is newer than the time limit:
$new = "/icons/ExpiGreen.gif";
# Image to be placed if the file does not exist:
$not = "/icons/ExpiNo.gif";
########################################################################
$age = (stat ($ENV{'PATH_TRANSLATED'})) [9];
$timelimit = $ENV{'QUERY_STRING'} * 86400;
$since = time - $age;
if ($age == 0) { print "Location: $not\n\n"; }
else {
if ($since > $timelimit) { print "Location: $old\n\n"; }
else { print "Location: $new\n\n"; }
}
exit 0;
########################################################################