Broken Pipe Another 500 error

 
Post new topic   Reply to topic    Aprelium Forum Index -> Perl
View previous topic :: View next topic  
Author Message
jim0joe0bob
-


Joined: 26 Jun 2005
Posts: 1

PostPosted: Sun Jun 26, 2005 1:09 pm    Post subject: Broken Pipe Another 500 error Reply with quote

I have seen so many posts and i still walking n circles
Here is my script ,and i have done everything the installtion guide told me PLz help
Quote:

print "Status: 200 OK";
print "";
print "<HTML>";
print "<TITLE></TITLE>";
print "<BODY>";
print "<P>Hello from ActivePerl!";
print "</HTML>";



$guestbookurl = "http://64.4.231.143/guestbook/guestbook.html";
$guestbookreal = "Abyss Web Server/htdocs/guestbook/guestbook.html";
$guestlog = "Abyss Web Server/htdocs/guestbook/guestlog.html";
$cgiurl = "http://64.4.231.143/cgi/guestbook.pl";
$date_command = "none";

# Set Your Options:
$mail = 0; # 1 = Yes; 0 = No
$uselog = 1; # 1 = Yes; 0 = No
$linkmail = 1; # 1 = Yes; 0 = No
$separator = 1; # 1 = <hr>; 0 = <p>
$redirection = 0; # 1 = Yes; 0 = No
$entry_order = 1; # 1 = Newest entries added first;
# 0 = Newest Entries added last.
$remote_mail = 0; # 1 = Yes; 0 = No
$allow_html = 1; # 1 = Yes; 0 = No
$line_breaks = 0; # 1 = Yes; 0 = No


$mailprog = '/usr/lib/sendmail';
$recipient = 'you@your.com';




$date = `$date_command +"%A, %B %d, %Y at %T (%Z)"`; chop($date);
$shortdate = `$date_command +"%D %T %Z"`; chop($shortdate);




@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;

if ($allow_html != 1) {
$value =~ s/<([^>]|\n)*>//g;
}

$FORM{$name} = $value;
}


&no_comments unless $FORM{'comments'};
&no_name unless $FORM{'realname'};


open (FILE,"$guestbookreal") || die "Can't Open $guestbookreal: $!\n";
@LINES=<FILE>;
close(FILE);
$SIZE=@LINES;

open (GUEST,">$guestbookreal") || die "Can't Open $guestbookreal: $!\n";

for ($i=0;$i<=$SIZE;$i++) {
$_=$LINES[$i];
if (/<!--begin-->/) {

if ($entry_order eq '1') {
print GUEST "<!--begin-->\n";
}

if ($line_breaks == 1) {
$FORM{'comments'} =~ s/\cM\n/<br>\n/g;
}

print GUEST "<b>$FORM{'comments'}</b><br>\n";

if ($FORM{'url'}) {
print GUEST "<a href=\"$FORM{'url'}\">$FORM{'realname'}</a>";
}
else {
print GUEST "$FORM{'realname'}";
}

if ( $FORM{'username'} ){
if ($linkmail eq '1') {
print GUEST " \&lt;<a href=\"mailto:$FORM{'username'}\">";
print GUEST "$FORM{'username'}</a>\&gt;";
}
else {
print GUEST " &lt;$FORM{'username'}&gt;";
}
}

print GUEST "<br>\n";

if ( $FORM{'city'} ){
print GUEST "$FORM{'city'},";
}

if ( $FORM{'state'} ){
print GUEST " $FORM{'state'}";
}

if ( $FORM{'country'} ){
print GUEST " $FORM{'country'}";
}

if ($separator eq '1') {
print GUEST " - $date<hr>\n\n";
}
else {
print GUEST " - $date<p>\n\n";
}

if ($entry_order eq '0') {
print GUEST "<!--begin-->\n";
}

}
else {
print GUEST $_;
}
}

close (GUEST);


if ($uselog eq '1') {
&log('entry');
}





if ($mail eq '1') {
open (MAIL, "|$mailprog $recipient") || die "Can't open $mailprog!\n";

print MAIL "Reply-to: $FORM{'username'} ($FORM{'realname'})\n";
print MAIL "From: $FORM{'username'} ($FORM{'realname'})\n";
print MAIL "Subject: Entry to Guestbook\n\n";
print MAIL "You have a new entry in your guestbook:\n\n";
print MAIL "------------------------------------------------------\n";
print MAIL "$FORM{'comments'}\n";
print MAIL "$FORM{'realname'}";

if ( $FORM{'username'} ){
print MAIL " <$FORM{'username'}>";
}

print MAIL "\n";

if ( $FORM{'city'} ){
print MAIL "$FORM{'city'},";
}

if ( $FORM{'state'} ){
print MAIL " $FORM{'state'}";
}

if ( $FORM{'country'} ){
print MAIL " $FORM{'country'}";
}

print MAIL " - $date\n";
print MAIL "------------------------------------------------------\n";

close (MAIL);
}

if ($remote_mail eq '1' && $FORM{'username'}) {
open (MAIL, "|$mailprog -t") || die "Can't open $mailprog!\n";

print MAIL "To: $FORM{'username'}\n";
print MAIL "From: $recipient\n";
print MAIL "Subject: Entry to Guestbook\n\n";
print MAIL "Thank you for adding to my guestbook.\n\n";
print MAIL "------------------------------------------------------\n";
print MAIL "$FORM{'comments'}\n";
print MAIL "$FORM{'realname'}";

if ( $FORM{'username'} ){
print MAIL " <$FORM{'username'}>";
}

print MAIL "\n";

if ( $FORM{'city'} ){
print MAIL "$FORM{'city'},";
}

if ( $FORM{'state'} ){
print MAIL " $FORM{'state'}";
}

if ( $FORM{'country'} ){
print MAIL " $FORM{'country'}";
}

print MAIL " - $date\n";
print MAIL "------------------------------------------------------\n";

close (MAIL);
}

if ($redirection eq '1') {
print "Location: $guestbookurl\n\n";
}
else {
&no_redirection;
}


sub no_comments {
print "Content-type: text/html\n\n";
print "<html><head><title>No Comments</title></head>\n";
print "<body><h1>Your Comments appear to be blank</h1>\n";
print "The comment section in the guestbook fillout form appears\n";
print "to be blank and therefore the Guestbook Addition was not\n";
print "added. Please enter your comments below.<p>\n";
print "<form method=POST action=\"$cgiurl\">\n";
print "Your Name:<input type=text name=\"realname\" size=30 ";
print "value=\"$FORM{'realname'}\"><br>\n";
print "E-Mail: <input type=text name=\"username\"";
print "value=\"$FORM{'username'}\" size=40><br>\n";
print "City: <input type=text name=\"city\" value=\"$FORM{'city'}\" ";
print "size=15>, State: <input type=text name=\"state\" ";
print "value=\"$FORM{'state'}\" size=15> Country: <input type=text ";
print "name=\"country\" value=\"$FORM{'country'}\" size=15><p>\n";
print "Comments:<br>\n";
print "<textarea name=\"comments\" COLS=60 ROWS=4></textarea><p>\n";
print "<input type=submit> * <input type=reset></form><hr>\n";
print "Return to the <a href=\"$guestbookurl\">Guestbook</a>.";
print "\n</body></html>\n";

if ($uselog eq '1') {
&log('no_comments');
}

exit;
}

sub no_name {
print "Content-type: text/html\n\n";
print "<html><head><title>No Name</title></head>\n";
print "<body><h1>Your Name appears to be blank</h1>\n";
print "The Name Section in the guestbook fillout form appears to\n";
print "be blank and therefore your entry to the guestbook was not\n";
print "added. Please add your name in the blank below.<p>\n";
print "<form method=POST action=\"$cgiurl\">\n";
print "Your Name:<input type=text name=\"realname\" size=30><br>\n";
print "E-Mail: <input type=text name=\"username\"";
print " value=\"$FORM{'username'}\" size=40><br>\n";
print "City: <input type=text name=\"city\" value=\"$FORM{'city'}\" ";
print "size=15>, State: <input type=text name=\"state\" ";
print "value=\"$FORM{'state'}\" size=2> Country: <input type=text ";
print "value=USA name=\"country\" value=\"$FORM{'country'}\" ";
print "size=15><p>\n";
print "Comments have been retained.<p>\n";
print "<input type=hidden name=\"comments\" ";
print "value=\"$FORM{'comments'}\">\n";
print "<input type=submit> * <input type=reset><hr>\n";
print "Return to the <a href=\"$guestbookurl\">Guestbook</a>.";
print "\n</body></html>\n";


if ($uselog eq '1') {
&log('no_name');
}

exit;
}


sub log {
$log_type = $_[0];
open (LOG, ">>$guestlog");
if ($log_type eq 'entry') {
print LOG "$ENV{'REMOTE_HOST'} - [$shortdate]<br>\n";
}
elsif ($log_type eq 'no_name') {
print LOG "$ENV{'REMOTE_HOST'} - [$shortdate] - ERR: No Name<br>\n";
}
elsif ($log_type eq 'no_comments') {
print LOG "$ENV{'REMOTE_HOST'} - [$shortdate] - ERR: No ";
print LOG "Comments<br>\n";
}
}


sub no_redirection {


print "Content-Type: text/html\n\n";
print "<html><head><title>Thank You</title></head>\n";
print "<body><h1>Thank You For Signing The Guestbook</h1>\n";


print "Thank you for filling in the guestbook. Your entry has\n";
print "been added to the guestbook.<hr>\n";
print "Here is what you submitted:<p>\n";
print "<b>$FORM{'comments'}</b><br>\n";

if ($FORM{'url'}) {
print "<a href=\"$FORM{'url'}\">$FORM{'realname'}</a>";
}
else {
print "$FORM{'realname'}";
}

if ( $FORM{'username'} ){
if ($linkmail eq '1') {
print " &lt;<a href=\"mailto:$FORM{'username'}\">";
print "$FORM{'username'}</a>&gt;";
}
else {
print " &lt;$FORM{'username'}&gt;";
}
}

print "<br>\n";

if ( $FORM{'city'} ){
print "$FORM{'city'},";
}

if ( $FORM{'state'} ){
print " $FORM{'state'}";
}

if ( $FORM{'country'} ){
print " $FORM{'country'}";
}

print " - $date<p>\n";


print "<hr>\n";
print "<a href=\"$guestbookurl\">Back to the Guestbook</a>\n"; print "- You may need to reload it when you get there to see your\n";
print "entry.\n";
print "</body></html>\n";

exit;
}





Anything will help
Back to top View user's profile Send private message
aprelium
-


Joined: 22 Mar 2002
Posts: 6800

PostPosted: Mon Jun 27, 2005 1:08 pm    Post subject: Re: Broken Pipe Another 500 error Reply with quote

jim0joe0bob wrote:
I have seen so many posts and i still walking n circles
Here is my script ,and i have done everything the installtion guide told me PLz help

Most posts about Error 500 recommend looking for the error(s) reported by Perl in log/cgi.log file. So have a look on this file and you'll find why Perl refused to execute your script (which is almost a syntax problem).

If you cannot fix the problem, tell us what you've found in log/cgi.log .
_________________
Support Team
Aprelium - http://www.aprelium.com
Back to top View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> Perl All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group