D
David Baker
I am a total newbie, and have no idea what I am doing. I have created
a html form, and am tring to pass some variable to a perl script to
make it update a guest book. When ever I press submit on my form, I
get a "HTTP 500 - Internal server error". I checked and the server is
working fine. Here is my code. If anyone has any idea's I really
appreciated it.
#!/user/bin/perl
if($ENV{'REQUEST_METHOD'} eq 'GET')
{
$in_string= $ENV{'QUERY_STRING'};
}
elsif ($ENV{'REQUEST_METHOD'} eq 'POST')
{
read(STDIN, $in_string, $ENV{'CONTENT_LENGTH'});
}
@an_array = split('&', $in_string);
$array_length = @an_array;
for($i=0; $i<$array_length; $i++)
{
($var_name, $value) = split('=', $an_array[$i]);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-f0-9])/pack("C", hex($1))/eg;
$value =~ s/<!--(.|\n)*-->//g;
$var_name =~ tr/+/ /;
$var_name =~ s/%([a-fA-F0-9][a-fA-F0-9]/pack("C", hex($1))/eg;
$var_name =~ s/<!--(.|\n)*-->//g;
$in_vars{$var_name} = $value;
}
open (LOG, ">>../LOG.txt");
print LOG ("Name: $in_vars{'username'}\nEmail Address:
$in_vars{'email'}\nWeb site: $in_vars{'website'}\nHow you found this
site: $in_vars{'R1'}\nYou said: {'Comment'}\n\n----\n\n");
close (LOG);
a html form, and am tring to pass some variable to a perl script to
make it update a guest book. When ever I press submit on my form, I
get a "HTTP 500 - Internal server error". I checked and the server is
working fine. Here is my code. If anyone has any idea's I really
appreciated it.
#!/user/bin/perl
if($ENV{'REQUEST_METHOD'} eq 'GET')
{
$in_string= $ENV{'QUERY_STRING'};
}
elsif ($ENV{'REQUEST_METHOD'} eq 'POST')
{
read(STDIN, $in_string, $ENV{'CONTENT_LENGTH'});
}
@an_array = split('&', $in_string);
$array_length = @an_array;
for($i=0; $i<$array_length; $i++)
{
($var_name, $value) = split('=', $an_array[$i]);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-f0-9])/pack("C", hex($1))/eg;
$value =~ s/<!--(.|\n)*-->//g;
$var_name =~ tr/+/ /;
$var_name =~ s/%([a-fA-F0-9][a-fA-F0-9]/pack("C", hex($1))/eg;
$var_name =~ s/<!--(.|\n)*-->//g;
$in_vars{$var_name} = $value;
}
open (LOG, ">>../LOG.txt");
print LOG ("Name: $in_vars{'username'}\nEmail Address:
$in_vars{'email'}\nWeb site: $in_vars{'website'}\nHow you found this
site: $in_vars{'R1'}\nYou said: {'Comment'}\n\n----\n\n");
close (LOG);