Hello ;
Thank you for replay my ex mail I 'll descripe the problem again .I
downloaded ,compile and run
the swishe program successfully in my Alpha server , then I maintained the
index , well when I put my
perl program in the cgi-bin directory and try to call it from my web server it
gave the error message :
" Server Error
The server encountered an internal error or misconfiguration and was unable to
complete your request.
Please contact the server administrator, root@www.frcu.eun.eg and inform them
of the time the error occurred, and anything
you might have done that may have caused the error"
I'll show you my perl program :
#swish-cgi.pl
$swish = "/usr/opt/swish/swish-e";
$swishcgi = "/cgi-bin/swish-cgi.pl";
$params = " ";
$index = "/usr/opt/swish/index.swish";
$organization = "<FONT SIZE=1 COLOR = #0000A0 > Copyrights (c) 1999,2000
EUN Egyptian Universities Network
.</FONT>";
$department = "<FONT SIZE=1 COLOR=#0000A0 > FRCU Forign Relation
Coordination Unit ,SWISH, All Rights
Reserved . </FONT>";
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);
foreach $pair (@pairs)
{
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
push(@search_tags, $value), next if ($name eq 'search_tags');
$FORM{$name} = $value
}
$query = $FORM{'query'};
$results = $FORM{'results'};
if (@search_tags)
{
$tags = join("",@search_tags);
$search_tags = "\-t $tags";
} else
{
$search_tags = "";
}
if ($query)
{
&search_parse;
} else
{
&print_form;
}
sub print_form
{
&html_header(" ");
print <<EOF;
<CENTER><H2><FONT COLOR=FF0000> FRCU SEARCH SERVICE </FONT></H2></CENTER><br>
<CENTER>
<font color = 0000FF>
<FORM ACTION="$swishcgi" method=post>
<inPUT TYPE="reset" VALUE="Clear"><INPUT NAME="query" SIZE=30><SELECT
name=results>
<OPTION value=0> All
<OPTION value=10> 10
<OPTION value=20> 20
<OPTION value=30> 30
<OPTION value=40> 40
<OPTION value=50> 50
<OPTION value=100> 100
</SELECT><INPUT TYPE="submit" VALUE="Search ">
<p>
Enter word(s). You can connect terms with <b>and</b> or <b>or</b><br>
Example: disadvantaged and students .<p>
</FONT>
<HR>
</FORM>
</CENTER>
</BODY>
</HTML>
EOF
&html_trailer;
}
sub search_parse
{
$count = 0;
open (SWISH, "$swish -w $query -m $results $search_tags -f $index|");
while (<SWISH>)
{
chop;
if ($_ eq "err: no results")
{&search_error("There were no items that matched your search request");}
if ($_ eq "err: could not open index file")
{&search_error("Could not open SWISH Index File $index");}
if ($_ eq "err: no search words specified")
{&search_error("Please Enter at least one Search Word");}
if ($_ eq "err: a word is too common")
{&search_error("One of your search terms is too common, please try again");}
next if /^\D/ ;
$count++;
push(@results, $_);
}
&html_header("Your Search Results");
print "<p>\n";
print "Your Search for <strong>$query</strong>, returned $count Items\n";
print "<hr><dl><dt>\n";
foreach (@results)
{
select(STDOUT);
($stringone, $title, $filesize) = split(/\"/, $_);
($rank, $url) = split(/ /, $stringone);
print "<dd><a href=\"$url\">$title</a><br>\n";
print "<dd>Relevancy Score: $rank Size of Document: $filesize Bytes<p>\n";
}
print "</dl><P>\n";
&html_trailer;
}
sub search_error
{
&html_header("Your Search Results");
$error_message = $_[0];
print "$error_message\n";
&html_trailer;
}
sub html_header
{
$document_title = $_[0];
print "Content-type: text/html\n\n";
print "<HTML>\n";
print "<HEAD>\n";
print "<TITLE>$document_title</TITLE>\n";
print "</HEAD>\n";
print "<H3><FONT COLOR =FF0000> $document_title </FONT> </H3>\n";
print "<hr>\n";
}
sub html_trailer
{
print "<P>\n";
print "$organization<br>\n";
print "$department<P></body>\n";
print "</body>\n</html>\n";
exit;
}
Received on Tue Aug 3 13:38:30 1999