#!/usr/bin/perl #----------------------------------------------------------------------------------------------------------------- # Copyright (c) 1998, 1999, 2000, Felipe Oliveira for Almedia Creative, All Rights Reserved. # Unauthorized copy or distribution of this program will be prosecuted by law to its # fullest extent. Therefore don't even think about it. #----------------------------------------------------------------------------------------------------------------- require ("readparse.txt"); require ("variables.txt"); #require ("file_code.txt"); #require ("up_promotions.txt"); #require ("up_ship_threshold.txt"); #require ("file_ship_categories.txt"); require ("ship_calc.txt"); require ("checkout1.txt"); require ("checkout2.txt"); require ("checkout3.txt"); require ("printable.txt"); require ("sys_error.txt"); #require ("shiptable.txt"); #require ("custshiptable.txt"); require ("printbottom.txt"); require ("printbottomdealers.txt"); require ("dealers.txt"); require ("states.txt"); require ("unavailable.txt"); &htmlcontext; &ReadParse(*input); #print " 4
"; #print "$SYSTEMROOT
"; #print "$CGIDIR$PROGRAMNAME
"; #exit; #--------------------------------------------------------------- # MAIN ROUTINE #--------------------------------------------------------------- { #print "$SYSTEMROOT
"; #print "$CGIDIR$PROGRAMNAME
"; #exit; ($DISC_CODE_ENABLER, $DISC_CODE, $DISC_RATE, $DISC_NAME, $ICON_ON, $SALE_ON, $FREESHIP, $DISC_TEXT, $DISC_THRESH) = @PROMO; #------------ CHECK FOR ID if (($input{id}) eq "" or ($input{id} eq "xidx")) { $a = $$; $b = time(); $id = $b . "-" . $ENV{'REMOTE_ADDR'} . "-" . $a; # $tempid = $b . $ENV{'REMOTE_ADDR'} . $a; # @tempid = split(/\./, $tempid); # $id = join ( '', @tempid); $scart = "$SHOPPERS" . "$id"; # open (SHOP, ">$scart") || print " (1)"; # print SHOP ""; # close SHOP; } else { $id = $input{id}; $scart = "$SHOPPERS" . "$id"; } #$SCART_SECURE = "$SYSTEMROOT" . "$SERVERUSER" . $CGIDIR . "/shoppers/" . $id; $SCART_SECURE = "$SHOPPERS" . "$id"; #------------ SHIPPING TABLE if ($input{stt} eq "dealers") { &dealers; exit; } #------------ SHIPPING TABLE if ($input{stt} eq "shiptable") { &shiptable; exit; } if ($input{stt} eq "custshiptable") { &custshiptable; &printbottom; exit; } #------------ CHECKOUT 1 if ($input{stt} eq "checkout") { open (SHOP, "<$SCART_SECURE") || print " (2)"; while () { chop; $c = $_; } close SHOP; if ($c eq "") { $error_message[0] = "You need to add items to your shopping cart before you checkout."; &sys_error; exit; } &checkout_1; exit; } #------------ CHECKOUT 2 if (($input{stt} eq "checkout_2")) { &check_input1; if ($input{fax} eq "Y") { &printable; exit; } #print "IN DEVELOPMENT"; exit; &checkout_2; exit; } #------------ CHECKOUT 3 if (($input{stt} eq "checkout_3")) { &check_input2; &checkout_3; exit; } #------------ CHECKOUT 4 if (($input{stt} eq "checkout_4")) { &finish_order; exit; } #------------ DISPLAY STATIC PAGE if (($input{stt} eq "stp")) { #print "STT: $input{stt}"; &stp; } #------------ DISPLAY SHOPPING CART if (($input{stt} eq "add_cart") || ($input{stt} eq "change_cart") || ($input{stt} eq "view_cart")) { &clear; &cart; } #------------ DELETE SINGLE ITEM FROM CART if($input{stt} eq "delete") { &delete_item($input{sku}); } #------------ NEW SEARCH if ($input{stt} eq "search") { &search; } #------------ FOUND if ($input{stt} eq "found") { &readproduct; } #------------ CONTACT if ($input{stt} eq "contact") { &email_check($input{email}); &contact; $input{pgn} = "thankyou_contact.html"; &stp; exit; } #------------ UPDATE if ($input{stt} eq "update") { $message = $input{message}; $message =~ s/\n/ /g; $message =~ s/\r/ /g; $message =~ s/ / /g; &update($message); $input{pgn} = "thankyou_update.html"; &stp; exit; } } #######------------ END OF MAIN ROUTINE # ---------------------------- sub htmlcontext # ---------------------------- { print "Content-type: text/html\n\n"; } # ---------------------------- sub readproduct # ---------------------------- { $available = "NO"; open(PRODUCT,"<$DATABASE") || &sys_error("Fatal error opening $DATABASE") ; while () { @record = split(/\*/, $_); if(($input{'sku'} eq "$record[0]") and ($record[12] eq "Y")) { $sku = $record[0]; $name = $record[1]; $author = $record[3]; $publisher = $record[2]; $folio = $record[4]; $description = $record[5]; $type = $record[8]; $image_display = $record[9]; $price = $record[10]; $image= $record[11]; $display = $record[12]; $chinese = $record[13]; $available = "YES"; } last if(($input{'sku'} eq "$record[0]") and ($record[0] eq "Y")); } if ($available eq "NO") { &unavailable; #$input{pgn} = "unavailable.html"; #&stp; #close PRODUCT; #print "BUG 1"; exit; } $input{pgn} = "shop/txt/top.html"; &stp; &piece_alone; &printbottom; close PRODUCT; exit; } # ---------------------------- sub search # ---------------------------- { if ($input{'type'} eq "SUB") { $input{pgn} = "shop/txt/top.html"; &stp; $i = 0; open(PRODUCT,"<$DATABASE") || &sys_error("Fatal error opening $DATABASE") ; while () { @record = split(/\*/, $_); if (($input{'scat'} eq "$record[8]") and ($record[12] eq "Y")) { $sku[$i] = $record[0]; $name[$i] = $record[1]; $author[$i] = $record[3]; $publisher[$i] = $record[2]; $folio[$i] = $record[4]; $description[$i] = $record[5]; $type[$i] = $record[8]; $image_display[$i] = $record[9]; $price[$i] = $record[10]; $image[$i] = $record[11]; $display[$i] = $record[12]; $chinese[$i] = $record[13]; $i++; } } #--- PRINT THUMBNAILS &thumbnails($i,$input{'scat'}); &printbottom; close PRODUCT; exit; } else { $input{pgn} = "shop/txt/top.html"; &stp; $i = 0; $hit_search = 0; $input_lower = lc("$input{'keyword'}"); open(PRODUCT,"<$DATABASE") || &sys_error("Fatal error opening $DATABASE") ; while () { @record = split(/\*/, $_); $lower_1 = lc("$record[1]"); $lower_2 = lc("$record[2]"); $lower_3 = lc("$record[3]"); $lower_5 = lc("$record[5]"); $lower_8 = lc("$record[8]"); if (($lower_1 =~ "$input_lower") or ($lower_2 =~ "$input_lower") or ($lower_3 =~ "$input_lower") or ($lower_5 =~ "$input_lower") or ($lower_8 =~ "$input_lower")) { if ($record[12] eq "Y") { $hit_search = 1; $sku[$i] = $record[0]; $name[$i] = $record[1]; $author[$i] = $record[3]; $publisher[$i] = $record[2]; $folio[$i] = $record[4]; $description[$i] = $record[5]; $type[$i] = $record[8]; $image_display[$i] = $record[9]; $price[$i] = $record[10]; $image[$i] = $record[11]; $display[$i] = $record[12]; $chinese[$i] = $record[13]; $i++; } } } if ($hit_search == 0) { &noitemsfound; exit; } #--- PRINT THUMBNAILS &thumbnails($i,$input{'scat'}); &printbottom; close PRODUCT; exit; } } ### ------------------------ sub piece_alone ### ------------------------ { $disp_price = sprintf("%.2f", $price); $china_image = $image; $china_image =~ s/.jpeg/.gif/g; if ($input{scat} eq "fchinese") { $name_tr = " "; } else { $name_tr = ""; } if ($image_display eq "Y") { $image_html = "Image"; } else { $image_html = ""; } $name_html = "" . $name . ""; print < TOP } ### ------------------------ sub thumbnails ### ------------------------ { $pa=0; ($tot,$subcat)=@_; $go=0; $pages = ($tot/$TOTALITEMS); if ($pages == int($pages)) { $disp_pages = $pages; } else { $disp_pages = int($pages) + 1; } if ($disp_pages > 1) { $pp = "pages"; } else { $pp = "page"; } if ($tot > 1) { $tt = "Click the numbers to see more pages."; $cc = "There are"; $bb = " for you to choose from."; $TYPE = "$MATRIX{$subcat}"; } else { $tt = ""; $cc = "There is"; $bb = "."; $TYPE = "$MATRIX{$subcat}"; } if ($input{'type'} eq "KEY") { $tipo="KEY"; $TYPE = "Search Results for \"$input{'keyword'}\""; } else { $tipo="SUB"; } if ($input{'display'} ne "") { $ispage = ($input{'display'} / $TOTALITEMS); } else { $ispage = 1; } ####----PREPARING E-MAIL PAGE VARIABLES if ($disp_pages > 1) { $t = 0; for ($m=1 ; $m<=$disp_pages; $m++) { if ($ispage == $m) { $display = $m; last; } } } print <
Type in a keyword of phrase

Classical Chinese Furniture
Cart Contents
Classical Chinese Furniture
Customer Service




SPACE if ($input{cart} eq "YES") { $stt = "view_cart"; } else { $stt = "search"; } if ($input{source} eq "out") { $back_html = ""; } else { $back_html = "Go<\/a>"; } print < $name_tr
$image_html $name_html
$author

$folio

$description
$dollar$disp_price

Add to Cart

$back_html
INFO print <
TOP } # ---------------------------- sub cart # ---------------------------- { open (SHOP, "<$scart") || print ""; while () { chop; $c = $_; } close SHOP; if ($input{'stt'} eq "add_cart") ###-------------ADD TO CART { open(PRODUCT,"<$DATABASE") || &sys_error("Fatal error opening $DATABASE") ; while () { @record = split(/\*/, $_); if ($input{'sku'} eq "$record[0]") { $sku = $record[0]; $name = $record[1]; $author = $record[3]; $publisher = $record[2]; $folio = $record[4]; $description = $record[5]; $type = $record[8]; $price = $record[10]; $image= $record[11]; $display = $record[12]; $chinese = $record[13]; } last if($input{'sku'} eq "$record[0]"); } close PRODUCT; $qty = "$input{'qty'}"; $ext_price = ($qty* $price); if ($c eq "") ###-------------CART HAS NOTHING IN IT { &append_cart($qty, $sku, $name, $author, $price); } else ###-------------CART HAS STUFF IN IT { open (SHOP,"<$scart"); while () { @line = split(/\|/, $_); if (($input{'sku'} eq "$line[1]")) ###------TEST IF ITEM IS ALREADY IN CART { $hit = 1; ###-------------MEANS ITEM IS ALREADY IN CART } } close SHOP; if ($hit ne "1") { &append_cart($qty, $sku, $name, $author, $price); ###-------------ITEM NOT IN CART, SO APPEND IT } } } ###-------------END OF ADD TO CART ###-------------CHANGE CART if ($input{'stt'} eq "change_cart") { $N = $input{'N'}; $hit2 = 0; foreach $k (1 .. $N) { $p_qty = "qty". "$k"; $p_sku = "sku". "$k"; $p_name = "name". "$k"; $p_author = "author". "$k"; $p_price = "price". "$k"; if ($input{$p_qty} ne "0") { $qty[$k] = $input{$p_qty}; $sku[$k] = $input{$p_sku}; $name[$k] = $input{$p_name}; $author[$k] = $input{$p_author}; $price[$k] = $input{$p_price}; $cart_line[$hit2 + 1] = join ( '|', $qty[$k], $sku[$k], $name[$k], $author[$k], $price[$k]); $hit2++; } ###-----------END IF $input{$p_qty} ne 0 } ###-----------END FOREACH if ($hit2 == 0) { $emp = "1"; } open (SHOP, ">$scart"); ###-----------WRITE CHANGES TO SHOPPER FILE foreach $x (1 .. $hit2) { print SHOP "$cart_line[$x]\n"; } close SHOP; } ###------------- END OF IF stt eq change ###------------- VIEW CART ###------------- CALCULATE ORDER TOTAL, PRINT CART LINES, PRINT EMPTY CART if (($input{'stt'} eq "view_cart" and $c eq "") || ($emp eq "1")) { $input{pgn} = "shop/txt/top.html"; &stp; &print_cart_empty; &printbottom; exit; } &print_top_cart; #print "BUG 2 $qty, $sku, $name, $author, $price"; open (SHOP, "<$scart") || print "DIDN'T OPEN: $SHOPPERS$id"; while () { chop; ($qty, $sku, $name, $author, $price) = split(/\|/, $_); $ext_price = ($qty * $price); $subtotal += $ext_price; $pieces += $qty; #print "BUG 3 $qty, $sku, $name, $author, $price"; exit; &print_cart_line($qty, $sku, $name, $author, $price, $ext_price); } close SHOP; #print "BUG 4$qty, $sku, $name, $author, $price, $ext_price"; exit; ###-------------CALCULATE ORDER SHIPPING, SUBTOTAL AND TOTAL INCLUDING SHIPPING $N = $count_hidden; &print_bottom_cart($subtotal, $pieces); } # ---------------------------- sub delete_item # ---------------------------- { ($sku_to_delete) = @_; #print "HERE 1
"; #print "$sku_to_delete"; #exit; &print_top_cart; ###------------- DELETE SINGLE ITEM $hit = 0; open (SHOP, "<$scart") || print "DIDN'T OPEN: $SHOPPERS$id"; while () { chop; ($qty, $sku, $name, $author, $price) = split(/\|/, $_); if ($sku ne $sku_to_delete) { #print "$sku --- $sku_to_delete
"; $ext_price = ($qty * $price); $subtotal += $ext_price; $pieces += $qty; #print "BUG 3 $qty, $sku, $name, $author, $price
"; exit; &print_cart_line($qty, $sku, $name, $author, $price, $ext_price); $cart_line[$hit + 1] = join ( '|', $qty, $sku, $name, $author, $price); $hit++; } } close SHOP; ###-----------WRITE CHANGES TO SHOPPER FILE open (SHOP, ">$scart"); foreach $x (1 .. $hit) { print SHOP "$cart_line[$x]\n"; #print "$cart_line[$x]
"; } close SHOP; #print "BUG 4$qty, $sku, $name, $author, $price, $ext_price"; exit; ###-------------CALCULATE ORDER SHIPPING, SUBTOTAL AND TOTAL INCLUDING SHIPPING $N = $count_hidden; &print_bottom_cart($subtotal, $pieces); } # ---------------------------- sub append_cart # ---------------------------- { ($qty, $sku, $name, $author, $price) = @_; open (SHOP,">>$scart"); print SHOP "$qty|$sku|$name|$author|$price|\n"; close SHOP; } # ---------------------------- sub print_top_cart # ---------------------------- { $input{pgn} = "shop/txt/top.html"; &stp; print <
Type in a keyword of phrase

Classical Chinese Furniture
Cart Contents
Classical Chinese Furniture
Customer Service



TOP print <
$TYPE
$tot items in $disp_pages $pp.

TOP if ($disp_pages > 1) { $t = 0; for ($m=1 ; $m<=$disp_pages; $m++) { $t = ($t + $TOTALITEMS); if ($m != 1) { print " . "; if ($ispage == $m) { print "$m"; } else { print "$m"; } } else { if ($ispage == $m) { print "$m"; } else { print "$m"; } } } } print <
TOP if ($input{'display'} eq "") { $go = $TOTALITEMS; } else { $go=$input{'display'}; } #$i = --$go; #if ($L > 0) # { ####------------------------- THREE LAYOUT OPTIONS FOR DIFFERENT SIZES OF PICTURES print <
SPACE $k = 0; $L = 0; for($i=$go-$TOTALITEMS ; $i<$go; $i++) { $disp_price[$i] = sprintf("%.2f", $price[$i]); if ($name[$i] ne "") { if ($input{'type'} eq "KEY") { $catsearch = "
Category: $MATRIX{$type[$i]}"; } if ($image_display[$i] eq "Y") { $image_html = "Image"; } else { $image_html = ""; } print <
$image_html $name[$i] $catsearch
Author/Publisher: $author[$i]
Price: $dollar$disp_price[$i]
View Details Add to Cart

INFO } } # } ####------------------------- BOTTOM NUMBER LINKS print <
TOP if ($disp_pages > 1) { $t = 0; for ($m=1 ; $m<=$disp_pages; $m++) { $t = ($t + $TOTALITEMS); if ($m != 1) { print " . "; if ($ispage == $m) { print "$m"; } else { print "$m"; } } else { if ($ispage == $m) { print "$m"; } else { print "$m"; } } } } print <
BOTTOMCART2 &printbottom; } # ---------------------------- sub stp # ---------------------------- { $shipping = sprintf("%.2f", $input{'shipping'}); if ($input{'stt'} eq "checkout_4") { open(ORDERNUM,"<$order_number_path") || print "55"; while () { @order_number = split(/\*/, $_); $order_number = $order_number[0]; } close ORDERNUM; } if ($input{'pgn'} eq "email.html") { open(FRIENDMESS2,"<$mess_friend_default") || print "55"; while () { $friend_mess_default .= "$_"; } close FRIENDMESS2; } if ($input{pgn} eq "email.html") { if ($input{ss} ne "") { $back_link = "/$CGIPROGRAM?stt=stp&pgn=$input{ss}&id=$id"; } else { $back_link = "/$CGIPROGRAM?stt=search&scat=$input{scat}&display=$input{display}&type=SUB&id=$id"; } } $ship = sprintf("%.2f", ($ship_base + $ship_incr)); $ship_incr = sprintf("%.2f", $ship_incr); $ship_secday = sprintf("%.2f", $ship_base + $ship_secday); $ship_stand = sprintf("%.2f", $ship_stand); $ship_prio = sprintf("%.2f", $ship_prio); $int_ship_base = sprintf("%.2f", $int_ship_base); $int_ship_incr = sprintf("%.2f", $int_ship_incr); $int_ship_prio = sprintf("%.2f", $int_ship_prio); open(PAGE,"<$SYSTEMROOT$input{'pgn'}") || print "77"; $x = 0; while () { $temp = $_ ; $temp =~ s/xidx/$id/g; $temp =~ s/xshippingx/$shipping/g; $temp =~ s/xint_shippingx/$int_shipping/g; $temp =~ s/xscatx/$input{scat}/g; $temp =~ s/xdisplayx/$input{display}/g; $temp =~ s/xbacklinkx/$back_link/g; $temp =~ s/xdollarx/$dollar/g; $temp =~ s/xssx/$input{ss}/g; $record[$x] = $temp; $x++; } close PAGE; print "@record"; } # ---------------------------- sub check_input1 # ---------------------------- { $m = 0; if(($input{'shipping'} =~ "can") and ($input{'state'} ne "Select Your State")) { $error_message[$m] = "If this is a USA order please select a USA shipping option. If this is a Canada order please DO NOT SELECT a USA state."; $canintbug = "Y"; $m++; } if(($input{'shipping'} =~ "int") and ($input{'state'} ne "Select Your State")) { $error_message[$m] = "If this is a USA order please select a USA shipping option. If this is an International order please DO NOT SELECT a USA state."; $canintbug = "Y"; $m++; } if($input{'shipping'} eq "") { $error_message[$m] = "You must select a shipping option."; $m++; } if($input{'name'} eq "") { $error_message[$m] = "You must enter a name."; $m++; } if(($input{'email'} eq "") or ($input{'email'} !~ /\@/) or ($input{'email'} !~ /\./)) { $error_message[$m] = "You must enter a valid e-mail address."; $m++; } if($input{'phone'} eq "") { $error_message[$m] = "You must enter a telephone number."; $m++; } if ($input{'address'} eq "") { $error_message[$m] = "You must enter a shipping address."; $m++; } if ($input{'city'} eq "") { $error_message[$m] = "You must enter a city for the shipping address."; $m++; } if(($input{'state'} eq "Select Your State") and ($input{'int_state'} eq "") and ($input{'country'} eq "")) { $error_message[$m] = "You must enter a state and/or country for your order."; $m++; } if(($input{'state'} ne "Select Your State") and ($input{'zip'} eq "")) { $error_message[$m] = "You must enter a ZIP CODE for your shipping address."; $m++; } if(($input{'int_state'} ne "") and ($input{'country'} eq "")) { $error_message[$m] = "You must enter a country for your order."; $m++; } if ($m > 0) { &checkout_1($m, @error_message); exit; } } # ---------------------------- sub check_input2 # ---------------------------- { $m = 0; $cc=$input{ccard}; $date_split[0] = "$input{ccexpiry_month}"; $date_split[1] = "$input{ccexpiry_year}"; if ($input{'SAME_ADDRESS'} eq "YES") { $b_address = "$input{'address'}"; $b_address_2 = "$input{'address_2'}"; $b_city = "$input{'city'}"; $b_state = "$input{'state'}"; $b_int_state = "$input{'int_state'}"; $b_zip = "$input{'zip'}"; $b_country = "$input{'country'}"; } else { $b_address = "$input{'b_address'}"; $b_address_2 = "$input{'b_address_2'}"; $b_city = "$input{'b_city'}"; $b_state = "$input{'b_state'}"; $b_int_state = "$input{'b_int_state'}"; $b_zip = "$input{'b_zip'}"; $b_country = "$input{'b_country'}"; } if ($input{'cctype'} eq "Select Card Type") { $error_message[$m] = "You must select a credit card type."; $m++; } if (length($cc)<2) { $error_message[$m] = "You must enter a credit card number."; $m++; } if ($input{'ccname'} eq "") { $error_message[$m] = "You must enter the name on the credit card."; $m++; } if ( $input{'ccexpiry_month'} eq "Month") { $error_message[$m] = "You must select a credit card expiry month."; $m++; } if ( $input{'ccexpiry_year'} eq "Year") { $error_message[$m] = "You must select a credit card expiry year."; $m++; } if(($input{'int_state'} ne "") and ($input{'country'} eq "")) { $error_message[$m] = "You must enter a country for your order."; $m++; } if ($b_address eq "") { $error_message[$m] = "You must enter a billing address."; $m++; } if ($b_city eq "") { $error_message[$m] = "You must enter a city for the billing address."; $m++; } if (($b_state ne "Select Your State") and ($b_zip eq "")) { $error_message[$m] = "You must enter a ZIP CODE for your billing address."; $m++; } if (($b_state ne "Select Your State") and ($b_country eq "")) { $error_message[$m] = "You must enter a Country for your billing address."; $m++; } if ($ccc eq "1") { if (length($cc)<2) { # $error_message[$m] = "Credit Card field must be filled out.

"; # $m++; } else { $error = 0; $cc =~ s/\D//g; $length = length($cc); if (($length < 13) || ($length > 16)) { $error = 1; } $first = substr($cc, 0, 1); $card_type = "none"; if ($first == 5) { $card_type = "MasterCard"; if ($length != 16) { $error = 1; } } if ($first == 4) { $card_type = "Visa"; if (($length != 16) && ($length != 13)) { $error = 1; } } if ($first == 3) { $card_type = "American Express"; if ($length != 15) { $error = 1; } } if ($first == 6) { $card_type = "Discover"; if ($length != 16) { $error = 1; } } if ($card_type eq "none") { $error = 1; } if (!($error)) { $z = 2; $sum = 0; for ($i = $length - 2; $i>=0; $i--) { $cdigit = substr($cc, $i, 1); $prod = $z * $cdigit; $ones= chop($prod); $sum += $ones + $prod; $z = $z % 2 + 1; } if (!(substr($cc, $length - 1, 1) == (10 - ($sum % 10)) % 10)) { $error = 1; } } if ($error == 1) { $error_message[$m] = "The Credit Card Number you entered: $input{ccard} is invalid."; $m++; } } @current_time = localtime(time()); $month = $current_time[4]+1; $year = $current_time[5]; if ($year < 171) { if ($year < 50) { $year += 2000; } else { $year += 1900; } } @date_split =($input{ccexpiry_month}, $input{ccexpiry_month}); if ($date_split[1] < 171) { if ($date_split[1] < 50) { $date_split[1] += 2000; } else { $date_split[1] += 1900; } } # if (($input{ccexpiry_month} eq "Month") or ($input{ccexpiry_year} eq "Year")) # { # $error_message[$m] = "You must enter a valid expiration date for your credit card."; # $m++; # } # elsif (length($date_split[1]) != 4) # { # $error_message[$m] = "The date $input{ccexpiry}, you entered for your credit card expiration date is invalid. It must be in the format: MM/YY."; # $m++; # } # els if (($year > $date_split[1])||(($year == $date_split[1])&&($month > $date_split[0]))) { $error_message[$m] = "You must enter a valid expiration date for your credit card. Date entered has expired.
\n"; $m++; } } ####------------ END IF CCC=1 if ($m > 0) { &checkout_2($m, @error_message); exit; } } # ---------------------------- sub finish_order # ---------------------------- { open(ORDERMESS,"<$mess_ord_top") || print "(7)"; while () { $order_mess_top .= "$_"; } close ORDERMESS; $info_buffer .= "\n"; $info_buffer .= "SHIPPING INFORMATION\n"; $info_buffer .= "----------------------------------------\n"; $info_buffer .= "Name: $input{'name'}\n"; $info_buffer .= "E-mail: $input{'email'}\n"; $info_buffer .= "Phone: $input{'phone'}\n"; $info_buffer .= "Address: $input{'address'}\n"; if ($input{'address_2'} ne "") { $info_buffer .= " $input{'address_2'}\n"; } $info_buffer .= "City: $input{'city'}\n"; $info_buffer .= "State: $input{'state'}\n"; if ($input{'int_state'} ne "") { $info_buffer .= "International State: $input{'int_state'}\n"; } $info_buffer .= "Zip Code: $input{'zip'}\n"; $info_buffer .= "Country: $input{'country'}\n"; $info_buffer .= "Phone: $input{'phone'}\n\n"; if ($input{'instructions'} ne "") { $instructions = $input{instructions}; $instructions =~ s/\n/ /g; $instructions =~ s/\r/ /g; $instructions =~ s/ / /g; $info_buffer .= "SPECIAL INSTRUCTIONS\n"; $info_buffer .= "----------------------------------------\n"; $info_buffer .= "$instructions\n\n"; } #$info_buffer .= "Discount Code: $input{'discount_code'}\n"; $order_buffer .= "YOUR ORDER:\n"; $order_buffer .= "----------------------------------------\n"; $ccexp = "$input{'ccexpiry_month'}" . "/" . "$input{'ccexpiry_year'}"; $ORDER_LINE .= "$order_number" . "::" . "$input{'name'}" . "::" . "$input{'email'}" . "::" . "$input{'phone'}" . "::" . "$input{'address'}" . "::"; $ORDER_LINE .= "$input{'address_2'}" . "::" . "$input{'city'}" . "::" . "$input{'state'}" . "::" . "$input{'int_state'}" . "::" . "$input{'zip'}" . "::" . "$input{'country'}" . "::"; $ORDER_LINE .= "$input{'b_address'}" . "::" . "$input{'b_address_2'}" . "::" . "$input{'b_city'}" . "::"; $ORDER_LINE .= "$input{'b_state'}" . "::" . "$input{'b_int_state'}" . "::" . "$input{'b_zip'}" . "::" . "$input{'b_country'}" . "::"; $ORDER_LINE .= "$input{'cctype'}" . "::" . "$input{'ccard'}" . "::" . "$ccexp" . "::" . "$input{'ccname'}" . "::" . "$input{'find_engine'}" . "::" . "$input{'find_other'}" . "::"; ####--------------RETIEVE CART INFO ($qty, $sku, $name, $author, $price) $k = 0; open (SHOP, "<$SCART_SECURE"); while () { chop; ($qty[$k], $sku[$k], $name[$k], $author[$k], $price[$k]) = split(/\|/, $_); $disp_price[$k] = sprintf("%.2f", $price[$k]); $extended[$k] = ($qty[$k] * $price[$k]); $disp_extended[$k] = sprintf("%.2f", $extended[$k]); $order_buffer .= "$name[$k]\n"; #$order_buffer .= "$sku[$k] ....... $name[$k]\n"; $order_buffer .= "$author[$k]\n"; $order_buffer .= "$qty[$k] " . "x" . " $dollar$disp_price[$k] " . "=" . " $dollar$disp_extended[$k]\n\n"; if ($k == 0) { $ORDER_LINE .= "$qty[$k]" . "|" . "$sku[$k]" . "|" . "$name[$k]" . "|" . "$disp_price[$k]" . "|" . "$disp_extended[$k]"; } else { $ORDER_LINE .= "+" . "$qty[$k]" . "|" . "$sku[$k]" . "|" . "$name[$k]" . "|" . "$disp_price[$k]" . "|" . "$disp_extended[$k]"; } $subtotal += $extended[$k]; $k++; } close SHOP; $ORDER_LINE .= "::" . "$subtotal"; $disp_subtotal= sprintf("%.2f", $subtotal); $disp_subtotal1= sprintf("%.2f", $subtotal); $order_buffer .= "------------------------\n"; $order_buffer .= "Subtotal ....... $dollar$disp_subtotal\n"; #print "$input{'state'}"; exit; #($DISC_CODE_ENABLER, $DISC_CODE, $DISC_RATE, $DISC_NAME, $ICON_ON, $SALE_ON, $FREESHIP, $DISC_THRESH) = @PROMO; @codes = split(/\+/, $DISC_CODE); if ($DISC_CODE_ENABLER eq "Y2") { foreach $m (0 .. $#codes) { if ($codes[$m] eq "$input{'discount_code'}") { $display_disc= sprintf("%.2f", ($subtotal * $DISC_RATE) / 100); $subtotal = ($subtotal - $display_disc); $display_subtotal= sprintf("%.2f", ($subtotal)); $order_buffer .= "$DISC_NAME ....... -$dollar$display_disc\n"; $order_buffer .= "Subtotal ....... $dollar$display_subtotal\n"; } } } elsif (($DISC_CODE_ENABLER eq "Y1") and ($subtotal >= $DISC_THRESH)) { $display_disc= sprintf("%.2f", ($subtotal * $DISC_RATE) / 100); $subtotal = ($subtotal - $display_disc); $display_subtotal= sprintf("%.2f", ($subtotal)); $order_buffer .= "Discount ....... $dollar$display_disc\n"; $order_buffer .= "Subtotal ....... $dollar$display_subtotal\n"; } $ORDER_LINE .= "::" . "$DISC_RATE" . "::" . "$display_disc" . "::" . "$subtotal"; if ($input{'state'} eq "$taxable_state") { $tax = (($subtotal * $state_tax_rate) / 100); $disp_tax = sprintf("%.2f", $tax); $order_buffer .= "$taxable_state Tax ......... $dollar$disp_tax\n"; } $ORDER_LINE .= "::" . "$disp_tax"; ($method, $shipping) = split(/\+/, $input{'shipping'}); if (($FREESHIP eq "Y") and ($method eq "a")) { $shipping = 0; } $display_shipping= sprintf("%.2f", $shipping); #($display_method,) = split(/\++/, $SHOPTION{$method}); $display_method = "$SHOPTION{$method}"; $order_buffer .= "Shipping ....... $dollar$display_shipping\n"; $order_buffer .= "$display_method \n"; $ORDER_LINE .= "::" . "$display_shipping" . "::" . "$display_method"; $total = ($subtotal + $tax + $shipping); $disp_total = sprintf("%.2f", $total); #print "$total $disp_total"; exit; $order_buffer .= "------------------------\n"; $order_buffer .= "Total .......... $dollar$disp_total \n \n"; $ORDER_LINE .= "::" . "$disp_total"; #$ORDER_LINE .= "::" . "$input{'discount_code'}"; #####---------------WRITE ORDER &write_order; #####---------------BEGIN KEDISI MAILING STUFF #$admin = 'fo@amcreative.com'; $mail="$mailprogram $admin"; open(MAIL, "| $mail") || &sys_error("Can't open pipe to sendmail."); $header_buffer = ''; print MAIL "To: $admin\r\n"; print MAIL "From: $admin\r\n"; #print MAIL "Reply-To: \"$admin\" <$admin>\n" ; #print MAIL "X-Mailer: Curtis Evarts\r\n"; #print MAIL "Mime-Version: 1.0\r\n"; #print MAIL "Content-Type: text/plain\r\n"; #$header_buffer .= "Subject: Website order placed. Order# CS$order_number\r\n\r\n"; print MAIL "Subject: Website order placed.\n\n" ; #print MAIL "$header_buffer"; print MAIL "Order awaiting retrieval at http://www.chinese-furniture.com/ccor/\r\n"; print MAIL "$order_mess_top"; print MAIL "$info_buffer"; print MAIL "$order_buffer"; #print MAIL "$order_mess_bot"; print MAIL "\r\n$input{'find_engine'}"; print MAIL "\n$input{'find_other'}"; close (MAIL) || &sys_error("Error closing pipe to sendmail - 1."); #####---------------BEGIN PARAGONMAILING STUFF #$paragon = 'fo@amcreative.com'; $mail="$mailprogram $paragon"; open(MAIL, "| $mail") || &sys_error("Can't open pipe to sendmail."); #$header_buffer = ''; print MAIL "To: $paragon\r\n"; print MAIL "From: $admin\r\n"; #print MAIL "X-Mailer: Curtis Evarts\r\n"; #print MAIL "Mime-Version: 1.0\r\n"; #print MAIL "Content-Type: text/plain\r\n"; #$header_buffer .= "Subject: Website order placed. Order# CS$order_number\r\n\r\n"; print MAIL "Subject: Website order placed.\n\n"; #print MAIL "$header_buffer"; print MAIL "Order awaiting retrieval at http://www.chinese-furniture.com/ccor/\r\n"; print MAIL "$order_mess_top"; print MAIL "$info_buffer"; print MAIL "$order_buffer"; #print MAIL "$order_mess_bot"; print MAIL "\r\n$input{'find_engine'}"; print MAIL "\n$input{'find_other'}"; close (MAIL) || &sys_error("Error closing pipe to sendmail - 2."); #####---------------BEGIN CUSTOMER STUFF $mail="$mailprogram $input{email}"; open(MAIL, "| $mail") || &sys_error("Can't open pipe to sendmail."); #$header_buffer = ''; print MAIL "To: $input{email}\r\n"; print MAIL "From: $admin\r\n"; #$header_buffer .= "X-Mailer: Classical Chinese Furniture\r\n"; #$headerbuffer .= _"Mime-Version: 1.0\r\n"; #$header_buffer .= "Content-Type: text/plain; charset=$char_set\r\n"; #$header_buffer .= "Subject: Your Classical Chinese Furniture Order# CS$order_number\r\n\r\n"; print MAIL "Subject: Your Classical Chinese Furniture Order\n\n"; #print MAIL "$header_buffer"; print MAIL "$order_mess_top"; print MAIL "$info_buffer"; print MAIL "$order_buffer"; print MAIL "$order_mess_bot"; close (MAIL) || &sys_error("Error closing pipe to sendmail."); ######------------------EMPTY CART unlink ("$SCART_SECURE"); ######------------------THANK YOU VERY MUCH IT WAS A PLEASURE open(PAGE,") { $temp = $_ ; $temp =~ s/xidx/$id/g; # $temp =~ s/xordx/$order_number/g; $record[$x] = $temp; $x++; } close PAGE; print "@record"; $order_number++; exit; ######------------------WRITE ORDER LINE TO FILE open(ORDERLINE,">>$ORDERLINEPATH") || print " (77)"; print ORDERLINE "$ORDER_LINE\n"; close ORDERLINE; &clear; #exit; } # ---------------------------- sub clear # ---------------------------- { $cur_time = time(); if (!(opendir(LISTDIR, "$SHOPPERS_SECURE"))) { &htmlcontext; print("Error: unable to open directory: $SHOPPERS_SECURE"); exit; } while ($filename = readdir(LISTDIR)) { if (($filename ne ".") or ($filename ne "..")) { @total = split (/\-/, $filename); $seconds = $total[0]; $killit = ($cur_time - $time_range); if ($killit > $seconds) { # print "HERE
"; unlink("$SHOPPERS_SECURE$filename"); } } } closedir(LISTDIR); #print "Current time: $cur_time
"; #print "Range: $time_range
"; #print "Seconds: $seconds
"; } # ---------------------------- sub write_order # ---------------------------- { $EMAIL = "Email Address:"; format WORDER = ************************** NEW ORDER ************************** ORDER DATE: @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< `date` Name: @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $input{'name'} Email Address: @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $input{'email'} Telephone: @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $input{'phone'} SHIPPING INFORMATION Address: @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $input{'address'} @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $input{'address_2'} City: @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $input{'city'} State: @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $input{'state'} International State: @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $input{'int_state'} Zip: @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $input{'zip'} Country: @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $input{'country'} BILLING INFORMATION Address: @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $input{'b_address'} @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $input{'b_address_2'} City: @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $input{'b_city'} State: @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $input{'b_state'} International State: @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $input{'b_int_state'} Zip: @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $input{'b_zip'} Country: @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $input{'b_country'} Card Type: @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $input{'cctype'} Card Number: @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $input{'ccard'} Expiration Date: @<<<<<<<<< $ccexp Name on Card: @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $input{'ccname'} . format SKU = ORDER INFORMATION -------------------------------------------------------------- . format ORDLINE = @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $name[$x] @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $author[$x] @<<< x @@>>>>>> = @@>>>>>>> $qty[$x] $dollar$disp_price[$x] $dollar$disp_extended[$x] . $nothing = " "; $space = "---------"; $Total = "Total"; $Tax = "Tax"; $Shipping = "Shipping"; $Subtotal = "Subtotal"; $Discount = "$DISC_NAME" . " -"; format ORDTOTAL = @>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> @>>>>>>>> $nothing $space @>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> @@>>>>>>> $Subtotal $dollar$disp_subtotal1 @>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> @@>>>>>>> $Tax $dollar$disp_tax @>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> @@>>>>>>> $display_method $dollar$display_shipping @>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> @>>>>>>>> $nothing $space @>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> @@>>>>>>> $Total $dollar$disp_total . open(FEEDPAGE,"<$FEEDPAGEFILE") || print "88"; while () { $feedpage = $_; } close FEEDPAGE; open(WORDER,">>$ORDERS") || print "BUG 99: $ORDERS"; if ($feedpage ne "0") { print WORDER "\f"; } write WORDER; if ($input{'instructions'} ne "") { $sinfo.= "Special Instructions:\n"; (@instr)=split(/\++/,$input{'instructions'}); foreach $a(0 .. $#instr) { $sinfo.= "$instr[$a]"; } print WORDER "$sinfo"; print WORDER "\n"; } close WORDER; open(SKU,">>$ORDERS") || print "10"; write SKU; close SKU; open(ORDLINE,">>$ORDERS"); foreach $x (0 .. ($k - 1)) { #print "$k"; write ORDLINE; } close ORDLINE; open(ORDTOTAL,">>$ORDERS") || print "11"; write ORDTOTAL; close ORDTOTAL; if ($feedpage eq "0") { open(FEEDPAGE,">$FEEDPAGEFILE"); print FEEDPAGE "1"; close FEEDPAGE; } } # ---------------------------- sub email_check # ---------------------------- { ($email_address) = @_; #print "BUG $email_address"; exit; if (($email_address !~ "\@") or ($email_address !~ "\.")) { # print "BUG2 $email_address"; exit; &sys_error("The e-mail address you've entered is invalid."); # &printbottom; exit; } } # ---------------------------- sub update # ---------------------------- { ($message) = @_; $mail="$mailprogram $admin"; open(MAIL, "| $mail") || &sys_error("Can't open pipe to sendmail."); $header_buffer = ''; $header_buffer .= "To: $admin\r\n"; $header_buffer .= "X-Mailer: Classical Chinese Furniture\r\n"; $header_buffer .= "Mime-Version: 1.0\r\n"; $header_buffer .= "Content-Type: text/plain\r\n"; $header_buffer .= "From: $admin\r\n"; $header_buffer .= "Subject: CCF Site Update\r\n\r\n"; print MAIL "$header_buffer"; print MAIL "$message\n\n"; close (MAIL) || &sys_error("Error closing pipe to sendmail."); } # ---------------------------- sub contact # ---------------------------- { $message = $input{message}; $message =~ s/\n/ /g; $message =~ s/\r/ /g; $message =~ s/ / /g; $mail="$mailprogram $admin"; open(MAIL, "| $mail") || &sys_error("Can't open pipe to sendmail."); $header_buffer = ''; $header_buffer .= "To: $admin\r\n"; $header_buffer .= "X-Mailer: Classical Chinese Furniture\r\n"; $header_buffer .= "Mime-Version: 1.0\r\n"; $header_buffer .= "Content-Type: text/plain\r\n"; $header_buffer .= "From: $input{email}\r\n"; $header_buffer .= "Subject: CCF Site Contact\r\n\r\n"; print MAIL "$header_buffer"; print MAIL "Name: $input{name}\n"; print MAIL "Address: $input{address}\n"; print MAIL "City: $input{city}\n"; print MAIL "State: $input{state}\n"; print MAIL "Zip: $input{zip}\n"; print MAIL "Country: $input{country}\n"; print MAIL "E-mail: $input{email}\n\n"; print MAIL "Message:\n"; print MAIL "$message \n"; close (MAIL) || &sys_error("Error closing pipe to sendmail."); #print "$mail $input{City}"; exit; } # ---------------------------- sub noitemsfound # ---------------------------- { print <

Type in a keyword of phrase

Classical Chinese Furniture
Customer Service



Your Shopping Cart Contents
To change the quantity for the items in this page type in the desired quantity in the prompt and press Update. For more details on any item click on the name link.
TTT } # ---------------------------- sub print_cart_empty # ---------------------------- { print < CARTLINE } # ---------------------------- sub print_cart_line # ---------------------------- { ($qty, $sku, $name, $author, $price, $ext_price) = @_; $count_hidden++; if (($count_hidden / 2) == int($count_hidden / 2)) { $trcolor = "ffffff"; } else { $trcolor = "ffffcc"; } $piece_price = sprintf("%.2f", $price); #$ext_price = ($qty * $price); $piece_ext_price = sprintf("%.2f", $ext_price); print < CARTLINE } # ---------------------------- sub print_bottom_cart # ---------------------------- { ($subtotal, $pieces) = @_; if ($input{'type'} eq "KEY") { $tipo="KEY"; } else { $tipo="SUB"; } if ($FREESHIP eq "Y") { $free = "\\\\SPECIAL: FREE US Mail shipping!\<\/b\> \<\/font\>\\\(Offer valid in the USA only.)\<\/i\>\<\/font\>"; } else { $free = ""; } print <
Quantity
Product Price
Type in a keyword of phrase

Classical Chinese Furniture
Customer Service



Your Shopping Cart Contents

There are no selections in your shopping cart.



$name
Author/Publisher: $author
Unit Price: $dollar$piece_price
$dollar$piece_ext_price
BOTTOMCART1 #($DISC_CODE_ENABLER, $DISC_CODE, $DISC_RATE, $DISC_NAME, $ICON_ON, $SALE_ON, $FREESHIP, $DISC_THRESH) = @PROMO; if (($DISC_CODE_ENABLER eq "Y1") and ($subtotal >= $DISC_THRESH)) { $display_disc= sprintf("%.2f", ($subtotal * $DISC_RATE) / 100); $subtotal = ($subtotal - $display_disc); $td = "\\<\/td\>"; print < DISCOUNT } $disp_subtotal = sprintf("%.2f", $subtotal); print < $td

$free
$DISC_NAME -$dollar$display_disc

Subtotal $dollar$disp_subtotal

To continue shopping choose from the drop down menu at the top of the page.
Type in a keyword of phrase

Classical Chinese Furniture
Cart Contents
Classical Chinese Furniture
Customer Service



Search Results

No items were found matching your criteria: $input{keyword}. Please try again or use the drop down menu to browse books by category.

CARTLINE }