[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

No Subject



Hello. I am having trouble getting a searchable archive to work. I have
folders with in folders. Inside each folder contains a folder called year
or month depending on which directory you reside in. Inside the month
folder is a list of files that I need to be searched. I have 7 years of
information that I need to search. I have tried using both the get and post
method. I should also mention that I am using personal web sharing 1.5 from
apple and after 60 seconds of the search I get a status code 502.

Can anyone help me out on this one?




#!perl
print "Content-type: text/html", "\n\n";
#$query = '1997=on&January=on&search=test';
read (STDIN, $query_string, $ENV{'CONTENT_LENGTH'});
($boolean, $YEARS, $MONTH, $input, $search) = split (/=on&/, $query_string);
($inputs, $search_string) = split (/=/, $input);
$search_string =~ tr/+/|/;
chomp($search_string);
chomp($search);

$path1 = 'Systems 10 HD:dpcgifolder:test';
opendir(DIR, $path1);
@year = readdir(DIR);
closedir(DIR);
chdir($path1);
foreach $years (@year)
  {
    open (YEAR, $years);
    $path2 = join (':', $path1,$years);
    opendir(DIRRR, $path2);
    @month = readdir(DIRRR);
    closedir(DIRRR);
    chdir($path2);
    foreach $months (@month)
         {
             open (MONTH, $months);
             #print "$months", "\n";
             $path3 = join (':', $path2,$months);
             opendir(DIRR, $path3);
             @files = readdir(DIRR);
             closedir(DIRR);
             chdir($path3);
             foreach $file (@files)
                {
                   open (FILE, $file);
                   #print "$file", "\n";
                   while ($lists = <FILE>)
                      {
                         if ($lists =~ /$search/i)
                           {


                               push(@file_names,$lists);
                               print "<br><br><hr size=7 color=black>", "\n";
                               print "<br><br>", "\n";
                            }
                       }
                   close(FILE);
                }
             close(MONTH);
          }
     close(YEAR);
   }
print "Content-type: text/html", "\n\n";
print "<HTML>", "\n";
print "<HEAD><TITLE>Search Results</TITLE></HEAD>", "\n";
print "<BODY>", "\n";
print '<body bgcolor="white">';
print "<center><H1>Here are your results for: $query </H1></center>", "\n";
print "@file_names", "/n";
print "</BODY></HTML>";
exit(0);


I also wrote a small script that does work. It uses the boolean search or
and the user has to input a year and month to search


#!perl
print "Content-type: text/html", "\n\n";
#$query = '1997=on&January=on&search=test';
#$query_string = $ENV{'QUERY_STRING'};
read (STDIN, $query_string, $ENV{'CONTENT_LENGTH'});
($YEARS, $MONTH, $search) = split (/=on&/, $query_string);
#($YEARS, $MONTH, $search) = split (/=on&/, $query);
($inputs, $search_string) = split (/=/, $search);
$search_string =~ tr/+/|/;
#print "$YEARS $MONTH $search_string", "\n";
chomp($search_string);
print "<HTML>", "\n";
print "<HEAD><TITLE>Search Results</TITLE></HEAD>", "\n";
print "<BODY>", "\n";
print '<body bgcolor="white">';
print "<center><H1>Here are your results for: $search_string
</H1></center>", "\n";
print '<B><div><a href=" ">To return to cgi</a></B><br><br>';
$path1 = 'Systems 10 HD:dpcgifolder:test';
$path2 = join (':', $path1,$YEARS);
$path3 = join (':', $path2,$MONTH);
opendir(DIR, $path3);
@files = readdir(DIR);
closedir(DIR);
$space = '<br><br><hr><br>';
chdir($path3);
foreach $file (@files)
{
open (FILE, $file);
while ($lists = <FILE>)
  {
    if ($lists =~ m/$search_string/i)
       {
          push(@file_names,$lists);
          push(@file_names,$space);
        }
   }
 close(FILE);
}
print "@file_names", "\n";
print "</BODY></HTML>";
exit(0);

--
pworkman@dispatch.com == Phil Workman



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch