#!/usr/bin/perl # Another add-on to urllist.cgi. This script automatically redirects to the last URL # catched from the channel which is given as parameter. # Copyright 2003 by Susanna Winter # Version history: # v0.1 - May 2003: Initial version # v0.2 - May 2003: Getting fed up with having to edit numerous scripts every time I # change something in the site layout I've now changed the SSI files to # be read into the scripts rather than have static html code # -> flexible for me but, overall, not very portable. # v0.2.1 - June 2003: Added msgs to the channel list if no parameters. use strict; use CGI qw(:standard); use File::stat; use Time::localtime; # globals my $filename = "lasturl.pl"; my @channel_list = ("#example"); my $path_to_files = "\/path\/to\/files\/"; # addresses from where it's allowed to see addresses sent via msg my @msgallowedhosts = (""); # sub's # check if msg option is allowed sub check_host { foreach my $host (@msgallowedhosts) { if ($ENV{'REMOTE_HOST'} eq $host) { return 1; } } } #end of check_host sub fix_month { my $fixed_month = $_[0]; $fixed_month =~ s/Jan/01/; $fixed_month =~ s/Feb/02/; $fixed_month =~ s/Mar/03/; $fixed_month =~ s/Apr/04/; $fixed_month =~ s/May/05/; $fixed_month =~ s/Jun/06/; $fixed_month =~ s/Jul/07/; $fixed_month =~ s/Aug/08/; $fixed_month =~ s/Sep/09/; $fixed_month =~ s/Oct/10/; $fixed_month =~ s/Nov/11/; $fixed_month =~ s/Dec/12/; return $fixed_month; } #end of fix_month # sub's declared my $query = ""; $query = param("keywords"); my $no_channel = 1; foreach (@channel_list) { if ("#" . $query eq $_) { $no_channel = 0; } } if (($query eq "msg") && check_host()) { $no_channel = 0; } # no parameters -> print the main urllist.cgi page if ( !(param()) || ($no_channel) ) { print "Content-type:text/html\n\n"; print "