#!/usr/bin/perl # ^^ The line above needs to point to the Perl intrepreter on your system. # Ask your sys admin for the correct path, or type 'which perl' at the unix # prompt. You need Perl 5 or higher. type 'perl -v' to get your version. ############################################################################ ################## # RediCart v3.9.5 ################## ############################################################################### # THIS SCRIPT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER # EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES # OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. # # THE PROVIDERS OF THIS SOFTWARE ASSUME NO RESPONSIBILITY FOR ANY DAMAGES # SUFFERED AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE. IN NO # EVENT WILL ANY PROVIDERS OF THIS SOFTWARE BE LIABLE FOR ANY LOST REVENUE, PROFIT # OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE # DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, # ARISING OUT OF THE USE OF OR INABILITY TO USE SOFTWARE, EVEN IF THE # PROVIDERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. ############################################################################## ############################################################################ # AUTHOR INFORMATION ############################################################################ # S-Mart Shopping Cart Script v1.9 # Shop smart. Shop S-Mart. # Written by Barry Robison. (brobison@rcinet.com) # This script uses code written by Matt Wright. # Please visit his site at http://worldwidemart.com # Selling the code for this program without prior written consent of the # author(s) is expressly forbidden. Obtain permission before # redistributing this software over the Internet or in any other medium. # In all cases copyright and header must remain intact. # # All customization requests to be sent to brobinson@rcinet.com. ############################################################################ ############################################################################ # MAKE NO CHANGES BELOW THIS LINE. ############################################################################ $ENV{'REMOTE_HOST'} = $ENV{'REMOTE_ADDR'}; # Measure CPU time usage; $start = (times)[0]; # Get rid of NULL; $zero - '0'; require 'smart.cfg'; use vars qw($tmpdir $storename %shipping2 %shipping3 $trackurl $useverify $usertime $orderdir $usercurr $trackdb); my($incoming, @pairs, %FORM); $incoming = $ENV{'QUERY_STRING'}; @pairs = split(/&/, $incoming); foreach $pair (@pairs) { 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_items1; } # 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; } # Calculate shipping elsif ($command eq 'calcship') { &calc_shipping; } elsif ($command eq 'setship') { &set_shipping; } elsif ($command eq 'removetax') { &remove_tax; } elsif ($command eq 'addtax') { &add_tax; } elsif ($command eq 'removetax2') { &remove_tax2; } elsif ($command eq 'addtax2') { &add_tax2; } elsif ($command eq 'retaddr') { &ret_addr; } elsif ($command eq 'calccurr') { &calc_currency; } elsif ($command eq 'setcurr') { &set_currency; } else { &show_store; } # Subroutines: # Generate page, based on database search sub gen_page { my($SIZE,$max,$i,$itemid,$name,$price,$descrip,$image,$weight,$itemurl,$group); &print_header; # Table header, change this for table options! print "