After downloading a premade script, I modified the html output within the script in order to suit my site better.
It worked fine before I edited it.
Now, even though I have not changed anything which I believe would have affected this, the html output is now rendered in Netscape browsers as text. (It works fine in IE).
The address is http://www.freeplayers.f2s.com/cgi-bin/spy.cgi
The code is below.
Thanks in advance,
Brendan.
------------------START CODE------------------
#!/usr/bin/perl
eval{
require 'admin/config.pl';
require 'admin/subs.pl';
};
if ($@){
print "Error including CGI libraries:$@";
exit;
}
#=====================================================
eval { &main; };
if ($@){
print "Fatal Error: $@";
exit;
}
sub main{
#------------------------------------
my %in = &data_parse;
my ($start, $stop) = (0,14);
my $output;
my $target;
my $top;
my $bottom;
my $breaker;
open(FILE, "<$log_file") || die &error(" Unable to open $log_file. Reason:$!");
flock (FILE, 2) || die &error(" Unable to obtain lock on file $log_file. Reason:$!");
my @data = ;
close(FILE);
if ($#data < 14){ $stop = $#data; }
else { $stop = $#data;
$start = $stop - 15; }
if ($in{'type'} eq 'popup'){ # other possible type at the moment would be 'full'
$top = qq~
Spy on searches at $title
~;
$bottom = qq~~;
$target = "_blank";
$breaker = " - ";
$output = qq~These were the last 15 search terms~;
} else {
$top = &top(" Spy");
$bottom = ⊥
$target = "_top";
$breaker = "";
$output = qq~These were the last 15 search terms~;
}
for ($i=$start; $i<$stop; $i++){
$buffer = $data[$i];
@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;
$value =~ s//>/g;
$value =~ s/\t/ /g;
$FORM{$name} = $value;
}
$output.= qq~$FORM{'q'}$breaker~;
}
print "";
if($in{'type'} ne 'popup'){ $output .= &advanced_search_form; }
print "$top";
print "$output";
print "$bottom";
}






Rob Pengelly posted this at 18:09—11th February 2001.
They have: 850 posts
Joined: Jul 1999
Before printing out any output to the browser, make sure you have:
print "Content-type:text/html\n\n";
http://www.thehungersite.com - http://www.therainforestsite.com
http://www.ratemymullet.com - Beauty is only mullet deep.