I installed this search script, but I'm needing it's results text to show up in a different color.
However, I'm not seeing anything that resembles a css like I expected.
How would you change the results color? I'm assuming you can wrap the results in a div, but I'm not understanding where or how a div tag relates in a cgi script.
CODE
#!/usr/bin/perl
print "Content-type:text/html\n\n";
$thisScript=$ENV{'SCRIPT_NAME'};
$data = $ENV{'SCRIPT_FILENAME'};
$data=~s/(.*)\/.*/$1/;
$top="$data/Top.html";
$bottom="$data/Bottom.html";
$data="$data/data/index.dat";
$query = $ENV{'QUERY_STRING'};
@pairs = split(/&/,$query);
foreach $pair (@pairs)
{
($name,$value) = split(/=/, $pair);
$value=~tr/+/ /;
$value=~s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$FORM{$name} = $value;
}
$searchwords=$FORM{'search'};
$searchwords=~s/[\|\\\/\!\@\#\$\%\^\&\*\(\)\[\]\{\}\;\:\'\"\+\=\-\_\?\.\,]//isg;
@terms=split(/\s+/,$searchwords);
open(FILE, "$data") or dieNice ("Can't open file: $data.<br>Please run archive.cgi script");
$no=0;
while ($line=<FILE>)
{
($URL, $title, $keywords, $description) = split(/\|\|\|/, $line);
$matches=0;
foreach $word (@terms)
{
if (($keywords=~/$word/i) or ($title=~/$word/i)) {$matches++}
}
if ($matches)
{
$found{$URL}=$matches;
$title{$URL}=$title;
$description{$URL}=$description;
}
}
while (scalar(%found))
{
$maxMatches=0;
while (($URL,$matches)=each(%found))
{
if ($matches>$maxMatches)
{
$maxMatches=$matches;
$maxURL=$URL;
}
}
$results[$no]=$maxURL;
$no++;
delete $found{$maxURL};
}
close(FILE);
open (HTML, $top);
@lines=<HTML>;
close (HTML);
foreach $line (@lines)
{
print "$line";
}
#################################
print "<p>Found <b>".scalar(@results)."<\/b> matches for <b>$searchwords<\/b>.<\/p>";
if (@results) {
for ($i=0; $i<@results; ++$i){
$no=$i+1;
print "$no. <a href=\"http\:\/\/$results[$i]\">$title{$results[$i]}<\/a> (http\:\/\/$results[$i])<br>\n";
print "$description{$results[$i]}<br><br>\n";
}
}
else {print "Your search has returned <b>no results<\/b>.<br><br>Please, try again.<br>\n"}
print "<\/td><\/tr>\n";
open (HTML, $bottom);
@lines=<HTML>;
close (HTML);
foreach $line (@lines)
{
print "$line";
}
##########################
sub dieNice
{
print<<EndHTML9;
<center><h2>An error has occured!</h2></center>
<p>$_[0]</p>
<p>If you have a problem, e-mail us with a short description of an error.</p>
</body>
</html>
EndHTML9
exit;
}
########### END SUBROUTINE#############