#!/usr/local/bin/perl ################################################################### # Import the module that contains the CGI parsing libraries. use CGI::Lite; # Parse the contents of the HTML form and store them in %in. $cgi = new CGI::Lite; %in = $cgi->parse_form_data; require "lib.pl"; ################################################################### ################################################################### $filename = "$logDir/$in{'afile'}"; $pbStatsBegin = " Game Duration:"; #$pbStatsBegin = " WARBIRDS RA G A KI DE ST SV CH TO P D BC Time JAVELINS RA G A KI DE ST SV CH TO P D BC Time"; $pbStatsEnd1 = " HRP"; $pbStatsEnd2 = " Highest Rating"; ################################################################### print "Content-type:text/html\n\n"; print <

Scoremaster 2000

Game Log Viewer

File: $in{'afile'}

END if(open(INFILE, $filename)) { @lines = ; close(INFILE); } else { print "File $filename could not be opened!\n"; exit(1); } $pbStatsSection = 0; foreach $line(@lines) { # Remove time stamp $line =~ s/^(\w)(\w)(\w) (\w)(\w)(\w) (\d)(\d) (\d)(\d):(\d)(\d):(\d)(\d)://; $line =~ s/\cM$//g; $line =~ s/\n$//g; $line =~ s/\>/>/g; $line =~ s/\
\n";
  }

  if($pbStatsSection != 1) {
    if($line =~ /^C /) {
      #ignore chat
    }
    elsif($line =~ /^P (.*)/) {
      #print "$1
\n"; } elsif($line =~ /^T (.*)/) { print "$1
\n"; } elsif($line =~ /^E (.*)/) { print "$1
\n"; } elsif($line =~ /(.*)\(0\) killed by:/) { print "$line
\n"; } elsif($line =~ /(\w|\s)\> \?chat/) { #ignore ?chat } # Explicitly permit special messages elsif(($line =~ /^\s\sSCORE:/) || ($line =~ /^\s\sGame Duration:/) || ($line =~ /^\s\sTime left:/) || ($line =~ /^\s\sTime left to reward:/)) { print "$line
\n"; } elsif(($line =~ /^\s\s([\w|\*|\!]*): /) && ($line !~ /^ SCORE:/)) { #ignore } elsif($line =~ /^\s\s(\w|\s)+:/) { #ignore the rest } elsif($line =~ /(.*)\>/) { print "$line
\n"; } # Ignore info cmds elsif(($line =~ /^ IP:/) || ($line =~ /^ Ping:/) || ($line =~ /^ S2C:/) || ($line =~ /^ S2C CURRENT:/) || ($line =~ /^ C2S CURRENT:/)) { } # Ignore sysop stuff elsif($line =~ /^\* WARNING\:/) { } # Arena messages elsif($line =~ /^\s\s(\w)/) { print "$line
\n"; } else { print "$line
\n"; } } else { print "$line\n"; if($line =~ /^ HRP\((\d+)\)/) { $pbStatsSection = 0; print "
\n"; } } if(($line =~ /^$pbStatsEnd1/) || ($line =~ /^$pbStatsEnd2/)) { $pbStatsSection = 0; print "\n"; } } print <
END