#!/usr/local/bin/perl require "timelocal.pl"; # # This script takes the input from the columnist archive prompt and # create a new archive form. # # This file will be used for both the perm archive and the user defined # archive. # # Written By : Michael Browner 9/17/95 # $archpath = "/html/b/page/pressbox/archive"; $mastdb = $archpath . "/master.db"; $pboxtoppath = "./p_box_arch_top.htm"; $pboxbotpath = "./p_box_arch_bot.htm"; print STDOUT "Content-type: text/html\n"; print STDOUT "\n"; # # Deal with the incoming vars # if ($ENV{'REQUEST_METHOD'} eq "POST") { $arg = ; } else { $arg = $ENV{'QUERY_STRING'}; } #$arg = ; #chop($arg); $a_count = 0; $t_count = 0; @vars = split(/\&/, $arg); for($i = 0; $i < @vars; $i++) { $item = $vars[$i]; ($var, $value) = split(/=/, $item); if ($var eq "listtype") { $listtype = $value; } elsif($var eq "author") { $_ = $value; tr/+/ /; $author_list[$a_count] = $_; $a_count++; } elsif($var eq "topic") { $_ = $value; tr/+/ /; $topic_list[$t_count] = $_; $t_count++; } elsif($var eq "date") { $_ = $value; ($mt, $dy, $yr) = split(/%2F/, $_); } } # # Put out the top level stuff # open(TEXTIN, "< $pboxtoppath"); while() { print STDOUT "$_"; } close(TEXTIN); # # Go through the file and print out our stuff # @curr_time = localtime(time()); @abstime = (0, 0, 0, $curr_time[3], $curr_time[4], $curr_time[5], 0, 0, 0); $atime = &timelocal(@abstime); if($listtype eq "by_topic") { for($i = 0; $i < $t_count; $i++) { $count = 0; open(MASTDB, "< $mastdb"); READ:while() { chop; ($author, $topic, $filedate, $head, $file) = split(/%2C/, $_); ($month, $day, $year) = split(/\//, $filedate); if ($month < 0) { @current = (0, 0, 0, $day, $month - 1, $year, 0, 0, 0); $ftime = &timelocal(@current); } if ($year<=$yr) { if ($month<=$mt) { if ($day<=$dy) { last READ; } } } # if(($atime - $ftime) > $days) # { # last READ; # } if($topic eq $topic_list[$i]) { $list[$count] = ""; $list[$count] .= $head . " " . $filedate . ""; $list[$count] .= "
\n"; $count++; next READ; } } close(MASTDB); if($count > 0) { print STDOUT "

$topic_list[$i]

\n"; for($j = 0; $j < $count; $j++) { print STDOUT $list[$j]; } } } } else { for($i = 0; $i < $a_count; $i++) { $count = 0; open(MASTDB, "< $mastdb"); READ1:while() { chop; ($author, $topic, $filedate, $head, $file) = split(/\|/, $_); ($month, $day, $year) = split(/\//, $filedate); if ($month > 0) { @current = (0, 0, 0, $day, $month - 1, $year, 0, 0, 0); $ftime = &timelocal(@current); } if ($year<=$yr) { if ($month<=$mt) { if ($day<=$dy) { last READ1; } } } # if(($atime - $ftime) > $days) # { # last READ1; # } if($author eq $author_list[$i]) { $list[$count] = ""; $list[$count] .= $head . " " . $filedate . ""; $list[$count] .= "
\n"; $count++; next READ1; } } close(MASTDB); if($count > 0) { print STDOUT "

$author_list[$i]

\n"; for($j = 0; $j < $count; $j++) { print STDOUT $list[$j]; } } } } # # Put out the footor stuff # open(TEXTIN, "< $pboxbotpath"); while() { print STDOUT "$_"; } close(TEXTIN); exit(0);