#!/usr/local/bin/perl #### # # Program: svetime2.pl # Cimmaron Design 7/2017 # 720 448-4927 # #### #### # # The libraries to use... CGI for the CGI functions used in print statements. # Use 'perldoc CGI' to find out more about the CGI functions. # #### use CGI qw/:all/; #### # # The param function will determine if there was a CGI submission. # #### if (param) { #### # # This is where we want to be, print out a nice HTML header # and start to process the stuff that the server will send in # email to the user and the guys who are going to actually # fill the inquiry . # #### print STDOUT header; print STDOUT start_html('Sovereign Brittany Questionnaire'); #### # # Okay - next we will verify *all* the fields on the order # form are listed properly, and verify their correctness. # If those conditions are met, then we'll print out what the # email will look like, and save it off to a variable that we # can pipe to the email program. # #### $your_email_address = param('your_email_address'); $your_name = param('your_name'); $email_subject_line = param('email_subject_line'); $required_fields = param('required_fields'); $thank_you_title = param('thank_you_title'); $return_link_url = param('return_link_url'); $return_link_name = param('return_link_name'); $client_email = param('client_email'); $client_name = param('client_name'); $client_phone = param('client_phone'); $tell = param('tell'); $owned = param('owned'); $lookingfor = param('lookingfor'); $how = param('how'); $fenced = param('fenced'); $time = param('time'); $sex = param('sex'); $house = param('house'); $out = param('out'); $comp = param('comp'); $comments = param('comments'); #### # # So - lets print out some HTML to show them what they ordered, # and get verification that it's all good. # #### $inquiry = ""; $inquiry .= " Email: $client_email\n"; $inquiry .= " Name: $client_name\n"; $inquiry .= " Phone: $client_phone\n"; $inquiry .= " ----------------------------------------------------------\n"; if ( length($tell) > 1 ) { $inquiry .= "Please tell us a little about your home and family (including number of children and ages at home). \n"; $inquiry .= "$tell\n"; $inquiry .= "___________________________________________________________________________\n"; } if ( length($owned) > 1 ) { $inquiry .= "Have you owned a dog/Brittany (raised a puppy)? \n"; $inquiry .= "$owned\n"; $inquiry .= "___________________________________________________________________________\n"; } if ( length($lookingfor) > 1 ) { $inquiry .= "What are you looking for in a Brittany? \n"; $inquiry .= "$lookingfor\n"; $inquiry .= "___________________________________________________________________________\n"; } if ( length($how) > 1 ) { $inquiry .= "If you are looking for a hunting dog, how often do you hunt? Will you be using a professional trainer? \n"; $inquiry .= "$how\n"; $inquiry .= "___________________________________________________________________________\n"; } if ( length($fenced) > 1 ) { $inquiry .= "Do you have a fenced in yard? \n"; $inquiry .= "$fenced\n"; $inquiry .= "___________________________________________________________________________\n"; } if ( length($sex) > 1 ) { $inquiry .= "Are you looking for a male or female, or open to either? \n"; $inquiry .= "$sex\n"; $inquiry .= "___________________________________________________________________________\n"; } if ( length($house) > 1 ) { $inquiry .= "Where will this puppy/dog live? Where will it stay when you are not home? \n"; $inquiry .= "$house\n"; $inquiry .= "___________________________________________________________________________\n"; } if ( length($out) > 1 ) { $inquiry .= "Will there be someone home during the day to take the puppy out? \n"; $inquiry .= "$out\n"; $inquiry .= "___________________________________________________________________________\n"; } if ( length($comp) > 1 ) { $inquiry .= "Do you have any interest in competing with your dog (ie. conformation shows, hunt tests, field trials, agility, obedience, rally, lure coursing, barn hunt, etc)? \n"; $inquiry .= "$comp\n"; $inquiry .= "___________________________________________________________________________\n"; } if ( length($comments) > 1 ) { $inquiry .= "Additional Comments:\n"; $inquiry .= "$comments\n"; $inquiry .= "___________________________________________________________________________\n"; } #### # # Now we've got the order as it was displayed to the user # in the last script stuck inside a variable. We can send # that out in an email to the required email addresses, *and* # print it on the screen for the user again to make sure its # perfect, but there's no going back now... # #### print STDOUT h3({-align=>'center'}, font( {-color=>"#AF0000"}, "Sovereign Brittany Questionnaire" ) ), "\n"; print STDOUT hr( {-noshade} ), "\n"; print STDOUT "
\n"; print STDOUT $inquiry; print STDOUT "\n"; print STDOUT "
Mail failed to $client_email
\n"; } if ( open (MAIL2, "| mail -s \"$email_subject_line\" $your_email_address") != 0 ) { print MAIL2 $inquiry; close MAIL2; print STDOUT "Mail sent to $your_email_address (to process this inquiry)
\n"; } else { print STDOUT "Mail FAILED to $your_email_address (Will NOT process this inquiry)
\n"; } print STDOUT "click $return_link_name to return.
\n"; print STDOUT "