#!/usr/bin/perl require "get_form_data.pl"; &get_form_data(); $search_term = $FORM{'search'}; my @match; opendir(DIR, "."); while($file = readdir(DIR)) { next if($file !~ /.html/); open(FILE, $file); $found_match = 0; $title = ""; while() { if(/$search_term/i) { $found_match = 1; } if((//) || ($found_title)) { if((/<\/TITLE>/) && (/<TITLE>/)) { chop; $title = $_; $title =~ s/<TITLE>//g; $title =~ s/<\/TITLE>//g; } else { if($found_title == 1) { $title = $_; $found_title = 2 } elsif($found_title == 2) { $found_title = 0; } else { $found_title = 1; } } } } if($found_match) { push @match, qq ( <HTML>\n<BODY BGCOLOR=\"#000099\"link=\"#FFFF00\">\n <font face=\"Verdana\"><A HREF="$file">$title</A></font><p>\n ); } close(FILE); } closedir(DIR); # now output print "Content-type: text/html\n\n"; if (@match) { for (@match) { print; } } else { print "<HTML>\n<BODY BGCOLOR=\"#000099\"TEXT=\"#FFFFFF\">\n"; print "<H3>\n"; print "<font face=\"Verdana\">Sorry!!!</font>\n"; print "</H3>\n"; print "<font face=\"Verdana\">Sorry, we were unable to match your query<p>Please use the <STRONG>FEEDBACK</STRONG> button</font>\n"; print "<font face=\"Verdana\">to go to the form and let us know what you are looking for.</font>\n\n"; } exit;