#!/usr/local/bin/perl #### # # Program: question1.pl # Cimmaron Design # 702 448-4927 # #### #### # # Image Uploading Routine # #### #### # # 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/; #### # # Begin of the main code # #### #### # # 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 order. # #### print STDOUT header; print STDOUT start_html('View Sovereign 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'); #### # # Now - to verify each of the *required* entries... the # undefined ones weren't used in what the user listed... # We'll go through all the errors, and then print out what # we find, instead of breaking if there's just one and not # showing any others we might find as well, to make it more # usable. # #### $err_no = 0; if ( ! defined($your_email_address) ) { $err[$err_no++]="Invalid hidden fields 'your_email_address'\n"; } if ( ! defined($your_name) ) { $err[$err_no++]="Invalid hidden fields 'your_name'\n"; } if ( ! defined($email_subject_line) ) { $err[$err_no++]="Invalid hidden fields 'email_subject_line'\n"; } if ( ! defined($thank_you_title) ) { $err[$err_no++]="Invalid hidden fields 'thank_you_title'\n"; } if ( ! defined($return_link_url) ) { $err[$err_no++]="Invalid hidden fields 'return_link_url'\n"; } if ( ! defined($return_link_name) ) { $err[$err_no++]="Invalid hidden fields 'return_link_name'\n"; } #### # # User information next... # #### if ( ! defined($client_email) ) { $err[$err_no++]="You must enter an email address\n"; } else { if ( $client_email eq "" ) { $err[$err_no++]="You must enter an email address\n"; } } if ( ! defined($client_name) ) { $err[$err_no++]="You must enter a name\n"; } else { if ( $client_name eq "" ) { $err[$err_no++]="You must enter a name\n"; } } if ( ! defined($client_phone) ) { $err[$err_no++]="You must enter a phone number\n"; } else { if ( $client_name eq "" ) { $err[$err_no++]="You must enter a phone number\n"; } } #### # # Verifications complete. Next we check if there were # any errors. If there were, print them, and exit, if not, # then print out what we're here after - the order form. # #### if ( $err_no > 0 ) { print STDOUT h2({-align=>'center'}, font( {-color=>"#AF0000"}, "Submitted Questionnaire - Sovereign Brittanys - errors" ) ), "\n"; print STDOUT hr( {-noshade} ), "\n"; print STDOUT "\n"; print STDOUT end_html, "\n"; exit; } #### # # So - lets print out some HTML to show them what they ordered, # and get verification that it's all good. # #### print STDOUT h2({-align=>'center'}, font( {-color=>"#AF0000"}, "Submitted Sovereign Questionnaire" ) ), "\n"; print STDOUT hr( {-noshade} ), "\n"; print STDOUT "
\n";
	if ($imageError) {
		my @vars = sort(keys(%ENV));
#foreach(@vars) {
#        $ENV{$_} ||= qq~›~;
#print qq~
#        
#        $of\$ENV{$_}$cf
#        $of$ENV{$_}$cf
#        
#~;               
#}
		print STDOUT "             Upload Error: $returned\n";
	}
	print STDOUT "Email Address:			$client_email\n";
	print STDOUT "Your Name:			$client_name\n";
	print STDOUT "Your Phone:			$client_phone\n";
	print STDOUT "___________________________________________________________________________\n";
	if ( length($tell) > 1 ) {
		print STDOUT "Please tell us a little about your home and family (including number of children and ages at home). \n";
		print STDOUT "$tell\n";
	print STDOUT "___________________________________________________________________________\n";	
	}
	if ( length($owned) > 1 ) {
		print STDOUT "Have you owned a dog/Brittany (raised a puppy)? \n";
		print STDOUT "$owned\n";
	print STDOUT "___________________________________________________________________________\n";
	}
	if ( length($lookingfor) > 1 ) {
		print STDOUT "What are you looking for in a Brittany? \n";
		print STDOUT "$lookingfor\n";
	print STDOUT "___________________________________________________________________________\n";
	}
	if ( length($how) > 1 ) {
		print STDOUT "If you are looking for a hunting dog, how often do you hunt?
	Will you be using a professional trainer? \n";
		print STDOUT "$how\n";
	print STDOUT "___________________________________________________________________________\n";
	}
	if ( length($fenced) > 1 ) {
		print STDOUT "Do you have a fenced in yard? \n";
		print STDOUT "$fenced\n";
	print STDOUT "___________________________________________________________________________\n";
	}
	if ( length($sex) > 1 ) {
		print STDOUT "Are you looking for a male or female, or open to either? \n";
		print STDOUT "$sex\n";
	print STDOUT "___________________________________________________________________________\n";
	}
	if ( length($house) > 1 ) {
		print STDOUT "Where will this puppy/dog live? Where will it stay when you are not home? \n";
		print STDOUT "$house\n";
	print STDOUT "___________________________________________________________________________\n";
	}
	if ( length($out) > 1 ) {
		print STDOUT "Will there be someone home during the day to take the puppy out? \n";
		print STDOUT "$out\n";
	print STDOUT "___________________________________________________________________________\n";
	}
	if ( length($comp) > 1 ) {
		print STDOUT "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";
		print STDOUT "$comp\n";
	print STDOUT "___________________________________________________________________________\n";
	}
	if ( length($comments) > 1 ) {
		print STDOUT "Additional Comments:\n";
		print STDOUT "$comments\n";
	}
	print STDOUT "
\n"; print STDOUT "
\n"; ##### # # Now, for the next cgi in line, we'll need ALL # the elements of the last page, to print out on the # email that's going to the address specified in the # html file, and the one specified on the form (the client) # #### if (!$imageError) { print STDOUT "\n"; print STDOUT "\n"; } print STDOUT "\n"; print STDOUT "\n"; print STDOUT "\n"; print STDOUT "\n"; print STDOUT "\n"; print STDOUT "\n"; print STDOUT "\n"; print STDOUT "\n"; print STDOUT "\n"; print STDOUT "\n"; print STDOUT "\n"; print STDOUT "\n"; print STDOUT "\n"; print STDOUT "\n"; print STDOUT "\n"; print STDOUT "\n"; print STDOUT "\n"; print STDOUT "\n"; print STDOUT "\n"; print STDOUT "\n"; print STDOUT "\n"; print STDOUT "\n"; print STDOUT "
\n"; print STDOUT "\n"; print STDOUT "\n"; print STDOUT "
\n"; } else { #### # # Somehow they got here without going to the order form html # page... so lets just print out an error and tell them to hit # a link to the submissionform.html page # #### print STDOUT header; print STDOUT start_html('Error'); print STDOUT h1( {-align=>'center'}, font( {-color=>'#AF0000'}, "Error") ), "\n"; print STDOUT hr( {-noshade} ), "\n"; print STDOUT div( {-align=>'center'}, "Please return to the ", a({-href=>'questionnaire18.html'}, "Questionnaire") , "\n", "instead of calling this CGI directly\n"), "\n"; } #### # # That's all folks :-) # #### print STDOUT end_html, "\n"; #### #!/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 "
\n"; print STDOUT "

$thank_you_for_your_filling_out_our_questionnaire

\n"; #### # # On a windows system, the mail command may need to change # I don't have one to test with, but the lines that say # "open ( MAILx" are the ones that you'll need to fuss with... # #### if ( open (MAIL1, "| mail -s \"$email_subject_line\" $client_email") != 0 ) { print MAIL1 $inquiry; close MAIL1; } else { 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 "
\n"; } else { #### # # Somehow they got here without going to the order form html # page... so lets just print out an error and tell them to hit # a link to the contact.html page # #### print STDOUT header; print STDOUT start_html('Error'); print STDOUT h1( {-align=>'center'}, font( {-color=>'#AF0000'}, "Error") ), "\n"; print STDOUT hr( {-noshade} ), "\n"; print STDOUT div( {-align=>'center'}, "Please return to the ", a({-href=>'index.html'}, "Sovereign Brittanys.") , "\n", "instead of calling this CGI directly\n"), "\n"; } #### # # That's all folks :-) # #### print STDOUT end_html, "\n";