Looking for help with CGI files. I try to include one on my website but it gives an error and sometimes it doesnt show anything. I'am on the Johnny host what i got to do. <!--#include virtual="/cgi-bin/poll.cgi?poll=1" --> actually that is my include for the poll The script contains the following #!usr/bin/perl
print "content-type: text/html\n\n"
use strict;
use CGI qw(:all);
my $poll_id = int(param('poll'));
my $action;
open FH, "poll_${poll_id}_ip.txt";
my $ip = <FH>;
close FH;
chomp $ip;
$ip = defined($ip) ? $ip : '';
if ($ip eq '') { $ip = ':' }
my $pat = join('\.', split(/\./, $ENV{'REMOTE_ADDR'}));
my $mode = $ip =~ /\:$pat\:/ ? 0 : 1;
if (($mode == 0) || defined(param('see'))) {
print "Content-Type: text/html\n\n";
print "<center>Poll results</center>\n";
open FH, "poll_${poll_id}_text.txt";
my @lines = <FH>;
close FH;
print join("<br>", @lines);
open FH, "poll_${poll_id}_lines.txt";
my @lines = <FH>;
close FH;
open FH, "poll_${poll_id}_results.txt";
my @votes = <FH>;
close FH;
my $sum = 0;
foreach (@votes) {
$sum += int($_);
}
print "<center><table border=0 cellspacing=0 cellpadding=4>";
for (my $i = 0; $i <= $#lines; $i++) {
my $width = 200;
my $a = int($votes[$i] * $width / $sum);
my $b = $width - $a;
print "<tr><td align=right>$lines[$i] (".int($votes[$i]).")</td><td><table width=$width height=10><tr><td width=$a bgcolor=black></td><td width=$b bgcoloe=blue></td></tr></table></td></tr>";
}
print "</table></center>";
} else {
if (defined(param('dovote'))) {
my $vote = int(param('vote'));
open FH, "poll_${poll_id}_lines.txt";
my @lines = <FH>;
close FH;
if ($vote > $#lines) {
print "Content-Type: text/html\n\nError";
exit 0;
}
open FH, "poll_${poll_id}_results.txt";
my @lines = <FH>;
close FH;
foreach (@lines) {
chomp $_;
}
$lines[$vote] = int($lines[$vote]) + 1;
open FH, ">poll_${poll_id}_results.txt";
print FH join("\n", @lines);
close FH;
open FH, ">poll_${poll_id}_ip.txt";
print FH "$ip$ENV{'REMOTE_ADDR'}:";
close FH;
print redirect(-uri => $ENV{'HTTP_REFERER'});
} else {
print "Content-Type: text/html\n\n";
print "<form action=/cgi-bin/poll.cgi method=post>";
print "<input type=hidden name=poll value=$poll_id>";
open FH, "poll_${poll_id}_text.txt";
my @lines = <FH>;
close FH;
print join("<br>", @lines);
print "<center><table border=0 cellspacing=0 cellpadding=4>";
open FH, "poll_${poll_id}_lines.txt";
my @lines = <FH>;
close FH;
for (my $i = 0; $i <= $#lines; $i++) {
print "<tr><td align=center><input type=radio name=vote value=$i></td><td>$lines[$i]</td></tr>";
}
print "<tr><td align=center colspan=2><input type=submit name=dovote value=Vote> <input type=submit name=see value=\"See results\"></td></tr>";
print "</table></center>";
print "</form>";
}
} my error log says [Tue Feb 28 11:03:07 2012] [error] [client 92.66.136.41] unable to include "cgi-bin/poll.cgi?poll=1" in parsed file /home/jeroenn/public_html/Home.shtml please help me on the page it is showing [an error occurred while processing this directive]