$version = "1.11"; require "find.pl"; @day = (Sun,Mon,Tue,Wed,Thu,Fri,Sat); @month = (Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec); read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); @pairs = split(/&/, $buffer); foreach $pair (@pairs){ ($name, $value) = split(/=/, $pair); $name =~ tr/+/ /; $name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; if ($FORM{$name}) { $FORM{$name} = "$FORM{$name}, $value"; } else { $FORM{$name} = $value; } } if (!$FORM{'boolean'} && !$FORM{'case'} && !$FORM{'hits'} && !$FORM{'terms'}) { $ListOnly = 1; } unless ($FORM{'boolean'}) { $FORM{'boolean'} = "any terms"; } unless ($FORM{'case'}) { $FORM{'case'} = "insensitive"; } unless ($FORM{'hits'}) { $FORM{'hits'} = 25; } unless ($FORM{'terms'}) { $NoTerms = 1; } $FORM{'terms'} =~ s/\s+/ /g; $FORM{'terms'} =~ s/^\s//; $FORM{'terms'} =~ s/\s$//; $FORM{'terms'} =~ s/([^\w\s])/\\$1/g; if ($FORM{'boolean'} eq "as a phrase") { push (@terms,$FORM{'terms'}); } else { @terms = split(/\s+/,$FORM{'terms'}); } $matchcount=0; $filecount=0; foreach $file (@dirs) { undef (@AllFiles,$AllText); if ($file =~ s/\+$//) { $AllText = 1; } if ($file =~ s/\*$//) { $AllDirs = 1; &find ($file); } else { opendir(DIR,$file); @AllFiles = readdir(DIR); closedir(DIR); } $file =~ s/\/$//; foreach $subfile (@AllFiles) { unless ($subfile =~ /^$file/) { $subfile = $file."/".$subfile; } if ((-T "$subfile") && ($AllText || ($subfile =~ /\.(s|p)*htm(l)*$/)) && (!$avoid || ($subfile !~ /$avoid/))) { $kbytesize{$subfile} = int((((stat($subfile))[7])/1024)+.5); $kbytestotal += $kbytesize{$subfile}; push (@files,"$subfile"); } } } if ($ListOnly) { @FILES = sort (@files); print "Content-type: text/html\n\n"; &Header("File List"); print "
\n\n"; print "The following files are included in the search:\n\n"; foreach $FILE (@FILES) { if (%otherurls) { foreach $path (keys %otherurls) { $FILE =~ s/$path/$otherurls{$path}/i; } } $FILE =~ s/$basepath/$baseurl/i; print "$FILE\n"; $filecount ++; next; } print "\nTotal: ",&commas($filecount)," files\n"; print " ",&commas($kbytestotal)," kb\n\n"; print "\n"; &PrintForm; &Footer; exit; } unless ($NoTerms) { foreach $FILE (@files) { open (FILE,"$FILE"); @LINES =