#!/usr/bin/perl
require "cgi-lib.pl";
#
# Logs env information and parameters to log file,
# then serves the download options page.
#
$htmlPage="download.shtml";
$logFile="../logs/download.log";
$fedoraVersion="2.1";
$recordSplit="##RSPLIT##";
$fieldSplit="##FSPLIT##";
$nameValueSplit="##NVSPLIT##";
print &PrintHeader;
&ReadParse;
open(O, ">>$logFile");
$in{'#remoteAddress'}=$ENV{'REMOTE_ADDR'};
$in{'#userAgent'}=$ENV{'HTTP_USER_AGENT'};
$in{'#referringUrl'}=$ENV{'HTTP_REFERER'};
$in{'#fedoraVersion'}=$fedoraVersion;
$time=`date +\"%Y-%m-%d at %k:%M:%S\"`;
$time=~s/\n//g;
$in{'#downloadTime'}=$time;
$i=0;
foreach $key (sort keys %in) {
if ($key ne "download") {
if ($i>0) {
print O $fieldSplit;
}
$name=$key;
if ($key !~ /#/) {
} else {
$name=~s/#//g;
$name="$name";
}
print O $name;
print O $nameValueSplit;
print O "$in{$key}";
$i++;
}
}
print O $recordSplit;
close(O);
open(F, $htmlPage);
foreach $line () {
if ($line !~ /#include/) {
} else {
# do an ssi
@z=split(/\"/, $line);
$f=@z[1];
open(I, $f);
$line="";
foreach $l () {
$line.=$l;
}
close(I);
}
print $line;
}
close(F);