#!/usr/bin/perl #unshift(@INC, '.'); use CGI qw(:cgi-lib :all); $query = new CGI; &ReadParse(*in); use lib '/home/ez-e/ecommerce/modules'; use config; use E::Transaction::AuthorizeNet; $version='2.1'; #BEGIN Web Island Compatability section $in{'product'} = $in{'PRODUCT'} if ($in{'product'} eq ""); $in{'shop'} = $in{'ID'} if ($in{'shop'} eq ""); $in{'image'} = $in{'PRODUCT-LINK'} if ($in{'image'} eq ""); $in{'price'} = $in{'PRICE'} if ($in{'price'} eq ""); $in{'return'} = $in{'NEXTPAGE'} if ($in{'return'} eq ""); $in{'priceoption'} = $in{'SIZE-PRICE'} if ($in{'priceoption'} eq ""); $in{'type'} = "add" unless ($in{'ADD'} eq ""); #END Web Island Compatability section if ($in{'special1'} eq "collecting-supplies") { $in{'product'} = "$in{'company'} / $in{'page'} page / $in{'description'}"; #Used to make special order form for greg } if ($in{'special1'} eq "ebay") { $in{'product'} = "Auction: $in{'auction'} / $in{'description'}"; #Used to make special order form for greg } if ($in{'amount'} eq "") { $in{'amount'} = 1; } $price = $in{'price'}; $in{'shop'} =~ s/"\s"//g; $shop = $in{'shop'}; $prefix = "/home/ez-e/ecommerce"; $cache = "cache"; $configdir = "accounts/$in{'shop'}"; $datadir = "data"; $total = 0; open (MASQ, "$prefix/data/pass.dat"); while () { @masq = split(":"); if (@masq[1] =~ /$in{'shop'}/) { $masquerade = @masq[3]; } } close MASQ; #BEGIN User Identity sub identify { $ip = remote_addr; if ($query->cookie('ID') eq ""){ open (SHOPPERID, "$prefix/data/id"); while () { ($oldid) = split; } close SHOPPERID; open (SHOPPERID, ">$prefix/data/id"); $newid = $oldid + 1; print SHOPPERID "$newid"; close SHOPPERID; $cookie = $query->cookie(-name=>'ID', -value=>"$oldid", -expires=>'+12h', -path=>'/cgi-bin/cart.cgi' -domain=>'ez-e.net'); if ($in{'currency'} ne "") { $cookie2 = $query->cookie(-name=>'currency', -value=>$in{'currency'}, -expires=>'+12h', -path=>'/cgi-bin/cart.cgi' -domain=>'ez-e.net'); } $id = $oldid; if ($in{'currency'} ne "") { print $query->header(-cookie=>[$cookie,$cookie2]); } else { print header(-cookie=>$cookie); } if (-e "$prefix/$cache/ip/$ip") { open (SHOPPERIP, "$prefix/$cache/ip/$ip"); while () { ($id) = split; } close SHOPPERIP; } else { system("touch $prefix/$cache/ip/$ip"); open (SHOPPERIP, ">$prefix/$cache/ip/$ip"); print SHOPPERIP "$id"; close SHOPPERIP; } } else { $id = $query->cookie('ID'); if ($in{'currency'} ne "") { $cookie = cookie(-name=>'currency', -value=>$in{'currency'}, -expires=>'+12h', -path=>'/cgi-bin/cart.cgi' -domain=>'ez-e.net'); print header(-cookie=>$cookie); } else{ print "Content-type: text/html\n\n"; } } } #END User Identity if ($in{'cookie'} eq "") { $in{'cookie'} = $id; } &identify; sub cart{ print '
', "\n"; print ' ', "\n"; print ' ', "\n"; print " \n \n \n \n \n"; open (ID_CACHE, "$prefix/$cache/$id"); $qty_number = 1; while () { @cache = split("\t", $_, 9999); if (@cache[0] =~ /$masquerade/) { @cache[4] =~ tr/\n//d; $product_total = @cache[3] * @cache[2]; if (@cache[4] eq "", @cache[4] eq " ") { print ' ', "\n"; print " ', "\n"; print " \n \n \n \n"; } if (@country[3] eq "S") { printf " %.2f@country[2]\n", @cache[2]; print " \n \n \n"; } } } close COUNTRY; $sub_total = $sub_total + $product_total; $qty_number++; } } close ID_CACHE; } #BEGIN View Cart sub viewcart{ config("$in{'shop'}"); print "\n\n \n EZ-ECart - View Cart\n \n"; print '', "\n"; print "
\n"; unless ($config{'www'} eq ""){ unless ($config{'company'} eq ""){ print '', $config{'company'}, '
', "\n"; } } if ($config{'www'} eq "") { unless ($config{'company'} eq ""){ print '', $config{'company'}, '
', "\n"; } } unless ( $config{'address1'} eq "" ){ print '', $config{'address1'}, '
', "\n"; } unless ( $config{'address2'} eq "" ){ print '', $config{'address2'}, '
', "\n"; } unless ( $config{'loc'} eq "" ){ print '', $config{'loc'}, '
', "\n"; } unless ( $config{'phone'} eq "" ){ print ' Phone: ', $config{'phone'}, '
', "\n"; } unless ( $config{'fax'} eq "" ){ print ' Fax: ', $config{'fax'}, '
', "\n"; } unless ( $config{'message1'} eq "" ){ print '
\n"; print ' Product:', "\n"; print " \n"; print ' Qty:', "\n"; print " \n"; print ' Price:', "\n"; print " \n"; print ' Total:', "\n"; print "
\n"; print ' ', @cache[1], '', "\n"; } else { print '
\n"; print ' ', @cache[1], ''; } print " \n"; print ' ){ @currency = split("\t"); if (@currency[0] eq @country[1]) { $currency = @currency[1]; } } if (@country[3] eq "P") { printf " @country[2]%.2f\n", @cache[2]; print " \n"; printf " @country[2]%.2f\n", $product_total; print "
\n"; printf " %.2f@country[2]\n", $product_total; print "
', "\n"; print " \n \n \n"; print "
\n"; print '
', $config{'message1'}, '

', "\n"; print "

\n"; } print '', "\n"; print ' ', "\n"; print ' ', "\n"; print " \n \n \n \n \n"; open (ID_CACHE, "$prefix/$cache/$id"); $qty_number = 1; while () { @cache = split("\t", $_, 9999); if (@cache[0] =~ /$masquerade/) { @cache[4] =~ tr/\n//d; $product_total = @cache[3] * @cache[2]; $products_in_cart = "yes"; if (@cache[4] eq "", @cache[4] eq " ") { print ' ', "\n"; print " ', "\n"; print " \n \n \n \n"; } if (@country[3] eq "S") { printf " %.2f@country[2]\n", $conversion_item; print " \n \n \n"; } if (@country[3] ne "S" && @country[3] ne "P") { printf " %.2f\n", $conversion_item; print " \n \n \n"; } } } close COUNTRY; $sub_total = $sub_total + $conversion_total; $accual_sub_total = $accual_sub_total + $product_total; $qty_number++; } if ($cart_type eq "orig_currency") { open(COUNTRY, "$prefix/data/country.dat"); while(){ @country = split("\t"); if (@country[0] eq $config{'country'}) { open(CURRENCY, "$prefix/data/currency.data"); while(){ @currency = split("\t"); if (@currency[0] eq @country[1]) { $currency = @currency[1]; } } if (@country[3] eq "P") { printf " @country[2]%.2f\n", @cache[2]; print " \n \n \n"; } if (@country[3] eq "S") { printf " %.2f@country[2]\n", @cache[2]; print " \n \n \n"; } if (@country[3] ne "S" && @country[3] ne "P") { printf " %.2f\n", @cache[2]; print " \n \n \n"; } } } close COUNTRY; $sub_total = $sub_total + $product_total; $qty_number++; } } } close ID_CACHE; unless ($products_in_cart eq "yes"){ print "\n"; } print ' ', "\n"; print " \n \n \n \n"; if ($cart_type eq "est_currency") { print "\n"; print "" } # printf " \$%.2f\n", $sub_total; print " \n"; print ""; print "
\n"; print ' Product:', "\n"; print " \n"; print ' Qty:', "\n"; print " \n"; print ' Price:', "\n"; print " \n"; print ' Total:', "\n"; print "
\n"; print ' ', @cache[1], '', "\n"; } else { print '
\n"; print ' ', @cache[1], ''; } print " \n"; print ' ) { @country = split("\t"); if (@country[0] eq $config{'country'}) { $currency_symb = @country[1]; $cart_type = "orig_currency"; } } close COUNTRY; } if ($cart_type eq "est_currency" ) { open(COUNTRY, "$prefix/data/country.dat"); while(){ @country = split("\t"); if (@country[0] eq $config{'country'}) { $localcountry = @country[1]; } } close COUNTRY; open(CURRENCY, "$prefix/data/currency.data"); while(){ @currency = split("\t"); if (@currency[0] eq $currency_symb) { $remoterate = @currency[3]; $currency = @currency[1]; } if (@currency[0] eq $localcountry) { $localrate = @currency[2]; } } close CURRENCY; $conversion_total = (((@cache[3] * @cache[2]) * $localrate) * $remoterate); $conversion_item = ((@cache[2] * $localrate) * $remoterate); open(COUNTRY, "$prefix/data/country.dat"); while(){ @country = split("\t"); if (@country[1] eq $currency_symb) { if (@country[3] eq "P") { printf " @country[2]%.2f\n", $conversion_item; print " \n"; printf " @country[2]%.2f\n", $conversion_total; print "
\n"; printf " %.2f@country[2]\n", $conversion_total; print "
\n"; printf " %.2f\n", $conversion_total; print "
\n"; printf " @country[2]%.2f\n", $product_total; print "
\n"; printf " %.2f@country[2]\n", $product_total; print "
\n"; printf " %.2f\n", $product_total; print "
Your cart is empty.
\n"; print ' ', "\n"; print ' ', "\n"; print ' ', "\n"; print ' ', "\n"; print " \n"; print ' Sub Total:', "\n"; print " \n"; if ($sub_total eq "") { $sub_total = "0"; } open(COUNTRY, "$prefix/data/country.dat"); while(){ @country = split("\t"); if (@country[1] eq $currency_symb) { if (@country[3] eq "P") { printf " @country[2]%.2f\n", $sub_total; } if (@country[3] eq "S") { printf " %.2f@country[2]\n", $sub_total; } if (@country[3] ne "S" && @country[3] ne "P") { printf " %.2f\n", $sub_total; } } } close COUNTRY; print "
\n"; open(CURRENCY, "$prefix/data/currency.data"); while () { @currency = split("\t"); if (@currency[0] eq $localcountry) { print "Actual Sub Total in @currency[1]:\n"; } } close CURRENCY; print ""; open(COUNTRY, "$prefix/data/country.dat"); while(){ @country = split("\t"); if (@country[0] eq $config{'country'}) { if (@country[3] eq "P") { printf " @country[2]%.2f\n", $accual_sub_total; } if (@country[3] eq "S") { printf " %.2f@country[2]\n", $accual_sub_total; } if (@country[3] eq "S" && @country[3] eq "P") { printf " %.2f\n", $accual_sub_total; } } } close COUNTRY; print "
EZ-E Currency Estimator*:
Estimate subtotal in:"; print "\n"; print "
\n"; print "\n \n"; print $extra; print ' \n \n \n \n \n \n \n \n
', "\n"; if ($cart_type eq "est_currency") { print " *All Prices estimated in $currency. Although exchange rates updated daily, prices may differ.."; } else { print " *All Prices listed in $currency.."; } print '
Please press "Recalculate Items" after changing any numbers in the Quantity(Qty)', "\n"; print ' boxes, if you want your order to be processed correctly. If you want to remove a item, change it\'s ', "\n"; print ' quantity to 0 and press "Recalculate Items". If the shopping cart does not remember your orders, be ', "\n"; print ' sure that cookies are enabled on your browser.
', "\n"; print "
\n"; print ' ', "\n"; print " \n"; print " \n"; print '
', "\n"; if ($in{'return'} eq "") { print ' ', "\n"; print ' ', "\n"; print ' ', "\n"; print "
\n
\n"; } else { print ' ', "\n"; print ' ', "\n"; print ' ', "\n"; print " \n \n"; } print '
', "\n"; print ' ', "\n"; print ' ', "\n"; print ' ', "\n"; print "
\n"; print "
"; print 'Created By the EZ-ECommerce System v.', $version, '', "\n"; print "\n\n"; } #END View Cart if ( $in{'type'} eq "return") { print "\n\n"; print ' ', "\n"; print "\n"; } if ( $in{'type'} eq "Check Out") { config("$in{'shop'}"); open (ID_CACHE_IN, "$prefix/$cache/$id"); system("touch $prefix/$cache/$id.tmp"); open (ID_CACHE_OUT, ">$prefix/$cache/$id.tmp"); $qty_count = 1; while () { @cache = split("\t", $_, 9999); if ( @cache[0] =~ /$masquerade/ ) { $quantity = "qty$qty_count"; $quantity =~ tr/\n//d; unless ( $in{$quantity} eq "0"){ print ID_CACHE_OUT "@cache[0]\t@cache[1]\t@cache[2]\t$in{$quantity}\t@cache[4]\t\n"; } $qty_count++; } else{ print ID_CACHE_OUT "@cache[0]\t@cache[1]\t@cache[2]\t@cache[3]\t@cache[4]\t\n"; } } close(ID_CACHE_IN); close(ID_CACHE_OUT); system ("mv $prefix/$cache/$id.tmp $prefix/$cache/$id"); print "\n"; print "\n"; print " EZ-ECart - Checkout Method - Step 1 of 4\n"; print "\n"; print '', "\n"; print 'Checkout Method:

', "\n"; print 'SECURE CHECKOUT:
', "\n"; print ' This method of processing orders Processes orders securely, However, this is not supported by some web ', "\n"; print ' browsers.
', "\n"; print '

', "\n"; print ' ', "\n"; print ' ', "\n"; print ' ', "\n"; print ' ', "\n"; print ' ', "\n"; print "

\n"; print 'NON-SECURE CHECKOUT:
', "\n"; print ' Please use this method if the secure method does not work. This is supported by all browsers
', "\n"; print '

', "\n"; print ' ', "\n"; print ' ', "\n"; print ' ', "\n"; print ' ', "\n"; print ' ', "\n"; print "

\n"; print '', "\n"; print ' ', "\n"; print "\n"; print "\n"; } if ( $in{'type'} eq "clear" ) { open (ID_CACHE_IN, "<$prefix/$cache/$id"); system("touch $prefix/$cache/$id.tmp"); open (ID_CACHE_OUT, ">$prefix/$cache/$id.tmp"); while () { @cache = split("\t", $_, 9999); unless ( @cache[0] =~ /$masquerade/ ){ print ID_CACHE_OUT; } } close(ID_CACHE_IN); close(ID_CACHE_OUT); system ("mv $prefix/$cache/$id.tmp $prefix/$cache/$id"); &viewcart; } if ( $in{'type'} eq "Recalculate Items" ) { open (ID_CACHE_IN, "$prefix/$cache/$id"); system("touch $prefix/$cache/$id.tmp"); open (ID_CACHE_OUT, ">$prefix/$cache/$id.tmp"); $qty_count = 1; while () { @cache = split("\t", $_, 9999); if ( @cache[0] =~ /$masquerade/ ) { $quantity = "qty$qty_count"; $quantity =~ tr/"\n"//d; unless ( $in{"$quantity"} eq "0"){ print ID_CACHE_OUT "@cache[0]\t@cache[1]\t@cache[2]\t$in{$quantity}\t@cache[4]\t\n"; } $qty_count++; } else{ print ID_CACHE_OUT "@cache[0]\t@cache[1]\t@cache[2]\t@cache[3]\t@cache[4]\t\n"; } } close(ID_CACHE_IN); close(ID_CACHE_OUT); system ("mv $prefix/$cache/$id.tmp $prefix/$cache/$id"); &viewcart; } if ( $in{'type'} eq "add" ) { warn "adding a product"; unless ( -e "$prefix/$cache/$id" ){ system("touch $prefix/$cache/$id"); # system("chmod 777 $prefix/$id"); } if ($in{'option'} eq "multiple") { $amount = "amount1"; $product = "product1"; $price = "price1"; $image = "image1"; $count = "1"; while ($in{$product} ne "") { undef $product_on_list; open (ID_CACHE_OUT, ">> $prefix/$cache/$id"); open (ID_CACHE_IN, "$prefix/$cache/$id"); while () { @plist = split("\t", $_); if (@plist[1] eq $in{$product} && @plist[0] =~ /$masquerade/ && $in{$amount} ne "" && $in{$amount} ne "0") { $product_list = "$product_on_list

  • $in{$product}"; $product_on_list = "yes"; } } close ID_CACHE_IN; if ($product_on_list ne "yes" && $in{$amount} ne "" && $in{$amount} ne "0") { print ID_CACHE_OUT $masquerade, "\t", $in{$product}, "\t", $in{$price}, "\t", $in{$amount}, "\t", $in{$image}, "\t", "\n"; } close ID_CACHE_OUT; $count++; $amount = "amount$count"; $product = "product$count"; $price = "price$count"; $image = "image$count"; } if ($product_list ne "") { $extra = " \n \n One or more of the items you added are allready in your cart, and where omitted. These items are:
    $product_list
    Please change the quantity of the item instead.
    \n
    \n \n \n \n"; } } else { open (ID_CACHE_OUT, ">> $prefix/$cache/$id"); open (ID_CACHE_IN, "$prefix/$cache/$id"); while () { @plist = split("\t", $_); $product_on_list = "yes" if @plist[1] eq $in{'product'} && @plist[0] =~ /$masquerade/; } close ID_CACHE_IN; if ($in{'percent'} ne "") { $in{'price'} = $in{'price'} * $in{'percent'}; } if ($product_on_list eq "") { if ($in{'priceoption'} eq "") { print ID_CACHE_OUT $masquerade, "\t", $in{'product'}, "\t", $in{'price'}, "\t", $in{'amount'}, "\t", $in{'image'}, "\t", "\n"; } else { @priceoption = split(' ',$in{'priceoption'}); @npriceoption = reverse(@priceoption); $nprice = @npriceoption[0]; undef @npriceoption[0]; @priceoption = reverse(@npriceoption); print ID_CACHE_OUT $masquerade, "\t", $in{'product'}, ", ", @priceoption, "\t", $nprice, "\t", $in{'amount'}, "\t", $in{'image'}, "\t\n"; } close ID_CACHE_OUT; } if ($product_on_list eq "yes") { $extra = " \n \n You already have this item in your cart. If you want more of this item, please change the quantity.\n \n \n \n \n"; } } &viewcart; } if ( $in{'type'} eq "view" ) { &viewcart; } if ( $in{'type'} eq "Estimate" ) { &viewcart; } if ( $in{'type'} eq "info1" ) { config("$in{'shop'}"); print "\n"; print "\n"; print " EZ-ECart - Information - Step 2 of 4\n"; print "\n"; print '', "\n"; print "
    \n"; unless ($config{'www'} eq ""){ unless ($config{'company'} eq ""){ print '', $config{'company'}, '
    ', "\n"; } } if ($config{'www'} eq "") { unless ($config{'company'} eq ""){ print '', $config{'company'}, '
    ', "\n"; } } unless ( $config{'address1'} eq "" ){ print '', $config{'address1'}, '
    ', "\n"; } unless ( $config{'address2'} eq "" ){ print '', $config{'address2'}, '
    ', "\n"; } unless ( $config{'loc'} eq "" ){ print '', $config{'loc'}, '
    ', "\n"; } unless ( $config{'phone'} eq "" ){ print ' Phone: ', $config{'phone'}, '
    ', "\n"; } unless ( $config{'fax'} eq "" ){ print ' Fax: ', $config{'fax'}, '
    ', "\n"; } unless ( $config{'message2'} eq "" ){ print ''; print " \n \n \n"; print '
    \n"; print '
    ', $config{'message2'}, '

    ', "\n"; print "

    '; } if ($in{'security'} eq "yes"){ print '
    ', "\n"; print ' ', "\n"; } else{ print '', "\n"; print ' ', "\n"; } print ' ', "\n"; print " \n"; print ' \n \n"; print " \n \n \n"; print "
    ', "\n"; print ' Code:', "\n"; print "
    \n If you have a Promotional/Dealer Code or Gift Certificate Code, please type it in below:
    \n
    \n"; print ' ', "\n"; print " \n"; print ' \n \n"; print " \n \n \n \n"; print " \n \n \n \n"; print " \n \n \n \n"; print " \n \n \n \n"; print " \n \n \n \n"; print " \n \n \n \n"; print " \n \n \n \n"; print " \n \n \n \n"; print "
    ', "\n"; print ' Billing Information:', "\n"; print "
    \n Name:\n \n ", '', "\n
    \n Address:\n \n ", '', "\n"; print '
    ', "\n
    \n City:\n \n ", '', "\n
    \n State/Providence:\n \n \n Other:\n ", '', "\n
    \n Zip Code:\n \n ", '', "\n
    \n Country:\n \n \n Other:\n \n
    \n Phone Number:\n \n ", '', "\n
    \n E-mail:
    email to confirm order.\n
    \n ", '', "\n
    \n"; print ' ', "\n"; print " \n"; print ' \n \n"; print " \n \n \n"; print " \n \n \n \n"; print " \n \n \n \n"; print " \n \n \n \n"; print " \n \n \n \n"; print " \n \n \n \n"; print " \n \n \n \n"; print "
    ', "\n"; print ' Shipping Information:', "\n"; print "
    \n Is your shipping information the same as your billing information?
    \n"; print " Yes\n"; print " No\n"; print "
    \n Name:\n \n ", '', "\n
    \n Address:\n \n ", '', "\n"; print '
    ', "\n
    \n City:\n \n ", '', "\n
    \n State/Providence:\n \n \n Other: \n ", '', "\n
    \n Zip Code:\n \n ", '', "\n
    \n Country:\n \n \n Other:\n \n
    \n"; if ($config{'ship'} ne "no") { print ' ', "\n"; print " \n"; print ' \n \n"; print ' \n \n"; print " \n \n \n
    ', "\n"; print ' Shipping Methods:', "\n"; print "
    ', "\n"; print " $config{'smessage'}\n"; print "
    \n"; $count = 1; while ($count <= 12) { unless ( $config{"sname$count"} eq "" ){ if ( $config{"stype$count"} =~ /pero/ ) { print ' ', $config{"sname$count"}, ' (', $config{"scost$count"}, ' per order)
    ', "\n"; } if ( $config{"stype$count"} =~ /peri/ ) { print ' ', $config{"sname$count"}, ' (', $config{"scost$count"}, ' per item)
    ', "\n"; } if ( $config{"stype$count"} =~ /perp/ ) { print ' ', $config{"sname$count"}, ' (', $config{"scost$count"}, 'percent of order)
    ', "\n"; } } $count++; } print "
    \n"; } print ' ', "\n"; print ' ', "\n"; print ' ', "\n"; print ' ', "\n"; print " \n \n \n"; print "
    \n \n
    \n
    \n\n\n"; } sub viewcartfinal{ if ($in{'code'} ne "") { undef $count; $count = 1; while ($count <= 12) { if ($in{'code'} eq $config{"pname$count"}) { $ptype = $config{"ptype$count"}; $pcost = $config{"pcost$count"}; $premark = $config{"premark$count"}; } $count++; } undef $count; $count = 13; while ($count <= 20) { open (CODE, "/home/ez-e/ecommerce/accounts/$in{'shop'}/$in{'shop'}.cart.pname$count"); while () { @code = split("=="); if (@code[0] eq $in{'code'}) { $ptype = $config{"ptype$count"}; $pcost = $config{"pcost$count"}; $premark = $config{"premark$count"}; } } $count++; close CODE; } } undef $count; print '', "\n"; print ' ', "\n"; print " \n \n \n \n \n"; open (ID_CACHE_IN, "$prefix/$cache/$in{'cookie'}"); $items = 0; while () { @cache = split("\t", $_, 9999); if (@cache[0] =~ /$masquerade/) { @cache[3] =~ tr/\n//d; undef $product_total; $product_total = @cache[3] * @cache[2]; print " \n \n \n \n \n \n", $product_total; } if (@country[3] eq "S") { printf " %.2f@country[2]\n \n \n \n", $product_total; } } } close COUNTRY; $sub_total = $sub_total + $product_total; $items++; } } close ID_CACHE_IN; print " \n \n \n \n \n", $sub_total; } if (@country[3] eq "S") { printf " %.2f@country[2]\n \n \n", $sub_total; } } } close COUNTRY; if ($ptype eq "opo") { print " \n \n \n \n \n", $pcost; } if (@country[3] eq "S") { printf " -%.2f@country[2]\n\n \n", $pcost; } } } close COUNTRY; $sub_total = $sub_total - $pcost; } if ($ptype eq "poo") { print " \n \n \n \n \n", $pdeduct; } if (@country[3] eq "S") { printf " -%.2f@country[2]\n\n \n", $pdeduct; } } } close COUNTRY; $sub_total = $sub_total - $pdeduct; } if ($sub_total < 0) { $sub_total = 0; } if ( $config{'state'} eq $in{'state'} ) { $tax = (($sub_total) * ($config{'tax'} / 100)); print " \n \n \n \n \n"; $total = $sub_total; } else { open(COUNTRY, "$prefix/data/country.dat"); while(){ @country = split("\t"); if (@country[0] eq $config{'country'}) { if (@country[3] eq "P") { printf " @country[2]%.2f\n \n \n", $tax; } if (@country[3] eq "S") { printf " %.2f@country[2]\n \n \n", $tax; } } } close COUNTRY; $total = $sub_total + $tax; } } else { $total = $sub_total; } if ($config{'ship'} ne "no") { if ( $in{'ship'} == "1" ) { $shipname = $config{'sname1'}; if ( $config{'stype1'} =~ /pero/ ) { $totalship = $config{'scost1'}; } if ( $config{'stype1'} =~ /peri/ ) { $totalship = ($items * $config{'scost1'}); } if ( $config{'stype1'} =~ /perp/ ) { $totalship = ($sub_total * ($config{'scost1'} / 100)); } } if ( $in{'ship'} == "2" ) { $shipname = $config{'sname2'}; if ( $config{'stype2'} =~ /pero/ ) { $totalship = $config{'scost2'}; } if ( $config{'stype2'} =~ /peri/ ) { $totalship = ($items * $config{'scost2'}); } if ( $config{'stype2'} =~ /perp/ ) { $totalship = ($sub_total * ($config{'scost2'} / 100)); } } if ( $in{'ship'} =~ "3" ) { $shipname = $config{'sname3'}; if ( $config{'stype3'} =~ /pero/ ) { $totalship = $config{'scost3'}; } if ( $config{'stype3'} =~ /peri/ ) { $totalship = ($items * $config{'scost3'}); } if ( $config{'stype3'} =~ /perp/ ) { $totalship = ($sub_total * ($config{'scost3'} / 100)); } } if ( $in{'ship'} =~ "4" ) { $shipname = $config{'sname4'}; if ( $config{'stype4'} =~ /pero/ ) { $totalship = $config{'scost4'}; } if ( $config{'stype4'} =~ /peri/ ) { $totalship = ($items * $config{'scost4'}); } if ( $config{'stype4'} =~ /perp/ ) { $totalship = ($sub_total * ($config{'scost4'} / 100)); } } if ( $in{'ship'} =~ "5" ) { $shipname = $config{'sname5'}; if ( $config{'stype5'} =~ /pero/ ) { $totalship = $config{'scost5'}; } if ( $config{'stype5'} =~ /peri/ ) { $totalship = ($items * $config{'scost5'}); } if ( $config{'stype5'} =~ /perp/ ) { $totalship = ($sub_total * ($config{'scost5'} / 100)); } } if ( $in{'ship'} =~ "6" ) { $shipname = $config{'sname6'}; if ( $config{'stype6'} =~ /pero/ ) { $totalship = $config{'scost6'}; } if ( $config{'stype6'} =~ /peri/ ) { $totalship = ($items * $config{'scost6'}); } if ( $config{'stype6'} =~ /perp/ ) { $totalship = ($sub_total * ($config{'scost6'} / 100)); } } if ( $in{'ship'} =~ "7" ) { $shipname = $config{'sname7'}; if ( $config{'stype7'} =~ /pero/ ) { $totalship = $config{'scost7'}; } if ( $config{'stype7'} =~ /peri/ ) { $totalship = ($items * $config{'scost7'}); } if ( $config{'stype7'} =~ /perp/ ) { $totalship = ($sub_total * ($config{'scost7'} / 100)); } } if ( $in{'ship'} =~ "8" ) { $shipname = $config{'sname8'}; if ( $config{'stype8'} =~ /pero/ ) { $totalship = $config{'scost8'}; } if ( $config{'stype8'} =~ /peri/ ) { $totalship = ($items * $config{'scost8'}); } if ( $config{'stype8'} =~ /perp/ ) { $totalship = ($sub_total * ($config{'scost8'} / 100)); } } if ( $in{'ship'} =~ "9" ) { $shipname = $config{'sname9'}; if ( $config{'stype9'} =~ /pero/ ) { $totalship = $config{'scost9'}; } if ( $config{'stype9'} =~ /peri/ ) { $totalship = ($items * $config{'scost9'}); } if ( $config{'stype9'} =~ /perp/ ) { $totalship = ($sub_total * ($config{'scost9'} / 100)); } } if ( $in{'ship'} =~ "10" ) { $shipname = $config{'sname10'}; if ( $config{'stype10'} =~ /pero/ ) { $totalship = $config{'scost10'}; } if ( $config{'stype10'} =~ /peri/ ) { $totalship = ($items * $config{'scost10'}); } if ( $config{'stype10'} =~ /perp/ ) { $totalship = ($sub_total * ($config{'scost10'} / 100)); } } if ( $in{'ship'} =~ "11" ) { $shipname = $config{'sname11'}; if ( $config{'stype11'} =~ /pero/ ) { $totalship = $config{'scost11'}; } if ( $config{'stype11'} =~ /peri/ ) { $totalship = ($items * $config{'scost11'}); } if ( $config{'stype11'} =~ /perp/ ) { $totalship = ($sub_total * ($config{'scost11'} / 100)); } } if ( $in{'ship'} =~ "12" ) { $shipname = $config{'sname12'}; if ( $config{'stype12'} =~ /pero/ ) { $totalship = $config{'scost12'}; } if ( $config{'stype12'} =~ /peri/ ) { $totalship = ($items * $config{'scost12'}); } if ( $config{'stype12'} =~ /perp/ ) { $totalship = ($sub_total * ($config{'scost12'} / 100)); } } print " \n \n \n \n \n"; $final_total = $total; } else { open(COUNTRY, "$prefix/data/country.dat"); while(){ @country = split("\t"); if (@country[0] eq $config{'country'}) { if (@country[3] eq "P") { printf " @country[2]%.2f\n \n \n", $totalship; } if (@country[3] eq "S") { printf " %.2f@country[2]\n \n \n", $totalship; } } } close COUNTRY; $final_total = $total + $totalship; } } print " \n \n \n \n \n", $final_total; } if (@country[3] eq "S") { printf " %.2f@country[2]\n \n \n", $final_total; } } } close COUNTRY; print "
    \n"; print ' Product:', "\n"; print " \n"; print ' Qty:', "\n"; print " \n"; print ' Price:', "\n"; print " \n"; print ' Total:', "\n"; print "
    \n @cache[1]\n \n @cache[3]\n \n"; open(COUNTRY, "$prefix/data/country.dat"); while(){ @country = split("\t"); if (@country[0] eq $config{'country'}) { open(CURRENCY, "$prefix/data/currency.data"); while(){ @currency = split("\t"); if (@currency[0] eq @country[1]) { $currency = @currency[1]; } } if (@country[3] eq "P") { printf " @country[2]%.2f\n \n", @cache[2]; printf " @country[2]%.2f\n
    \n", @cache[2]; printf " %.2f@country[2]\n
    \n \n Sub Total:\n \n"; open(COUNTRY, "$prefix/data/country.dat"); while(){ @country = split("\t"); if (@country[0] eq $config{'country'}) { if (@country[3] eq "P") { printf " @country[2]%.2f\n
    \n \n Discount:\n \n"; open(COUNTRY, "$prefix/data/country.dat"); while(){ @country = split("\t"); if (@country[0] eq $config{'country'}) { if (@country[3] eq "P") { printf " -@country[2]%.2f\n
    \n \n $pcost\% Discount:\n \n"; $pdeduct = ($pcost / 100) * $sub_total; open(COUNTRY, "$prefix/data/country.dat"); while(){ @country = split("\t"); if (@country[0] eq $config{'country'}) { if (@country[3] eq "P") { printf " -@country[2]%.2f\n
    \n \n "; print ' ', $config{'state'}, ' Tax:', "\n"; print " \n"; if ($ptype eq "ft") { print " Free\n
    \n \n "; print '', $shipname, ' Shipping:', "\n"; print " \n"; if ($ptype eq "fs") { print " Free\n
    \n \n Final Total:\n \n"; open(COUNTRY, "$prefix/data/country.dat"); while(){ @country = split("\t"); if (@country[0] eq $config{'country'}) { if (@country[3] eq "P") { printf " @country[2]%.2f\n
    \n"; print '', "\n"; print "
    *All prices listed in $currency.
    \n"; } sub total { print "\n\n"; print " EZ-ECart - Final Total / Payment Information - Step 3 of 4\n\n"; print '', "\n"; print "
    \n"; unless ($config{'www'} eq ""){ unless ($config{'company'} eq ""){ print '', $config{'company'}, '
    ', "\n"; } } if ($config{'www'} eq "") { unless ($config{'company'} eq ""){ print '', $config{'company'}, '
    ', "\n"; } } unless ( $config{'address1'} eq "" ){ print '', $config{'address1'}, '
    ', "\n"; } unless ( $config{'address2'} eq "" ){ print '', $config{'address2'}, '
    ', "\n"; } unless ( $config{'loc'} eq "" ){ print '', $config{'loc'}, '
    ', "\n"; } unless ( $config{'phone'} eq "" ){ print ' Phone: ', $config{'phone'}, '
    ', "\n"; } unless ( $config{'fax'} eq "" ){ print ' Fax: ', $config{'fax'}, '
    ', "\n"; } unless ( $config{'message3'} eq "" ){ print ''; print " \n \n \n"; print "
    \n "; print '
    ', $config{'message3'}, '

    ', "\n"; print "

    \n"; } if ($missing_payment eq "yes" || $bad_number eq "yes" || $nonmatching_number eq "yes" || $wrong_exp eq "yes") { print "\n"; print " \n \n \n
    \n"; print "
    \n"; if ($missing_payment eq "yes") { print " Sorry, we need a little more information. Please compleat the red boxes with your:
    \n"; print "$missing_message
    "; } if ($bad_number eq "yes") { print " Our system does not recognize your card number.
    \n"; } if ($nonmatching_number eq "yes") { print " Please enter a $in{'payment'} number or change the card type.
    \n"; } if ($wrong_exp eq "yes") { print " The card has expired. Please check the exp. date.
    \n"; } print "
    \n"; print "
    \n"; } &viewcartfinal; print '', "\n"; print " \n"; print ' \n"; print ' \n \n"; print " \n \n \n \n"; print " \n \n \n \n"; print " \n \n \n \n"; print " \n \n \n \n"; if ($in{'state'} eq "") { $in{'state'} = $in{'other'}; } if ($in{'state2'} eq "") { $in{'state2'} = $in{'other2'}; } print " \n \n \n \n"; print " \n \n \n \n"; print " \n \n \n \n"; print " \n \n \n \n"; print " \n \n \n \n"; print "
    ', "\n"; print ' Billing Information:', "\n"; print " ', "\n"; print ' Shipping Information:', "\n"; print "
    \n $in{'name'}\n \n $in{'name2'}\n
    \n $in{'addr1'}\n \n $in{'addr12'}\n
    \n $in{'addr2'}\n \n $in{'addr22'}\n
    \n $in{'city'}\n \n $in{'city2'}\n
    \n $in{'state'}\n \n $in{'state2'}\n
    \n $in{'zip'}\n \n $in{'zip2'}\n
    \n $in{'country'}\n \n $in{'country2'}\n
    \n $in{'phone'}\n \n
    \n $in{'email'}\n \n
    \n

    \n"; if ($in{'security'} eq "yes"){ print '

    ', "\n"; print ' ', "\n"; } else{ print '', "\n"; print ' ', "\n"; } print ' ', "\n"; print " \n"; print ' \n \n"; if (($missing_code eq "yes" || $missing_exp eq "yes" || $missing_payment eq "yes" || $bad_number eq "yes" || $nonmatching_number eq "yes") && $in{'name3'} eq "") { print " \n \n \n \n"; } else { print " \n \n \n \n"; } if (($missing_code eq "yes" || $missing_exp eq "yes" || $missing_payment eq "yes" || $bad_number eq "yes" || $nonmatching_number eq "yes") && $in{'payment'} eq "") { print " \n \n \n \n \n \n"; if (($missing_code eq "yes" || $missing_exp eq "yes" || $missing_payment eq "yes" || $bad_number eq "yes" || $nonmatching_number eq "yes") && $in{'card'} eq "") { print " \n \n \n \n"; } else { print " \n \n \n \n"; } if (($missing_code eq "yes" || $missing_exp eq "yes" || $missing_payment eq "yes" || $bad_number eq "yes" || $nonmatching_number eq "yes") && $in{'card_code'} eq "") { print " \n \n \n \n"; } else { print " \n \n \n \n"; } $exp = "$in{'exp_year'}$in{'exp_month'}"; if (($missing_code eq "yes" || $missing_exp eq "yes" || $missing_payment eq "yes" || $bad_number eq "yes" || $nonmatching_number eq "yes") && $exp eq "") { print " \n \n \n \n \n \n"; print "
    ', "\n"; print ' Payment Information:', "\n"; print "
    \n Name:\n \n \n
    \n Name:\n \n \n
    \n Method Of Payment:\n \n
    \n Method Of Payment:\n \n \n
    \n Card Number:\n \n \n
    \n Card Number:\n \n \n
    \n Card Code:\n \n \n
    \n Card Code:\n \n \n(What is this?)
    \n Exp. Date:\n \n"; } else { print "
    \n Exp. Date:
    \n
    \n"; } print " \n /\n \n

    \n"; print " \n"; print " \n \n \n"; print " \n \n \n"; print "
    \n Comments: Please tell us how you found us.\n
    \n \n
    \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 \n \n
    \n"; print ' ', "\n"; print "
    \n"; print "

    \n\n"; } if ( $in{'type'} eq "total" ) { config("$in{'shop'}"); $in{'state'} = $in{'other'} if $in{'other'} ne ""; $in{'state2'} = $in{'other2'} if $in{'other2'} ne ""; $in{'country'} = $in{'othercountry'} if $in{'othercountry'} ne ""; $in{'country2'} = $in{'othercountry2'} if $in{'othercountry2'} ne ""; if ($in{'ship_same'} eq "yes") { if ($in{'name'} eq "" && $in{'ship_same'} eq "yes") { $skip_name2 = "yes"; } $in{'name2'} = $in{'name'}; if ($in{'addr1'} eq "" && $in{'ship_same'} eq "yes") { $skip_addr2 = "yes"; } $in{'addr12'} = $in{'addr1'}; $in{'addr22'} = $in{'addr2'}; if ($in{'city'} eq "" && $in{'ship_same'} eq "yes") { $skip_city2 = "yes"; } $in{'city2'} = $in{'city'}; if ($in{'state'} eq "" && $in{'ship_same'} eq "yes") { $skip_state2 = "yes"; } $in{'state2'} = $in{'state'}; $in{'other2'} = $in{'other'}; if ($in{'zip'} eq "" && $in{'ship_same'} eq "yes") { $skip_zip2 = "yes"; } $in{'zip2'} = $in{'zip'}; if ($in{'country'} eq "" && $in{'ship_same'} eq "yes") { $skip_country2 = "yes"; } $in{'country2'} = $in{'country'}; $in{'othercountry2'} = $in{'othercountry'}; } undef $count; $count = 1; while ($count < 8) { if ($in{'ship'} eq $count) { if ($in{'country2'} ne $config{'country'} && $config{"scountry$count"} eq "domestic") { $bad_ship = "yes"; $ship_message = "A domestic shipping method was selected.
    \n"; } if ($in{'country2'} eq $config{'country'} && $config{"scountry$count"} eq "non-domestic") { $bad_ship = "yes"; $ship_message = "Our system has detected that a non-domestic shipping method has been chosen for shipping in $config{'country'}
    \n"; } } $count++; } if ($in{'code'} ne "") { undef $count; $count = 1; while ($count <= 12) { if ($in{'code'} eq $config{"pname$count"}) { $cod_ok = "yes"; $yr = `date +%Y`; $yr =~ s/\n//; $mo = `date +%m`; $mo =~ s/\n//; $day = `date +%d`; $day =~ s/\n//; $today = "$yr$mo$day"; $pyear = $config{"pexpyear$count"}; $pmo = $config{"pexpmo$count"}; $pday = $config{"pexpday$count"}; $pexp = "$pyear$pmo$pday"; if ($today > $pexp) { $cod_ok = "no"; } if ($config{"puse$count"} < 1) { $cod_ok = "no"; } } $count++; } undef $count; $count = 13; while ($count <= 20) { open (CODE, "/home/ez-e/ecommerce/accounts/$in{'shop'}/$in{'shop'}.cart.pname$count"); while () { @code = split("=="); if ($in{'code'} eq @code[0]) { $cod_ok = "yes"; } } $count++; close CODE; } } undef $count; if ($in{'code'} ne "" && $cod_ok ne "yes") { $all_mandatory = "no"; $cod_message = "The code entered is invalid. Please change or remove it."; } if ( $config{'man_name'} eq "yes" && $in{'name'} eq "") { $all_mandatory = "no"; $missing_fields = "
  • Billing Name\n"; $missing_name = yes; } if ( $config{'man_addr'} eq "yes" && $in{'addr1'} eq "" ) { $all_mandatory = "no"; $missing_fields = "$missing_fields
  • Billing Address 1\n"; $missing_addr = yes; } if ( $config{'man_city'} eq "yes" && $in{'city'} eq "") { $all_mandatory = "no"; $missing_fields = "$missing_fields
  • Billing City\n"; $missing_city = yes; } if ( $config{'man_state'} eq "yes" && $in{'state'} eq "") { $all_mandatory = "no"; $missing_fields = "$missing_fields
  • Billing State\n"; $missing_state = yes; } if ( $config{'man_zip'} eq "yes" && $in{'zip'} eq "" ) { $all_mandatory = "no"; $missing_fields = "$missing_fields
  • Billing Zip Code\n"; $missing_zip = yes; } if ( $config{'man_country'} eq "yes" && $in{'country'} eq "" ) { $all_mandatory = "no"; $missing_fields = "$missing_fields
  • Billing Country\n"; $missing_country = yes; } if ( $config{'man_phoneoremail'} eq "yes" && $in{'email'} eq "" && $in{'phone'} eq "") { $all_mandatory = "no"; $missing_fields = "$missing_fields
  • Billing Phone or Email\n"; $missing_email = yes; $missing_phone = yes; } else { if ( $config{'man_phone'} eq "yes" && $in{'phone'} eq "" ) { $all_mandatory = "no"; $missing_fields = "$missing_fields
  • Billing Phone\n"; $missing_phone = yes; } if ( $config{'man_email'} eq "yes" && $in{'email'} eq "" ) { $all_mandatory = "no"; $missing_fields = "$missing_fields
  • Billing Email\n"; $missing_email = yes; } } if ( $config{'man_name2'} eq "yes" && $in{'name2'} eq "" && $skip_name2 ne "yes") { $all_mandatory = "no"; $missing_fields = "$missing_fields
  • Shipping Name\n"; $missing_name2 = yes; } if ( $config{'man_addr2'} eq "yes" && $in{'addr12'} eq "" && $skip_addr2 ne "yes" ) { $all_mandatory = "no"; $missing_fields = "$missing_fields
  • Shipping Address 1\n"; $missing_addr2 = yes; } if ( $config{'man_city2'} eq "yes" && $in{'city2'} eq "" && $skip_city2 ne "yes") { $all_mandatory = "no"; $missing_fields = "$missing_fields
  • Shipping City\n"; $missing_city2 = yes; } if ( $config{'man_state2'} eq "yes" && $in{'state2'} eq "" && $skip_state2 ne "yes") { $all_mandatory = "no"; $missing_fields = "$missing_fields
  • Shipping State\n"; $missing_state2 = yes; } if ( $config{'man_zip2'} eq "yes" && $in{'zip2'} eq "" && $skip_zip2 ne "yes" ) { $all_mandatory = "no"; $missing_fields = "$missing_fields
  • Shipping Zip Code\n"; $missing_zip2 = yes; } if ( $config{'man_country2'} eq "yes" && $in{'country2'} eq "" && $skip_country2 ne "yes" ) { $all_mandatory = "no"; $missing_fields = "$missing_fields
  • Shipping Country\n"; $missing_country2 = yes; } if ( $config{'man_shipping'} eq "yes" && $in{'ship'} eq "") { $all_mandatory = "no"; $missing_fields = "$missing_fields
  • Shipping Method\n"; $missing_shipping = yes; } if ( $all_mandatory ne "no" && $bad_ship ne "yes") { if ($in{'ship_same'} eq "yes") { $in{'name2'} = " " if $in{'name'} eq ""; $in{'addr12'} = " " if $in{'addr1'} eq ""; $in{'addr22'} = " " if $in{'addr2'} eq ""; $in{'cirt2'} = " " if $in{'city'} eq ""; $in{'state2'} = " " if $in{'state'} eq ""; $in{'zip2'} = " " if $in{'zip'} eq ""; $in{'country2'} = " " if $in{'country'} eq ""; } &total; } else{ print "\n"; print "\n"; print " EZ-ECart - Information - Step 2 of 4\n"; print "\n"; print '', "\n"; print "
    \n"; unless ($config{'www'} eq ""){ unless ($config{'company'} eq ""){ print '', $config{'company'}, '
    ', "\n"; } } if ($config{'www'} eq "") { unless ($config{'company'} eq ""){ print '', $config{'company'}, '
    ', "\n"; } } unless ( $config{'address1'} eq "" ){ print '', $config{'address1'}, '
    ', "\n"; } unless ( $config{'address2'} eq "" ){ print '', $config{'address2'}, '
    ', "\n"; } unless ( $config{'loc'} eq "" ){ print '', $config{'loc'}, '
    ', "\n"; } unless ( $config{'phone'} eq "" ){ print ' Phone: ', $config{'phone'}, '
    ', "\n"; } unless ( $config{'fax'} eq "" ){ print ' Fax: ', $config{'fax'}, '
    ', "\n"; } unless ( $config{'message2'} eq "" ){ print ''; print " \n \n \n"; print '
    \n"; print '
    ', $config{'message2'}, '

    ', "\n"; print "

    '; } if ($all_mandatory eq "no" || $bad_ship eq "yes") { print '', "\n"; print " \n \n \n"; print "
    \n
    \n"; if ($all_mandatory eq "no") { print " Sorry. We need a little more information. Please complete the red boxes with your:\n"; print "$missing_fields

    "; } if ($bad_ship eq "yes") { print $ship_message; } print $cod_message; print "


    \n
    \n"; } if ($in{'security'} eq "yes"){ print '
    ', "\n"; print ' ', "\n"; } else{ print '', "\n"; print ' ', "\n"; } print ' ', "\n"; print " \n"; print ' \n \n"; print " \n \n \n"; print "
    ', "\n"; print ' Code:', "\n"; print "
    \n If you have a Promotional/Dealer Code or Gift Certificate Code, please type it in below:
    \n
    \n"; print ' ', "\n"; print " \n"; print ' \n \n"; if ($missing_name eq "yes") { print " \n \n \n \n"; } else { print " \n \n \n \n"; } if ($missing_addr eq "yes") { print " \n \n \n \n"; } else { print " \n \n \n \n"; } if ($missing_city eq "yes") { print " \n \n \n \n"; } else { print " \n \n \n \n"; } if ($missing_state eq "yes") { print " \n \n \n \n \n \n"; if ($missing_zip eq "yes") { print " \n \n \n \n"; } else { print " \n \n \n \n"; } if ($missing_country eq "yes") { print " \n \n \n \n \n \n"; if ($missing_phone eq "yes") { print " \n \n \n \n"; } else { print " \n \n \n \n"; } if ($missing_email eq "yes") { print " \n \n \n \n"; } else { print " \n \n \n \n"; } print "
    ', "\n"; print ' Billing Information:', "\n"; print "
    \n Name:\n \n \n
    \n Name:\n \n \n
    \n Address:\n \n \n"; print "
    \n
    \n Address:\n \n \n"; print "
    \n
    \n City:\n \n \n
    \n City:\n \n \n
    \n State/Providence:\n \n
    \n State/Providence:\n \n \n Other:\n \n
    \n Zip Code:\n \n \n
    \n Zip Code:\n \n \n
    \n Country:\n \n
    \n Country:\n \n \n Other:\n \n
    \n Phone Number:\n \n \n
    \n Phone Number:\n \n \n
    \n E-mail:\n \n \n
    \n E-mail:
    email to confirm order.\n
    \n \n
    \n"; print ' ', "\n"; print " \n"; print ' \n \n"; print " \n \n \n"; if ($missing_name2 eq "yes") { print " \n \n \n \n"; } else { print " \n \n \n \n"; } if ($missing_addr2 eq "yes") { print " \n \n \n \n"; } else { print " \n \n \n \n"; } if ($missing_city2 eq "yes") { print " \n \n \n \n"; } else { print " \n \n \n \n"; } if ($missing_state2 eq "yes") { print " \n \n \n \n \n \n"; if ($missing_zip2 eq "yes") { print " \n \n \n \n"; } else { print " \n \n \n \n"; } if ($missing_country2 eq "yes") { print " \n \n \n \n \n \n"; print "
    ', "\n"; print ' Shipping Information:', "\n"; print "
    \n Is your shipping information the same as your billing information?
    \n"; if ($in{'ship_same'} eq "yes") { print " Yes\n"; print " No\n"; } if ($in{'ship_same'} eq "no") { print " Yes\n"; print " No\n"; } print "
    \n Name:\n \n \n
    \n Name:\n \n \n
    \n Address:\n \n \n"; print "
    \n
    \n Address:\n \n \n"; print "
    \n
    \n City:\n \n \n
    \n City:\n \n \n
    \n State/Providence:\n \n
    \n State/Providence:\n \n \n Other:\n \n
    \n Zip Code:\n \n \n
    \n Zip Code:\n \n \n
    \n Country:\n \n
    \n Country:\n \n \n Other:\n \n
    \n"; undef $count; if ($config{'ship'} ne "no") { print ' ', "\n"; print " \n"; print ' \n \n"; print " \n \n \n
    ', "\n"; if ($missing_shipping eq "yes") { print ' Shipping Methods:', "\n"; } else { print ' Shipping Methods:', "\n"; } print "
    \n"; $count = 1; while ($count < 13) { unless ( $config{"sname$count"} eq "" ){ if ($in{'ship'} eq "$count") { if ( $config{"stype$count"} =~ /pero/ ) { print ' ', $config{"sname$count"}, ' (', $config{"scost$count"}, ' per order)
    ', "\n"; } if ( $config{"stype$count"} =~ /peri/ ) { print ' ', $config{"sname$count"}, ' (', $config{"scost$count"}, ' per item)
    ', "\n"; } if ( $config{"stype$count"} =~ /perp/ ) { print ' ', $config{"sname$count"}, ' (', $config{"scost$count"}, 'percent of order)
    ', "\n"; } } else { if ( $config{"stype$count"} =~ /pero/ ) { print ' ', $config{"sname$count"}, ' (', $config{"scost$count"}, ' per order)
    ', "\n"; } if ( $config{"stype$count"} =~ /peri/ ) { print ' ', $config{"sname$count"}, ' (', $config{"scost$count"}, ' per item)
    ', "\n"; } if ( $config{"stype$count"} =~ /perp/ ) { print ' ', $config{"sname$count"}, ' (', $config{"scost$count"}, 'percent of order)
    ', "\n"; } } } $count++; } print "
    \n"; } print ' ', "\n"; print ' ', "\n"; print ' ', "\n"; print ' ', "\n"; print ' ', "\n"; print " \n \n \n"; print "
    \n \n
    \n
    \n\n"; } } sub sendmail { open(S, '| /usr/sbin/sendmail -t'); $config{'orders'} =~ tr/\n//d; print S 'To: ', $config{'orders'}, "\r\n"; if ( $in{'email'} eq "" ) { print S "From: Unknown\r\n"; } else { print S "From: $in{'name'} <$in{'email'}>\r\n"; } print S "Subject: EZ-ECart - Order $orderid \r\n"; print S "Content-type: text/html\n\n"; print S "\n" ; print S "Order Information:\n"; print S '', "\n"; print S " \n \n \n \n \n \n"; print S " \n \n \n \n \n \n"; if ($in{'code'} ne "") { undef $count; $count = 1; while ($count <= 12) { open (CFG, "/home/ez-e/ecommerce/accounts/$in{'shop'}/$in{'shop'}.cart.cfg"); open (CFG_OUT, ">/ecommerce/accounts/$in{'shop'}/$in{'shop'}.cart.cfg.tmp"); while () { @cfg = split("=="); @cfg[1] =~ tr/\cM//d; if (@cfg[0] eq "puse$count") { $newval = @cfg[1] - 1; print CFG_OUT "@cfg[0]==$newval==\n"; } else { print CFG_OUT "@cfg[0]==@cfg[1]==\n"; } } close CFG; close CFG_OUT; if ($in{'code'} eq $config{"pname$count"}) { $ptype = $config{"ptype$count"}; $pcost = $config{"pcost$count"}; $premark = $config{"premark$count"}; } $count++; } system ("mv /var/local/ecommerce/accounts/$in{'shop'}/$in{'shop'}.cart.cfg.tmp /var/local/ecommerce/accounts/$in{'shop'}/$in{'shop'}.cart.cfg"); undef $count; $count = 13; while ($count <= 20) { open (CODE, "/home/ez-e/ecommerce/accounts/$in{'shop'}/$in{'shop'}.cart.pname$count"); open (CODE_OUT, ">/home/ez-e/ecommerce/accounts/$in{'shop'}/$in{'shop'}.cart.pname$count.tmp"); while () { @code = split("=="); if ($in{'code'} eq @code[0]) { $ptype = $config{"ptype$count"}; $pcost = $config{"pcost$count"}; $premark = $config{"premark$count"}; } print CODE_OUT "@code[0]==\n" unless ($in{'code'} eq @code[0]); } close CODE; close CODE_OUT; system ("mv /home/ez-e/ecommerce/accounts/$in{'shop'}/$in{'shop'}.cart.pname$count.tmp /home/ez-e/ecommerce/accounts/$in{'shop'}/$in{'shop'}.cart.pname$count"); $count++; } } undef $count; $total = 0; undef $items; undef $sub_total; open (ID_CACHE_IN, "$prefix/$cache/$in{'cookie'}"); while () { @cache = split("\t", $_, 9999); if (@cache[0] =~ /$masquerade/) { @cache[3] =~ tr/\n//d; undef $product_total; $product_total = @cache[3] * @cache[2]; print S " \n \n \n \n \n \n \n \n"; $sub_total = $sub_total + $product_total; $items++; } } close CART_IP; print S " \n \n \n \n \n"; print S " \n \n \n \n \n", $sub_total; } if (@country[3] eq "S") { printf S " \n \n \n", $sub_total; } } } close COUNTRY; if ($ptype eq "opo") { print S " \n \n \n \n \n", $pcost; } if (@country[3] eq "S") { printf S " -%.2f@country[2]\n \n \n", $pcost; } } } close COUNTRY; $sub_total = $sub_total - $pcost; } if ($ptype eq "poo") { print S " \n \n \n \n \n", $pdeduct; } if (@country[3] eq "S") { printf S " -%.2f@country[2]\n \n \n", $pdeduct; } } } close COUNTRY; $sub_total = $sub_total - $pdeduct; } if ($sub_total < 0) { $sub_total = 0; } if ( $config{'state'} eq $in{'state'} ) { $tax = (($sub_total) * ($config{'tax'} / 100)); print S " \n \n \n \n \n"; $total = $sub_total; } else { open(COUNTRY, "$prefix/data/country.dat"); while(){ @country = split("\t"); if (@country[0] eq $config{'country'}) { if (@country[3] eq "P") { printf S " @country[2]%.2f\n \n \n", $tax; } if (@country[3] eq "S") { printf S " %.2f@country[2]\n \n \n", $tax; } } } close COUNTRY; $total = $sub_total + $tax; } } else { $total = $sub_total; } if ($config{'ship'} ne "no") { if ( $in{'ship'} =~ "1" ) { $shipname = $config{'sname1'}; if ( $config{'stype1'} =~ /pero/ ) { $totalship = $config{'scost1'}; } if ( $config{'stype1'} =~ /peri/ ) { $totalship = ($items * $config{'scost1'}); } if ( $config{'stype1'} =~ /perp/ ) { $totalship = ($sub_total * ($config{'scost1'} / 100)); } } if ( $in{'ship'} =~ "2" ) { $shipname = $config{'sname2'}; if ( $config{'stype2'} =~ /pero/ ) { $totalship = $config{'scost2'}; } if ( $config{'stype2'} =~ /peri/ ) { $totalship = ($items * $config{'scost2'}); } if ( $config{'stype2'} =~ /perp/ ) { $totalship = ($sub_total * ($config{'scost2'} / 100)); } } if ( $in{'ship'} =~ "3" ) { $shipname = $config{'sname3'}; if ( $config{'stype3'} =~ /pero/ ) { $totalship = $config{'scost3'}; } if ( $config{'stype3'} =~ /peri/ ) { $totalship = ($items * $config{'scost3'}); } if ( $config{'stype3'} =~ /perp/ ) { $totalship = ($sub_total * ($config{'scost3'} / 100)); } } if ( $in{'ship'} =~ "4" ) { $shipname = $config{'sname4'}; if ( $config{'stype4'} =~ /pero/ ) { $totalship = $config{'scost4'}; } if ( $config{'stype4'} =~ /peri/ ) { $totalship = ($items * $config{'scost4'}); } if ( $config{'stype4'} =~ /perp/ ) { $totalship = ($sub_total * ($config{'scost4'} / 100)); } } if ( $in{'ship'} =~ "5" ) { $shipname = $config{'sname5'}; if ( $config{'stype5'} =~ /pero/ ) { $totalship = $config{'scost5'}; } if ( $config{'stype5'} =~ /peri/ ) { $totalship = ($items * $config{'scost5'}); } if ( $config{'stype5'} =~ /perp/ ) { $totalship = ($sub_total * ($config{'scost5'} / 100)); } } if ( $in{'ship'} =~ "6" ) { $shipname = $config{'sname6'}; if ( $config{'stype6'} =~ /pero/ ) { $totalship = $config{'scost6'}; } if ( $config{'stype6'} =~ /peri/ ) { $totalship = ($items * $config{'scost6'}); } if ( $config{'stype6'} =~ /perp/ ) { $totalship = ($sub_total * ($config{'scost6'} / 100)); } } if ( $in{'ship'} =~ "7" ) { $shipname = $config{'sname7'}; if ( $config{'stype7'} =~ /pero/ ) { $totalship = $config{'scost7'}; } if ( $config{'stype7'} =~ /peri/ ) { $totalship = ($items * $config{'scost7'}); } if ( $config{'stype7'} =~ /perp/ ) { $totalship = ($sub_total * ($config{'scost7'} / 100)); } } if ( $in{'ship'} =~ "8" ) { $shipname = $config{'sname8'}; if ( $config{'stype8'} =~ /pero/ ) { $totalship = $config{'scost8'}; } if ( $config{'stype8'} =~ /peri/ ) { $totalship = ($items * $config{'scost8'}); } if ( $config{'stype8'} =~ /perp/ ) { $totalship = ($sub_total * ($config{'scost8'} / 100)); } } if ( $in{'ship'} =~ "9" ) { $shipname = $config{'sname9'}; if ( $config{'stype9'} =~ /pero/ ) { $totalship = $config{'scost9'}; } if ( $config{'stype9'} =~ /peri/ ) { $totalship = ($items * $config{'scost9'}); } if ( $config{'stype9'} =~ /perp/ ) { $totalship = ($sub_total * ($config{'scost9'} / 100)); } } if ( $in{'ship'} =~ "10" ) { $shipname = $config{'sname10'}; if ( $config{'stype10'} =~ /pero/ ) { $totalship = $config{'scost10'}; } if ( $config{'stype10'} =~ /peri/ ) { $totalship = ($items * $config{'scost10'}); } if ( $config{'stype10'} =~ /perp/ ) { $totalship = ($sub_total * ($config{'scost10'} / 100)); } } if ( $in{'ship'} =~ "11" ) { $shipname = $config{'sname11'}; if ( $config{'stype11'} =~ /pero/ ) { $totalship = $config{'scost11'}; } if ( $config{'stype11'} =~ /peri/ ) { $totalship = ($items * $config{'scost11'}); } if ( $config{'stype11'} =~ /perp/ ) { $totalship = ($sub_total * ($config{'scost11'} / 100)); } } if ( $in{'ship'} =~ "12" ) { $shipname = $config{'sname12'}; if ( $config{'stype12'} =~ /pero/ ) { $totalship = $config{'scost12'}; } if ( $config{'stype12'} =~ /peri/ ) { $totalship = ($items * $config{'scost12'}); } if ( $config{'stype12'} =~ /perp/ ) { $totalship = ($sub_total * ($config{'scost12'} / 100)); } } print S " \n \n \n \n \n"; $final_total = $total; } else { open(COUNTRY, "$prefix/data/country.dat"); while(){ @country = split("\t"); if (@country[0] eq $config{'country'}) { if (@country[3] eq "P") { printf S " @country[2]%.2f\n \n \n", $totalship; } if (@country[3] eq "S") { printf S " %.2f@country[2]\n \n \n", $totalship; } } } close COUNTRY; $final_total = $total + $totalship; } } print S " \n \n \n \n \n", $final_total; } if (@country[3] eq "S") { printf S " %.2f@country[2]\n \n \n", $final_total; } } } close COUNTRY; print S "
    \n Product:\n"; print S " \n Qty:\n"; print S " \n Price:\n"; print S " \n Total:\n
    \n ------------------------------------\n"; print S " \n ----\n"; print S " \n ------------------------\n"; print S " \n -------\n
    \n @cache[1]\ \ \n"; print S " \n @cache[3]\n"; open(COUNTRY, "$prefix/data/country.dat"); while(){ @country = split("\t"); if (@country[0] eq $config{'country'}) { open(CURRENCY, "$prefix/data/currency.data"); while(){ @currency = split("\t"); if (@currency[0] eq @country[1]) { $currency = @currency[1]; } } if (@country[3] eq "P") { printf S " \n @country[2]%.2f\n", @cache[2]; printf S " \n @country[2]%.2f\n", $product_total; } if (@country[3] eq "S") { printf S " \n %.2f@country[2]\n", @cache[2]; printf S " \n %.2f@country[2]\n", $product_total; } } } close COUNTRY; print S "
    \n \n"; print S " ------------------------\n \n"; print S " -------\n
    \n \n Sub Total:\n"; open(COUNTRY, "$prefix/data/country.dat"); while(){ @country = split("\t"); if (@country[0] eq $config{'country'}) { if (@country[3] eq "P") { printf S " \n @country[2]%.2f\n
    \n %.2f@country[2]\n
    \n \n Discount:\n \n"; open(COUNTRY, "$prefix/data/country.dat"); while(){ @country = split("\t"); if (@country[0] eq $config{'country'}) { if (@country[3] eq "P") { printf S " -@country[2]%.2f\n
    \n \n $pcost\% Discount:\n \n"; $pdeduct = ($pcost / 100) * $sub_total; open(COUNTRY, "$prefix/data/country.dat"); while(){ @country = split("\t"); if (@country[0] eq $config{'country'}) { if (@country[3] eq "P") { printf S " -@country[2]%.2f\n
    \n \n"; print S " $config{'state'}Tax:\n \n"; if ($ptype eq "ft") { print S " Free\n
    \n \n"; print S " $shipname Shipping:\n \n"; if ($ptype eq "fs") { print S " Free\n
    \n \n"; print S " Final Total:\n \n"; open(COUNTRY, "$prefix/data/country.dat"); while(){ @country = split("\t"); if (@country[0] eq $config{'country'}) { if (@country[3] eq "P") { printf S " @country[2]%.2f\n
    \n

    \n"; if ($in{'code'} ne "") { print S "Code $in{'code'} used.

  • "; } if ($in{'comment'} ne "") { print S "Comments:\n
    \n$in{'comment'}\n

    \n"; } print S '', "\n"; if ($in{'ship_same'} eq "yes") { print S " \n \n \n"; print S " \n \n \n"; print S " \n \n \n"; print S " \n \n \n"; print S " \n \n \n"; print S " \n \n \n"; print S " \n \n \n"; print S " \n \n \n"; } else{ print S " \n \n \n \n"; print S " \n \n \n \n"; print S " \n \n \n \n"; print S " \n \n \n \n"; print S " \n \n \n \n"; print S " \n \n \n \n"; print S " \n \n \n \n"; print S " \n \n \n \n"; } print S "
    \n Billing & Shipping Information:\n"; print S "
    \n -----------------------------------------\n"; print S "
    \n $in{'name'}\n"; print S "
    \n $in{'addr1'}\n"; print S "
    \n $in{'addr2'}\n"; print S "
    \n $in{'city'}, $in{'state'} $in{'zip'}, $in{'country'}\n"; print S "
    \n $in{'phone'}\n"; print S "
    \n $in{'email'}\n"; print S "
    \n Billing Information:\n"; print S " \n Shipping Information:\n"; print S "
    \n -------------------------------------\n"; print S " \n ------------------------------------\n"; print S "
    \n $in{'name'}\n"; print S " \n $in{'name2'}\n"; print S "
    \n $in{'addr1'}\n"; print S " \n $in{'addr12'}\n"; print S "
    \n $in{'addr2'}\n"; print S " \n $in{'addr22'}\n"; print S "
    \n $in{'city'}, $in{'state'} $in{'zip'}, $in{'country'}\n"; print S " \n $in{'city2'}, $in{'state2'} $in{'zip2'}, $in{'country2'}\n"; print S "
    \n $in{'phone'}\n"; print S " \n"; print S "
    \n $in{'email'}\n"; print S " \n"; print S "
    \n

    \n"; $ip = remote_addr; print S "This order was placed on: ", `date`, "by $ip

    \n" ; print S "Payment Information:\n
    \n"; print S ""; print S " \n \n \n"; print S " \n \n \n \n"; print S " \n \n \n \n"; $in{'card'} =~ s/ //g; $in{'card'} =~ s/-//g; if ( length($in{'card'}) == "13") { $card1 = substr($in{'card'},0,3); $card2 = substr($in{'card'},3,3); $card3 = substr($in{'card'},6,3); $card4 = substr($in{'card'},9,4); $card = "$card1-$card2-$card3-$card4"; } if ( length($in{'card'}) == "15") { $card1 = substr($in{'card'},0,4); $card2 = substr($in{'card'},4,6); $card3 = substr($in{'card'},10,5); $card = "$card1-$card2-$card3"; } if ( length($in{'card'}) == "16") { $card1 = substr($in{'card'},0,4); $card2 = substr($in{'card'},4,4); $card3 = substr($in{'card'},8,4); $card4 = substr($in{'card'},12,4); $card = "$card1-$card2-$card3-$card4"; } print S " \n \n \n \n"; print S " \n \n \n \n"; print S " \n \n \n"; print S " \n \n \n"; print S "
    \n -------------------------------------\n
    \n Name:\n \n $in{'name3'}\n
    \n Method:\n \n $in{'payment'}\n
    \n Card Number:\n \n $card\n
    \n Card Code:\n \n $in{'card_code'}\n
    \n Exp. Date:\n \n $in{'exp_month'}/$in{'exp_year'}\n \n
    \n Response:\n \n $card_error\n \n
    \n

    "; close S; } sub orderconfirm { if ($in{'email'} ne "") { $config{'message5'} =~ s/:ORDERID:/$orderid/g; open(S, '| /usr/sbin/sendmail -t'); $orders =~ tr/\n//d; print S "To: $in{'email'}\n"; print S "From: $config{'company'}<$config{'email'}>\n"; if ($config{'orderid'} eq "yes") { print S "Subject: $config{'company'} - Order: $orderid\n"; } else { print S "Subject: $config{'company'} Order\n"; } print S "Content-type: text/html\n\n"; print S "$config{'message5'}

    \n\n Your Order ID is: $orderid"; close S; } } sub ccverify { $cardnumber = $in{'card'}; # Remove any spaces or dashes in card number $cardnumber =~ s/ //g; $cardnumber =~ s/-//g; $length = length($cardnumber); # Make sure that only numbers exist if (!($cardnumber =~ /^[0-9]*$/)) { $bad_number = "yes"; } # Verify correct length for each card type if ($in{'payment'} eq "VISA") { &vlen; } if ($in{'payment'} eq "Master Card") { &mclen; } if ($in{'payment'} eq "American Express") { &alen; } if ($in{'payment'} eq "Discover/Novus") { &nlen; } sub vlen { $bad_number = yes unless (($length == 13) || ($length == 16)); $nonmatching_number = "yes" unless (substr($cardnumber,0,1) == "4"); } sub mclen { $bad_number = "yes" unless ($length == 16); $nonmatching_number = "yes" unless (substr($cardnumber,0,1) == "5"); } sub alen { $bad_number = "yes" unless ($length == 15); $nonmatching_number = "yes" unless (substr($cardnumber,0,2) == "37"); } sub nlen { $bad_number = "yes" unless ($length == 16); $nonmatching_number = "yes" unless (substr($cardnumber,0,1) == "6"); } # Now Verify via Mod 10 for each one if ($in{'payment'} eq "VISA") { &vver; } if ($in{'payment'} eq "Master Card") { &ver16; } if ($in{'payment'} eq "American Express") { &ver15; } if ($in{'payment'} eq "Discover/Novus") { &ver16; } # pick one for Visa sub vver { if ($length == 13) { &ver13; } if ($length == 16) { &ver16; } } # For 13 digit cards sub ver13 { $cc0 = substr($cardnumber,0,1); $cc1 = substr($cardnumber,1,1); $cc2 = substr($cardnumber,2,1); $cc3 = substr($cardnumber,3,1); $cc4 = substr($cardnumber,4,1); $cc5 = substr($cardnumber,5,1); $cc6 = substr($cardnumber,6,1); $cc7 = substr($cardnumber,7,1); $cc8 = substr($cardnumber,8,1); $cc9 = substr($cardnumber,9,1); $cc10 = substr($cardnumber,10,1); $cc11 = substr($cardnumber,11,1); $cc12 = substr($cardnumber,12,1); $cc1a = $cc1 * 2; $cc3a = $cc3 * 2; $cc5a = $cc5 * 2; $cc7a = $cc7 * 2; $cc9a = $cc9 * 2; $cc11a = $cc11 * 2; if ($cc1a >= 10) { $cc1b = substr($cc1a,0,1); $cc1c = substr($cc1a,1,1); $cc1 = $cc1b+$cc1c; } else { $cc1 = $cc1a; } if ($cc3a >= 10) { $cc3b = substr($cc3a,0,1); $cc3c = substr($cc3a,1,1); $cc3 = $cc3b+$cc3c; } else { $cc3 = $cc3a; } if ($cc5a >= 10) { $cc5b = substr($cc5a,0,1); $cc5c = substr($cc5a,1,1); $cc5 = $cc5b+$cc5c; } else { $cc5 = $cc5a; } if ($cc7a >= 10) { $cc7b = substr($cc7a,0,1); $cc7c = substr($cc7a,1,1); $cc7 = $cc7b+$cc7c; } else { $cc7 = $cc7a; } if ($cc9a >= 10) { $cc9b = substr($cc9a,0,1); $cc9c = substr($cc9a,1,1); $cc9 = $cc9b+$cc9c; } else { $cc9 = $cc9a; } if ($cc11a >= 10) { $cc11b = substr($cc11a,0,1); $cc11c = substr($cc11a,1,1); $cc11 = $cc11b+$cc11c; } else { $cc11 = $cc11a; } $val = $cc0+$cc1+$cc2+$cc3+$cc4+$cc5+$cc6+$cc7+$cc8+$cc9+$cc10+$cc11+$cc12; if (substr($val,1,1) !=0 ) { $bad_number = "yes"; } } # For 16 digit cards sub ver16 { $cc0 = substr($cardnumber,0,1); $cc1 = substr($cardnumber,1,1); $cc2 = substr($cardnumber,2,1); $cc3 = substr($cardnumber,3,1); $cc4 = substr($cardnumber,4,1); $cc5 = substr($cardnumber,5,1); $cc6 = substr($cardnumber,6,1); $cc7 = substr($cardnumber,7,1); $cc8 = substr($cardnumber,8,1); $cc9 = substr($cardnumber,9,1); $cc10 = substr($cardnumber,10,1); $cc11 = substr($cardnumber,11,1); $cc12 = substr($cardnumber,12,1); $cc13 = substr($cardnumber,13,1); $cc14 = substr($cardnumber,14,1); $cc15 = substr($cardnumber,15,1); $cc0a = $cc0 * 2; $cc2a = $cc2 * 2; $cc4a = $cc4 * 2; $cc6a = $cc6 * 2; $cc8a = $cc8 * 2; $cc10a = $cc10 * 2; $cc12a = $cc12 * 2; $cc14a = $cc14 * 2; if ($cc0a >= 10) { $cc0b = substr($cc0a,0,1); $cc0c = substr($cc0a,1,1); $cc0 = $cc0b+$cc0c; } else { $cc0 = $cc0a; } if ($cc2a >= 10) { $cc2b = substr($cc2a,0,1); $cc2c = substr($cc2a,1,1); $cc2 = $cc2b+$cc2c; } else { $cc2 = $cc2a; } if ($cc4a >= 10) { $cc4b = substr($cc4a,0,1); $cc4c = substr($cc4a,1,1); $cc4 = $cc4b+$cc4c; } else { $cc4 = $cc4a; } if ($cc6a >= 10) { $cc6b = substr($cc6a,0,1); $cc6c = substr($cc6a,1,1); $cc6 = $cc6b+$cc6c; } else { $cc6 = $cc6a; } if ($cc8a >= 10) { $cc8b = substr($cc8a,0,1); $cc8c = substr($cc8a,1,1); $cc8 = $cc8b+$cc8c; } else { $cc8 = $cc8a; } if ($cc10a >= 10) { $cc10b = substr($cc10a,0,1); $cc10c = substr($cc10a,1,1); $cc10 = $cc10b+$cc10c; } else { $cc10 = $cc10a; } if ($cc12a >= 10) { $cc12b = substr($cc12a,0,1); $cc12c = substr($cc12a,1,1); $cc12 = $cc12b+$cc12c; } else { $cc12 = $cc12a; } if ($cc14a >= 10) { $cc14b = substr($cc14a,0,1); $cc14c = substr($cc14a,1,1); $cc14 = $cc14b+$cc14c; } else { $cc14 = $cc14a; } $val = $cc0+$cc1+$cc2+$cc3+$cc4+$cc5+$cc6+$cc7+$cc8+$cc9+$cc10+$cc11+$cc12+$cc13+$cc14+$cc15; if (substr($val,1,1) !=0 ) { $bad_number = "yes"; } } # For 15 digit (Amex) cards sub ver15 { $cc0 = substr($cardnumber,0,1); $cc1 = substr($cardnumber,1,1); $cc2 = substr($cardnumber,2,1); $cc3 = substr($cardnumber,3,1); $cc4 = substr($cardnumber,4,1); $cc5 = substr($cardnumber,5,1); $cc6 = substr($cardnumber,6,1); $cc7 = substr($cardnumber,7,1); $cc8 = substr($cardnumber,8,1); $cc9 = substr($cardnumber,9,1); $cc10 = substr($cardnumber,10,1); $cc11 = substr($cardnumber,11,1); $cc12 = substr($cardnumber,12,1); $cc13 = substr($cardnumber,13,1); $cc14 = substr($cardnumber,14,1); $cc1a = $cc1 * 2; $cc3a = $cc3 * 2; $cc5a = $cc5 * 2; $cc7a = $cc7 * 2; $cc9a = $cc9 * 2; $cc11a = $cc11 * 2; $cc13a = $cc13 * 2; if ($cc1a >= 10) { $cc1b = substr($cc1a,0,1); $cc1c = substr($cc1a,1,1); $cc1 = $cc1b+$cc1c; } else { $cc1 = $cc1a; } if ($cc3a >= 10) { $cc3b = substr($cc3a,0,1); $cc3c = substr($cc3a,1,1); $cc3 = $cc3b+$cc3c; } else { $cc3 = $cc3a; } if ($cc5a >= 10) { $cc5b = substr($cc5a,0,1); $cc5c = substr($cc5a,1,1); $cc5 = $cc5b+$cc5c; } else { $cc5 = $cc5a; } if ($cc7a >= 10) { $cc7b = substr($cc7a,0,1); $cc7c = substr($cc7a,1,1); $cc7 = $cc7b+$cc7c; } else { $cc7 = $cc7a; } if ($cc9a >= 10) { $cc9b = substr($cc9a,0,1); $cc9c = substr($cc9a,1,1); $cc9 = $cc9b+$cc9c; } else { $cc9 = $cc9a; } if ($cc11a >= 10) { $cc11b = substr($cc11a,0,1); $cc11c = substr($cc11a,1,1); $cc11 = $cc11b+$cc11c; } else { $cc11 = $cc11a; } if ($cc13a >= 10) { $cc13b = substr($cc13a,0,1); $cc13c = substr($cc13a,1,1); $cc13 = $cc13b+$cc13c; } else { $cc13 = $cc13a; } $val = $cc0+$cc1+$cc2+$cc3+$cc4+$cc5+$cc6+$cc7+$cc8+$cc9+$cc10+$cc11+$cc12+$cc13+$cc14; if (substr($val,1,1) !=0 ) { $bad_number = "yes"; } } } if ( $in{'type'} eq "review" ) { config("$in{'shop'}"); &ccverify; #undef $number; $number = 1; $month = `date +%m`; $year = `date +%Y`; $month =~ tr/"\n"//d; $year =~ tr/"\n"//d; while ($number < "13") { if ($in{'payment'} eq $config{"pay$number"} && $config{"req_pay$number"} eq "yes") { if ($in{'name3'} eq "") { $missing_message = "

  • Name\n"; $missing_payment = "yes"; } if ($in{'payment'} eq "") { $missing_message = "$missing_message
  • Payment method\n"; $missing_payment = "yes"; } if ($in{'card_code'} eq "") { $missing_message = "$missing_message
  • Card Code\n"; $missing_code = "yes"; } if ($in{'card'} eq "") { $missing_message = "$missing_message
  • Card number\n"; $missing_payment = "yes"; } if ($in{'exp_month'} eq "" && $in{'exp_year'} eq "") { $missing_message = "$missing_message
  • Exp. date\n"; $missing_payment = "yes"; } if ("$year$month" > "$in{'exp_year'}$in{'exp_month'}") { $wrong_exp = "yes"; } } $number++; } if ($missing_code eq "yes" || $missing_payment eq "yes" || $bad_number eq "yes" || $nonmatching_number eq "yes" || $wrong_exp eq "yes") { &total; } else { open (ID_CACHE_IN, "$prefix/$cache/$in{'cookie'}"); open (ID_CACHE_OUT, ">$prefix/$cache/$in{'cookie'}.sorted"); print ID_CACHE_OUT sort ; close ID_CACHE_IN; close ID_CACHE_OUT; system("mv $prefix/$cache/$in{'cookie'}.sorted $prefix/$cache/$in{'cookie'}"); print "\n\n"; print " EZ-ECart - Review Final Order - Step 4 of 4\n\n"; print '', "\n"; print "
    \n"; unless ($config{'www'} eq ""){ unless ($config{'company'} eq ""){ print '', $config{'company'}, '
    ', "\n"; } } if ($config{'www'} eq "") { unless ($config{'company'} eq ""){ print '', $config{'company'}, '
    ', "\n"; } } unless ( $config{'address1'} eq "" ){ print '', $config{'address1'}, '
    ', "\n"; } unless ( $config{'address2'} eq "" ){ print '', $config{'address2'}, '
    ', "\n"; } unless ( $config{'loc'} eq "" ){ print '', $config{'loc'}, '
    ', "\n"; } unless ( $config{'phone'} eq "" ){ print ' Phone: ', $config{'phone'}, '
    ', "\n"; } unless ( $config{'fax'} eq "" ){ print ' Fax: ', $config{'fax'}, '
    ', "\n"; } if ($in{'security'} eq "yes"){ print '
    ', "\n"; print ' ', "\n"; } else{ print '', "\n"; print ' ', "\n"; } print '

    '; &viewcartfinal; print "

    \n\n"; print " \n"; print ' \n"; print ' \n \n"; print " \n \n \n \n"; print " \n \n \n \n"; print " \n \n \n \n"; print " \n \n \n \n"; if ($in{'state'} eq "") { $in{'state'} = $in{'other'}; } if ($in{'state2'} eq "") { $in{'state2'} = $in{'other2'}; } print " \n \n \n \n"; print " \n \n \n \n"; print " \n \n \n \n"; print " \n \n \n \n"; print " \n \n \n \n"; print "
    ', "\n"; print ' Billing Information:', "\n"; print " ', "\n"; print ' Shipping Information:', "\n"; print "
    \n $in{'name'}\n \n $in{'name2'}\n
    \n $in{'addr1'}\n \n $in{'addr12'}\n
    \n $in{'addr2'}\n \n $in{'addr22'}\n
    \n $in{'city'}\n \n $in{'city2'}\n
    \n $in{'state'}\n \n $in{'state2'}\n
    \n $in{'zip'}\n \n $in{'zip2'}\n
    \n $in{'country'}\n \n $in{'country2'}\n
    \n $in{'phone'}\n \n
    \n $in{'email'}\n \n
    \n

    \n"; print '', "\n"; print " \n"; print ' \n \n"; print " \n \n \n \n"; print " \n \n \n \n"; print " \n \n \n \n"; print " \n \n \n \n"; print " \n \n \n \n"; print "
    ', "\n"; print ' Payment Information:', "\n"; print "
    \n Name:\n \n $in{'name3'}\n
    \n Method Of Payment:\n \n $in{'payment'}
    \n Card Number:\n \n $in{'card'}\n
    \n Card Code:\n \n $in{'card_code'}\n
    \n Exp. Date:\n \n $in{'exp_month'}/$in{'exp_year'}\n

    \n"; if ($in{'comment'} ne "") { print "

    \n \n"; print " \n \n \n"; print " \n \n \n"; print "
    \n Comments:\n
    \n $in{'comment'}\n
    \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 \n \n \n
    \n"; print "
    Print this page now for a copy of your order.
    \n"; print "

    \n"; print "\n"; } } if ($in{'type'} eq "order") { config("$in{'shop'}"); if ($config{'orderid'} eq "yes") { $date = `date +%Y%m%d`; $date =~ tr/" "//d; $date =~ tr/"\n"//d; $time = `date +%H%M`; $time =~ tr/" "//d; $time =~ tr/"\n"//d; $order_num = `cat $prefix/$configdir/ordernum`; open (ORDER_NUM, ">$prefix/$configdir/ordernum"); print ORDER_NUM $order_num + 1; close ORDER_NUM; $order_num =~ tr/" "//d; $order_num =~ tr/"\n"//d; $orderid = "$date-$time-$order_num"; } print "\n\n EZ-ECart - Order Sent\n\n"; print "\n
    \n"; unless ($config{'www'} eq ""){ unless ($config{'company'} eq ""){ print '', $config{'company'}, '
    ', "\n"; } } if ($config{'www'} eq "") { unless ($config{'company'} eq ""){ print "$config{'company'}\n
    \n"; } } unless ( $config{'address1'} eq "" ){ print "$config{'address1'}\n
    \n"; } unless ( $config{'address2'} eq "" ){ print "$config{'address2'}\n
    \n"; } unless ( $config{'loc'} eq "" ){ print "$config{'loc'}\n
    \n"; } unless ( $config{'phone'} eq "" ){ print "Phone: $config{'phone'}\n
    \n"; } unless ( $config{'fax'} eq "" ){ print "Fax: $config{'fax'}\n
    \n"; } unless ( $config{'message4'} eq "" ){ $config{'message4'} =~ s/:ORDERID:/$orderid/g; print ''. "\n"; if ($config{'orderid'} eq "yes") { print " \n \n \n \n"; print "
    \n \n
    \n $config{'message4'} Your Order ID is $orderid.\n
    \n"; } else{ print "
    \n \n
    \n $config{'message4'}\n
    \n"; } print "
    \n
    \n

    \n"; } &viewcartfinal; print 'Please Go here To return to ', $config{'company'}, '..', "\n"; print "\n\n"; &process_card if ($in{'shop'} =~ /stamp\-search|disney\-stamps|princess\-diana-stamps|mounts|collecting\-supplies/); &sendmail; eval {&orderconfirm;}; open (ID_CACHE_IN, "$prefix/$cache/$in{'cookie'}"); system("touch $prefix/$cache/$in{'cookie'}.tmp"); open (ID_CACHE_OUT, ">$prefix/$cache/$in{'cookie'}.tmp"); while () { @cache = split("\t", $_, 9999); unless ( @cache[0] =~ /$masquerade/ ){ print ID_CACHE_OUT; } } close(ID_CACHE_IN); close(ID_CACHE_OUT); system ("mv $prefix/$cache/$in{'cookie'}.tmp $prefix/$cache/$in{'cookie'}"); } if ( $in{'type'} eq "end_continue") { config("$in{'shop'}"); open (ID_CACHE_IN, "$prefix/$cache/$in{'cookie'}"); system("touch $prefix/$cache/$in{'cookie'}.tmp"); open (ID_CACHE_OUT, ">$prefix/$cache/$in{'cookie'}.tmp"); while () { @cache = split("\t", $_, 9999); unless ( @cache[0] =~ /$masquerade/ ){ print ID_CACHE_OUT; } } close(ID_CACHE_IN); close(ID_CACHE_OUT); system ("mv $prefix/$cache/$in{'cookie'}.tmp $prefix/$cache/$in{'cookie'}"); print "\n\n"; print " \n"; print "\n"; } sub process_card { if ($in{'payment'} !~ /VISA|Master\sCard|American\sExpress|Discover\/Novus/) { return; } use E::Transaction::AuthorizeNet; my $trans = E::Transaction::AuthorizeNet->new; $trans->invoice_num($orderid); $trans->login('n5a89tz5q'); $trans->card_number($in{'card'}); $trans->card_exp($in{'exp_month'}.'/'.$in{'exp_year'}); $trans->card_code($in{'card_code'}); $trans->zip($in{'zip'}); $trans->address($in{'addr1'}." ".$in{'addr2'}); $trans->city($in{'city'}); $trans->country($in{'country'}); $trans->state($in{'other'} || $in{'state'}); $trans->amount(sprintf("%.2f",$final_total)); if ($in{'name3'} =~ /(.*)\s+([\w\-]+)$/) { $trans->first_name($1); $trans->last_name($2); } $trans->process; $card_error = $trans->error; warn "card error is: $card_error"; }