local (*in) = @_ if @_;
local ($i, $key, $val);
$in = $ENV{'QUERY_STRING'};
@in = split(/[&;]/,$in);
foreach $i (0 .. $#in) {
  #--convert plus's to spaces--
    $in[$i] =~ s/\+/ /g;
  #--split into key and value--
    ($key, $val) = split(/=/,$in[$i],2);
  #--convert from hex to alpha--
    $key =~ s/%(..)/pack("c",hex($1))/ge;
    $val =~ s/%(..)/pack("c",hex($1))/ge;
  #--associate key and value--
    $in{$key} .= "\0" if (defined($in{$key}));
    $in{$key} .= $val;
    }

  $s_url_temp = $in{'S_URL'};
  ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst)=gmtime;

$mon++;

##--now print to clicks file--
#  $fileName = "D:/shared_as_m/scripts.mapc/output/clicks.txt";
#  $year = $year + 1900;  # fix Y2K bug!
#  open(FH1,">> $fileName") || die "Unable to Open: ";
#  print FH1 "$mon/$mday/$year\t$in{'D_URL'}\t$ENV{'REMOTE_HOST'}\t$s_url_temp\t$in{'MGID'}\t$in{'ID'}\n";
#  close(FH1) ;

print "HTTP/1.0 301\r\n";
print "Location: $in{'D_URL'}\n\n";


