Neverm1nd
June 13th, 2001, 12:31
I'm having problems with my first cgi script. I'm a total newbie, so the complete code probably doesn't make sense. I keep getting an internal server error, whatever I do. I stole some code from a counter and made the script like this:
------------------------------------------------------
#!/usr/bin/perl
# (I'm with F2s)
#page.cgi?bgcolor&fgcolor
sub get_query {
my $command;
my $bgcolor;
my $fgcolor;
if ($ENV{'QUERY_STRING'} ne '') {
$command = "$ENV{'QUERY_STRING'}";
} else {
#must have command line info to operate
error("No command line information");
}
if ($command =~ /(.*)&(.*)/) {
$bgcolor = $1;
$fgcolor = $2;
} else {
error("whatever");
}
#return
($bgcolor,$fgcolor);
}
sub build_output {
print "Content-type: text/html\n\n";
print qq|
<html><head><title>test</title></head><body bgcolor="$bgcolor" text="$fgcolor">
text blablabla
</body></html>
|;
}
------------------------------------------------------
can anybody help me out? Thx. in advance :p
Greetz, Neverm1nd
------------------------------------------------------
#!/usr/bin/perl
# (I'm with F2s)
#page.cgi?bgcolor&fgcolor
sub get_query {
my $command;
my $bgcolor;
my $fgcolor;
if ($ENV{'QUERY_STRING'} ne '') {
$command = "$ENV{'QUERY_STRING'}";
} else {
#must have command line info to operate
error("No command line information");
}
if ($command =~ /(.*)&(.*)/) {
$bgcolor = $1;
$fgcolor = $2;
} else {
error("whatever");
}
#return
($bgcolor,$fgcolor);
}
sub build_output {
print "Content-type: text/html\n\n";
print qq|
<html><head><title>test</title></head><body bgcolor="$bgcolor" text="$fgcolor">
text blablabla
</body></html>
|;
}
------------------------------------------------------
can anybody help me out? Thx. in advance :p
Greetz, Neverm1nd