#!/usr/local/bin/perl # order.pl # ITA online order form # # 2/22/96 Brian Goldman # last modified 2/29/96 # Print out a content-type for HTTP/1.0 Compatibility print "Content-type: text/html\n\n"; print "\n"; # Print a title and initial heading print "
ITA On-Line Ordering - Order Summary\n"; print "

ITA On-Line Ordering

\n"; print "

Order Summary

\n"; print "
\n"; # Get The Input read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); # Split The Name-value Pairs @pairs = split(/&/, $buffer); $ftotal=0; $ototal=0; $gtotal=0; foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); # Un-Webify plus signs and %-encoding $value =~ tr/+/ /; $value =~ s/% ( [a-fA-F0-9] [a-fA-F0-9] ) /pack("C", hex($1))/eg; # Uncomment for debugging purposes print "Setting $name to $value

"; $FORM{$name} = $value; if ($FORM{$name} == 1) {$ftotal = $ftotal + 2;} if ($FORM{$name} == 2) {$ftotal = $ftotal + 4;} if ($FORM{$name} == 3) {$ftotal = $ftotal + 6;} if ($FORM{$name} == 4) {$ftotal = $ftotal + 8;} if ($FORM{$name} == 5) {$ftotal = $ftotal + 10;} if ($FORM{$name} == 6) {$ftotal = $ftotal + 12;} if ($FORM{$name} == 7) {$ftotal = $ftotal + 14;} if ($FORM{$name} == 8) {$ftotal = $ftotal + 16;} if ($FORM{$name} == 9) {$ftotal = $ftotal + 18;} if ($FORM{$name} == 10) {$ftotal = $ftotal + 20;} if ($FORM{$name} == 16) {$ftotal = $ftotal + 32;} } # If the comments are blank, then give a "blank form" response &blank_response unless $FORM{ 'name' } ; &blank_response unless $FORM{ 'address' } ; &blank_response unless $FORM{ 'city' } ; &blank_response unless $FORM{ 'state' } ; &blank_response unless $FORM{ 'zip' } ; # -------------------------------------------------- # Enter Charge Summary Calculations here if ($FORM{'immusa'} eq "immusa") {$ototal = $ototal + 79;} if ($FORM{'saf'} eq "saf") {$ototal = $ototal + 59;} # ------------------------------------------------- # Create Charge Summary Page # Fill hidden fields to preserve data print "

"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; # Print visible data for user to see print "


"; $ftotout = sprintf("%8.2", $ftotal") print "Items ordered:"; print "
"; if ($FORM{'forms'} eq "forms") { print "$ftotal form pages. "; print "/t/t Price: $ftotout
"; } if ($FORM{'immusa'} eq "immusa") { print "Immigration USA Personal Edition.
"; } if ($FORM{'saf'} eq "saf") { print "Scan-A-Form.
"; } $gtotal = $ftotal + $ototal ; if ($gtotal < 10) { $gtotal = 10; } $gtotout = sprintf("%8.2f", $gtotal); print "
"; print "The total cost for the items ordered is $gtotout dollars"; print "
"; print "This total will be charged to your $FORM{'cards'} . Card number $FORM{'cardno'} ."; print "
"; print "
"; print "
"; print "
; print "
"; print "
"; print ""; print ""; exit; # ------------------------------------------------------------- # Subroutine blank_response sub blank_respose { print "You failed to give necessary information.
"; print "Please return to "; print 'ITA On-line Order Form '; exit; }