#! c:\perl\bin\perl ########################################################################### ########################################################################### # Custimization portion - All Options are set in smart.cfg !! ########################################################################### use Encode; use LWP::Simple qw(get); # Measure CPU time usage; $start = (times)[0]; # Unbuffer the output; $| = 1; # Read in user prefs require 'd:\xvrt\asturalba.com\html\smart.cfg'; ############################################################################## # Done. Make no changes below this line, unless you know what you are doing.## ############################################################################## use vars qw($tmpdir $storename %shipping2 %shipping3 $trackurl $useverify $usertime $orderdir $usercurr $trackdb); my($incoming, @pairs, %FORM); $incoming = $ENV{'QUERY_STRING'}; #$incoming = $ENV{'PATH_INFO'}; @pairs = split(/&/, $incoming); #@pairs = split(/\//, $incoming); foreach $pair (@pairs) { my($name, $value) = split(/=/, $pair); # my($name, $value) = split(/\./, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $FORM{$name} = $value; } # Get command variables $command = $FORM{'command'}; $pos = $FORM{'pos'}; $type = $FORM{'type'}; $cmdlinegroup = $FORM{'group'}; # Parse form input &parse_form; # Get the date &get_date; # Get their hostname #if ($usecookie eq '1') { #require 'cookie.lib'; #&get_cookie; #} #else { &get_host; #} # See if they have a cart already, if not, make one &check_file; # See what they want to do. # Add an item to the cart. if ($command eq 'add') { &add_item; } # Change a quantity of an item in the cart, if at zero, delete it elsif ($command eq 'change') { &change_items; } # Show the order form. Get their name, phone number, CC info, etc.. elsif ($command eq 'buy1') { &buy_items1; } # Process the order form info, mail out receipt, and order elsif ($command eq 'buy2') { &buy_items2; } # Show current cart elsif ($command eq 'review') { &review_items; } # List items, based on database call elsif ($command eq 'listitems') { &gen_page; } # Show a databae frontend. elsif ($command eq 'showstore') { &show_store; } # Delete a whole cart elsif ($command eq 'delete') { &delete_cart; } else { &show_store; } # Subroutines: # Generate page, based on database search sub gen_page { my($SIZE,$i); &print_header; # Table header, change this for table options! print "