I've made a script and it comes up an error when I try to use it.
It's a simple form script, but this nasty error is stopping everything.
Here's the error:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, drift@page.no* and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Okey that's it. The * is a thing I added just to show that the email address isen't the one that came up.
Well, I'll post the script.
Have checked it, but I'm terrible at finding my own mistakes.
Here is it:
- - - - - - - - - - - - - -
#!/usr/bin/perl -wT
print "Content-type:text/html\n\n";
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@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/\n/ /g;
$value =~ s/\r//h;
$value =~ s/\cM//g;
$FORM{$name} = $value;
}
$email = 'kbergem@hotmail.com';
$subjekt = "Ivar Script svar!";
$mailprog = '/usr/sbin/sendmail';
open (MAIL, "|$mailprog -t") or diesub("Kan ikke åpne $mailprog!\n");
print MAIL "To: $email\n";
print MAIL "Subject: $subjekt\n\n";
print MAIL <<EndHTML;
Ivar har fylt ut sjemaet og dette ville han ha:
Messenger: $FORM{'messenger'}
Ultra Wincleaner: $FORM{'wincleaner'}
KaZaA: $FORM{'kazaa'}
DivX: $FORM{'divx'}
Kommentaren:
$FORM{'kommentar'}
EndHTML
close(MAIL);
print <<StartHTML;
<html><head><title>Takk Ivar!</title>
</head>
<body>
<h2>Takk, Ivar!</h2><p>
Takk, onkel Ivar for at du fylte ut sjemaet!<br>
Det skal bli gjort!<br>
God tur til Afrika!
</body>
</html>
StartHTML
# Sub's
sub diesub {
my($errmsg) = @_;
print "<html><body>";
print "<h2>Error</h2>\n";
print "$errmsg\n";
print "</body></html>\n";
exit;
}
- - - - - - - - - - - - -
Think the error come out of the <<EndHTML; in the email posting.
Somebody tell me what I have done wrong.
AND I DON'T WANT TO USE CGI.PM! (Yet)
It's a simple form script, but this nasty error is stopping everything.
Here's the error:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, drift@page.no* and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Okey that's it. The * is a thing I added just to show that the email address isen't the one that came up.
Well, I'll post the script.
Have checked it, but I'm terrible at finding my own mistakes.
Here is it:
- - - - - - - - - - - - - -
#!/usr/bin/perl -wT
print "Content-type:text/html\n\n";
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@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/\n/ /g;
$value =~ s/\r//h;
$value =~ s/\cM//g;
$FORM{$name} = $value;
}
$email = 'kbergem@hotmail.com';
$subjekt = "Ivar Script svar!";
$mailprog = '/usr/sbin/sendmail';
open (MAIL, "|$mailprog -t") or diesub("Kan ikke åpne $mailprog!\n");
print MAIL "To: $email\n";
print MAIL "Subject: $subjekt\n\n";
print MAIL <<EndHTML;
Ivar har fylt ut sjemaet og dette ville han ha:
Messenger: $FORM{'messenger'}
Ultra Wincleaner: $FORM{'wincleaner'}
KaZaA: $FORM{'kazaa'}
DivX: $FORM{'divx'}
Kommentaren:
$FORM{'kommentar'}
EndHTML
close(MAIL);
print <<StartHTML;
<html><head><title>Takk Ivar!</title>
</head>
<body>
<h2>Takk, Ivar!</h2><p>
Takk, onkel Ivar for at du fylte ut sjemaet!<br>
Det skal bli gjort!<br>
God tur til Afrika!
</body>
</html>
StartHTML
# Sub's
sub diesub {
my($errmsg) = @_;
print "<html><body>";
print "<h2>Error</h2>\n";
print "$errmsg\n";
print "</body></html>\n";
exit;
}
- - - - - - - - - - - - -
Think the error come out of the <<EndHTML; in the email posting.
Somebody tell me what I have done wrong.
AND I DON'T WANT TO USE CGI.PM! (Yet)