in reply to Re: Re: Premature end of script headers
in thread Premature end of script headers
I came up with the following code, but have no idea if it will work correctly as I am on a machine without a web server. It is more concise and it should be a lot easier to debug than your original script. I did verify the syntax using perl -c.
#!/usr/bin/perl -wT use strict; use CGI; use Mail::Mailer; my $query = CGI->new(); my %DATA = $query->Vars; my $body = "Hi, I have just visited your website.\n\n"; $body .= "Personal Details\n"; $body .= join "\n" , @DATA{qw(Title Name Position School Address Subur +b State PCode)}, ''; $body .= "Contact Details:\n"; $body .= "Tel: $DATA{Tel}\n"; $body .= "Tel: $DATA{Fax}\n"; $body .= "Tel: $DATA{Email}\n\n"; $body .= "I would like to register for the following presentations.\n" +; $body .= join "\n" , @DATA{qw(PR01 PR02 PR03 PR04 PR05 PR06 PR07 PR08) +}, ''; $body .= "List of Attendees.\n"; $body .= join "\n" , @DATA{qw(Att1 Att2 Att3 Att4 Att5 Att6 Att7 Att8 +Att9)}, ''; $body .= "Comments:\n"; $body .= "$DATA{Comments}\n\n"; my $mailer = new Mail::Mailer ( "smtp" ); $mailer->open( { To => 'info@travancoresch.vic.edu.au', From => $DATA{Email}, Subject => 'Travancore School Professional Development' } ); print $mailer $body; $mailer->close; print $query->redirect('http://www.travancoresch.vic.edu.au/developmen +t/reply02.html');
You really should get in the practice of validating form information. I have turned on Taint with the -T shebang line option as a future precaution against accepting user data without sanitizing it first if the script's functionality expands.
Cheers - L~R
Update: With some help from the CB, a few minor nits have been corrected
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Re: Premature end of script headers
by Anonymous Monk on Aug 04, 2003 at 23:37 UTC | |
by Limbic~Region (Chancellor) on Aug 05, 2003 at 00:10 UTC |