From owner-freebsd-questions@FreeBSD.ORG Sun Oct 5 11:50:26 2003 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 67B7A16A4B3 for ; Sun, 5 Oct 2003 11:50:26 -0700 (PDT) Received: from remt24.cluster1.charter.net (remt24.cluster1.charter.net [209.225.8.34]) by mx1.FreeBSD.org (Postfix) with ESMTP id 32B9F43FF3 for ; Sun, 5 Oct 2003 11:50:25 -0700 (PDT) (envelope-from chowse@charter.net) Received: from [66.168.145.25] (HELO moe) by remt24.cluster1.charter.net (CommuniGate Pro SMTP 4.0.6) with ESMTP id 14992044; Sun, 05 Oct 2003 14:50:23 -0400 From: "Charles Howse" To: "'Nick Rogness'" Date: Sun, 5 Oct 2003 13:50:20 -0500 Message-ID: <003a01c38b71$86d18830$04fea8c0@moe> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.2616 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 In-Reply-To: <20031005025435.U45148-100000@skywalker.rogness.net> Importance: Normal cc: freebsd-questions@freebsd.org Subject: RE: Perl cgi redirect not working X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Oct 2003 18:50:26 -0000 > > #!/usr/bin/perl > > > > read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); > > @pairs =3D split(/&/, $buffer); > > foreach $pair (@pairs) > > { > > ($name, $value) =3D split(/=3D/, $pair); > > $value =3D~ tr/+/ /; > > ^ > > $value =3D~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; > > ^ > > $value =3D~ s/~!/ ~!/g; > > ^ ^ ^ > > $FORM{$name} =3D $value; > > } > > > > print "Content-type: text/html\n\n"; > > > > open (MAIL,"| /usr/sbin/sendmail -oi -t"); > > print MAIL "From: $FORM{'name'} <$FORM{'email'}>\n"; > > print MAIL "To: charles\n"; > > print MAIL "Subject: Contact form output\n\n"; > > print MAIL "$FORM{'name'}, from $ENV{'REMOTE_HOST'} > > ($ENV{'REMOTE_ADDR'}), has sent you the following comment:\n\n"; > > print MAIL "$FORM{'comment'}\n"; > > close (MAIL); > > > > print "Location: http://howse.no-ip.org/thanks.shtml\n\n"; > > >=20 > 1) This is a little extreme for a simple redirect. A simple=20 > 3 liner will > do the trick: >=20 > #!/usr/bin/perl >=20 > print "Location: http://howse.no-ip.org/thanks.shtml\n\n"; > exit; Actually, this was a CGI script to respond to an email form on my website. When I posted asking the same question on a newsgroup, I was flamed so severely for using "buggy, crappy" code that got busy, did some research, and have moved 'up' to FormMail.pl, which is working perfectly now. The problem with the book code is that 'Content-type' line. Removing it fixes that code. >=20 > 2) They are suppose to be tildes (~). Thank you for a respectful answer. :-)