#!/usr/local/bin/perl # +-----------------------------------------------+ # | isorder.cgi -- Internet Secure Order form | # | | # | Author : Ryan William Facer | # | Created On : Monday February 1, 1998 | # | Completed On : Wednesday February 3, 1998 | # | Last Modified By : Ryan William Facer | # | Last Modified On : Wednesday February 3, 1998 | # | Update Count : 0 | # | E-Mail : cattails@cattails.ca | # +-----------------------------------------------+ $numproducts = 3; # Variable holding the number of user data fields $maxitemlength = 45; # Length in chars of longest item (used for formatting) $totalordered = 0; # Total number of products ordered # ******************************* # We include the cgi-lib.cgi file # ******************************* do "cgi-lib.cgi" || die "Content-type: text/plain\n\nError loading cgi-lib\n"; # ************************************************* # Now we call the subroutine in cgi-lib.cgi to read # in the variables from the form and set them up as # 'key'='value' pairs in the array @in # ************************************************* &ReadParse; print "Content-type: text/html\n\n"; # **************************************************** # Print out the top of the HTML page that will be seen # **************************************************** print "\n"; print "Body Break Order Form 7\n"; print "\n\n"; # ********************************* # Step 1 - Set up form destination # ********************************* print "
\n"; # ******************************************** # Define MerchantNumber,language and ReturnURL # ******************************************** print "\n"; print "\n"; print "\n\n"; # ***************************************************** # Now we get all the product data. We pop it all off of # the @in array and push it onto a new array called # @userdata. It will come off in the reverse order # that it appeared in the HTML file. Fields found to # be empty will be added onto an array called @empty # which will be examined later to check for errors. # ***************************************************** # *************************************************** # The first item on the array will be the location of # the buyer, if they entered it. If it exists, we pop # it off the array and then we can use it for the # shipping calculations later on. # *************************************************** $location = $in{'Location'}; if($location ne ''){ $location = pop(@in); ($name, $value) = split(/=/, $location); $location = $value; } else { print "

You didn't enter a location. Please press the back button "; print "on your browser and enter your location.

\n"; print "\n"; print "\n"; exit; }; # if # *********************************************** # We only go through the @in array $numproducts # times which was defined up top to be the number # of products that a user can order. We iterate # $numproducts times popping off the the values. # *********************************************** print " 0){ $totalordered = $totalordered + $quantity; print "|"; print "$price::$quantity::$code::$name::"; if ( $location eq 'Ontario' ){ print "{GST}{PST}"; } elsif ( $location eq 'Canada' ){ print "{GST}"; }; # if }; # if }; # for # **************************************** # The most a person can order is 25 items. # **************************************** if($totalordered > 25){ print ">\n\n"; # End the hidden input tag print "

You can not order more than 25 items at a time. "; print "Please press the back button on your browser and "; print "either order a smaller amount, or contact Body Break.

\n"; print "\n"; print "\n"; exit; }; # if # ********************************************** # Now it's time to do the shipping calculations. # ********************************************** if($totalordered > 0){ print "|"; if ( ( $location eq 'Ontario' )||( $location eq 'Canada' ) ){ if($totalordered > 2){ print "7.95"; } else { print "4.95"; }; # if print "::1::Ship::Shipping::"; } elsif ($location eq 'USA'){ if($totalordered > 2){ print "9.95"; } else { print "6.95"; }; # if print "::1::Ship::Shipping::"; } else { # International orders if($totalordered > 2){ print "12.95"; } else { print "9.95"; }; # if print "::1::Ship::Shipping::"; }; # if print "\">\n\n"; # End the hidden input tag print "\n"; }; # if print "
\n\n"; print "\n"; print "\n";