http://www.perlmonks.org?node_id=836734


in reply to Re: Mailling module Help in direction
in thread Mailling module Help in direction

Thank you for your reply.
Another Perl monk named Corion mantioned I should use CGI and little while ago. I did resist as the learning curb is already pretty big and having to relearn, well....
I now fully understand the advantages of use CGI now, security and a much better use of variables.
Bellow is my new and improved script. I have debugged though the command line and have had a syntax returned ok msg.
How ever running off of the server I am getting 500 errors.
Can anyone tell me the name of modules this script is using?.
#!/usr/bin/perl use strict; use warnings; use diagnostics; use cgi qw(:standard); use CGI::Carp 'fatalsToBrowser'; $CGI::POST_MAX=1024 * 100; # max 100K posts my $query = CGI->new(); my @names = $query->param; foreach my $name ( @names ) { my $value = $query->param( $name ); } my $organisers_name=('organisers_name'); my $organisers_address=('organisers_address'); my $organisers_homeN=('organisers_homeN'); my $organisers_mobile=('organisers_mobile'); my $organisers_email=('organisers_email'); my $prefered_contact=('prefered_contact'); my $brides_name=('brides_name'); my $brides_number=('brides_number'); my $wedding_date=('wedding_date'); my $bride_organiser=('bride_organiser'); my $suprise=('suprise'); print <<print_tag; <html> <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN" "http:/ +/www.w3.org/TR/html4/loose.dtd"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" > <title>$organisers_name Hens party with The Man in the Charcoal Suit b +ooking page</title> <link rel="stylesheet" type="text/css" href="../web_layout.css" > </head> <body onLoad="MM_preloadImages('buttons/list-off.jpg','buttons/list-on +.jpg','buttons/list-active.jpg')"> <div id="everything1"> <div id="top_text"> </div> <div id="left"> <div id="navcontainer"> <ul id="navlist"> <li><a href="../index.html"><img src="../images/Logo_p +ic.jpg" width="70" height="176" border="0"></a></li> <br> <li><a><img src="../images/icons/bookings.jpg" width=" +70" height="70" border="0" hspace="0"></a></li> <li><a href="../bookings.html">Booking office</a></li> <br> <li><a href="../comments.html"><img src="../images/ico +ns/comments.jpg" width="70" height="70" border="0" hspace="0"></a></l +i> <li><a href="../comments.html">Testimonials</a></li> <br> <li><a href="../contact.html"><img src="../images/icon +s/contact.jpg" width="70" height="70" border="0" hspace="0"></a></li> <li><a href="../contact.html">Contact Us</a></li> </ul> </div> </div> <div id="side_pic"></div> <div id="main1"> <img src="../images/booking_steps/step1.jpg" align="right"> <br> <p1><b1>So far so Good.</b1><br> <p1>Below lists the details that you have entered so far. <br> <b1>PLEASE CHECK THESE CAREFULLY</b1> <br> <p1>If everything is ok click the "proceed" button or the "return" + button to correct anything.<p1> <br> <br> <form method="post" action="bookings2.cgi"> <hr> <h1>Your details</h1> <p1>$organisers_name<br> <p1>$organisers_address<br> <p1>$organisers_homeN<br> <p1>$organisers_mobile<br> <p1>$organisers_email<br> <p1>How do you preferr to be contacted $prefered_contact<br> <br> <hr> <h1>The Bride to be's details</h1> <p1>$brides_name<br> <p1>$brides_number<br> <p1>The date of the wedding? $wedding_date<br> <p1>Is the Bride organising this party? $bride_organiser<br> <p1>Is this a suprise party for the Bride? $suprise<br> <hr> <INPUT TYPE="hidden" NAME="organisers_name" VALUE="$organisers_nam +e"> <INPUT TYPE="hidden" NAME="organisers_address" VALUE="$organisers_ +address"> <INPUT TYPE="hidden" NAME="organisers_homeN" VALUE="$organisers_ho +meN"> <INPUT TYPE="hidden" NAME="organisers_mobile" VALUE="$organisers_m +obile"> <INPUT TYPE="hidden" NAME="organisers_email" VALUE="$organisers_em +ail"> <INPUT TYPE="hidden" NAME="prefered_contact" VALUE="$prefered_cont +act"> <INPUT TYPE="hidden" NAME="brides_name" VALUE="$brides_name"> <INPUT TYPE="hidden" NAME="brides_number" VALUE="$brides_number"> <INPUT TYPE="hidden" NAME="wedding_date" VALUE="$wedding_date"> <INPUT TYPE="hidden" NAME="bride_organiser" VALUE="$bride_organise +r"> <INPUT TYPE="hidden" NAME="suprise" VALUE="suprise"> <INPUT TYPE="button" VALUE="Back" onClick="history.go(-1);return t +rue;"> <INPUT type="submit" value="Proceed to Step 2"> </FORM> </div> </div> </body> </html> print_tag

Replies are listed 'Best First'.
Re^3: Mailling module Help in direction
by marto (Cardinal) on Apr 25, 2010 at 09:11 UTC

    A few things. Firstly cgi-lib is old, very old. Please do not use this, it has some nasty security flaws and IIRC isn't 100% compliant with the CGI specification. Use the CGI module, it will be well worth the short time taken to replace cgi-lib. Secondly, your code is missing:

    use strict; use warnings;

    See Use strict and warnings.

    On to your question. For your example above, does your script receive the input correctly? If I where you, I'd do the following:

    After this is you have further problems please let us know.

    Hope this helps.