⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cybercart.pl

📁 CyberCart Pro Internet Commerce System 3.042 很好的商业购物程序.Good Shopping Cart, Can be used for Multipl
💻 PL
📖 第 1 页 / 共 5 页
字号:

  
  $post_query{$name} = $value;
  
}

}
# End sub decode2
#----------------------------------------------------#

sub discount {
# Calculates an order discount.
if ($discount eq "fixed_table") {
  # discount is fixed abount for a range
  foreach $range (keys %discount_table) {
    ($low,$high) = split(/-/,$range);
    if ($grandtotal >= $low && $grandtotal < $high) {
      $dis = $discount_table{$range};
    }
  }
} elsif ($discount eq "percent_table") {
  # discount is a given percentage for ranges
  foreach $range (keys %discount_table) {
    ($low,$high) = split(/-/,$range);
    if ($grandtotal >= $low && $grandtotal < $high) {
      $dis = $discount_table{$range} * $grandtotal;
    }
  }
} elsif ($discount eq "percent") {
  $dis = $discount_percent * $grandtotal;
}

# make discount a negative number
$dis *= -1;
}
#-----------------------------------------------------------------------------

sub enter {
# Routine to log where link is coming from for link connection type deal.

# &debug;
$ENV{'PATH_INFO'} =~ s/^([\w\:\\\_]*cybercart\.pl)//;
$ENV{'PATH_INFO'} =~ s/^\///;
($merid,$client) = split(/\:/,$ENV{'PATH_INFO'});

$post_query{'merchant'} = $merid;

&init_var;

$mid = $client;
print "Set-Cookie: MID=$mid \r\n";
print "Content-type: text/html\n\n";
print qq[
<META HTTP-EQUIV="Refresh" CONTENT="0;URL=$home_page">];
print "<br>";
exit;
}



sub error {
# Print errors to web page instead of stdout
local($error_message) = @_;
# Print message indicating that there is an error
if (!$header) {
  # print header if one hasn't been printed
  &header;
}
print "<h1>CyberCart Error</h1>\n";
print "Please contact the webmaster of this site and let them know of ";
print "that the following error occurred:<p>$error_message<p>\n";
&return_page;

if ($mail_error) {
  ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
  $mon += 1;
  $Date = $mon . "-" . $mday . "-" . $year;

  $mail_err = $log_dir . "\\$session_id" . ".err";

  open(MAILERR, ">$mail_err");
  print MAILERR "To: $recipient\n";
  print MAILERR "From: $recipient\n";
  print MAILERR "Subject: CyberCart Error\n\n";
  print MAILERR "CyberCart Error: $error_message\n\n";
  print MAILERR "Script: $0\n";
  print MAILERR "URL: $ENV{'HTTP_REFERER'}\n";
  print MAILERR "Server: $ENV{'SERVER_SOFTWARE'}\n";
  print MAILERR "Date: $Date\n";
  print MAILERR "Browser: $ENV{'HTTP_USER_AGENT'}\n";
  print MAILERR "IP: $ENV{'REMOTE_ADDR'}\n";
  print MAILERR "Session_id: $session_id\n";
  close(MAILERR);
  $mailerr="$mail_loc $mail_err \-t $recipient \-s CyberCart -server $mail_server";
  system("$mailerr");
  unlink($mailerr);
}

exit;
}
# End sub error
#----------------------------------------------------#

sub footer {
# Print footer at bottom of script generated pages
print "$footer";
}
# End sub footer
#----------------------------------------------------#


sub get_status {
# Must have java script in place to use this feature.  Allows customers
# to check on the status of their order.

$order_number = $post_query{'ordernum'};
$customer = $post_query{'customer'};

open(STATUS, "$status_file");
while (<STATUS>) {
  if ($_ =~ m/$order_number/i && $_ =~ m/$customer/i) {
    ($ordern,$name,$date_received,$order_status) = split(/::/);
    $of = 1;
    last;
  }
}
if (!$of) {
  $order_status = "Order Not found";
  $date_received = " ";
}
$of = 0;
return ($order_status,$date_received);
}
#----------------------------------------------------------------------------

sub header {
# Print standard header and title
$header = 1;

# Flush the buffer
local($oldbar) = $|;
$cfh = select(STDOUT);
$| = 1;

# print the header
print "Content-type: text/html\n\n";

# turn buffer flushing off
$| = $oldbar;
select($cfh);

# Refresh if $showorder is not set
if ($action eq "add" && $redirect) {
  &header;
  print qq[<META HTTP-EQUIV="Refresh" CONTENT="$redirect;URL=$page_name">];
}

print "<HTML><HEAD><TITLE>$company</TITLE></HEAD>\n";
# Set the body attributes

$body = "<BODY ";
if ($bodyback ne "") {
  $body .= "background = \"$bodyback\" ";
}
if ($bodycolor ne "") {
  $body .= "bgcolor=\"$bodycolor\" ";
} else {
  $body .= "bgcolor=\"\#FFFFFF\" ";
}
if ($bodytext ne "") {
  $body .= "text=\"$bodytext\" ";
}
if ($bodylink ne "") {
  $body .= "link=\"$bodylink\" ";
}
if ($bodyvlink ne "") {
  $body .= "vlink=\"$bodyvlink\" ";
}
if ($bodyalink ne "") {
  $body .= "alink=\"$bodyalink\" ";
}
$body .= ">";
print "$body\n";


print "<a name=\"top\"></a>";
print "<center><table><tr valign=top align=center>";
if ($titlepict) {
  if ($post_query{'processing'} eq "secure") {
    if ($titlepict =~ m/https:/) {
       print "<td valign=top><img src=\"$titlepict\"></td>";
    } 
  } else {
    print "<td valign=top><img src=\"$titlepict\"></td>";
  }
  print "<td><font size=+1>$company</font><br>";
  print "$address<br>$phone<br>";
  if ($fax) {
    print "$fax<br>";
  }
  print "$recipient<br>";
  if ($addition_header) {
    print "$additional_header";
  }
  print "</td></tr></table></center>"
} else {
  print qq(
  <td>
  <font size=+1>$company</font><br>
  $address<br>
  $phone<br>);
  if ($fax) {
    print "$fax<br>\n";
  }
  print "$recipient<br>";
  if ($additional_header) {
    print "$additional_header";
  }
  print "</td></tr></table></center>";
}

}
# End sub header
#----------------------------------------------------#

sub init_var {
# Read the merchant file.  This should be in the root directory
$merchant_data = $merchant_data . "\\$post_query{'merchant'}\.pl";

if (-s $merchant_data) {
  require("$merchant_data");
} else {
  &init_error;
}
}

# End sub init_var
#----------------------------------------------------#



sub init_error {

# Error routine to make sure merchant files are loaded
if (!$header) {
  &header;
}

print "<h1>CyberCart Installation Error</h1>\n";

if (!$post_query{'merchant'}) {
  print qq( 
  There is no hidden variable for the merchant in the form submitted.  
  Each form must have the following code to point to the correct 
  merchant file:\<br>\n
  &lt;input type=hidden name=merchant value=merchant_name&gt;<br>
  where merchant_name is the name of the merchant data file.  Make
  sure this is after the &lt;form ...&gt; tag.<br>\n);
} else {
  print qq(
  The script cannot find the merchant data file called 
  $post_query{'merchant'} with the path being $merchant_data.  
  Make sure this file exists and is in the correct directory.<br>\n);
}
exit(0);
}
#------------------------------------------------------------------------


sub invoice {

# reformat expiration date
$post_query{'expdate'}= $post_query{'exp_month'} . "/$post_query{'exp_year'}";

# Check creditcard
if (($post_query{'cardtype'} =~ m/american express/i || 
     $post_query{'cardtype'} =~ m/visa/i ||
     $post_query{'cardtype'} =~ m/mastercard/i ||
     $post_query{'cardtype'} =~ m/diner/i ||
     $post_query{'cardtype'} =~ m/discover/i ) && -s $ccmod && $secure) {

     &credit_card_check;
}    

if (!$post_query{'cardtype'}) {

print qq[
<center>
<table bgcolor=$Table_Body_Color cellpadding=10 border=1><tr><td>
<h1>No Payment Method Indicated</h1>
In order to process, you must indicate your payment method.
</td>
</tr>
</table>
</center>
<p>
];
&billing;
}  
  
if ( $post_query{'processing'} ne "fax" &&
	($post_query{'cardtype'} =~ m/american express/i ||
     $post_query{'cardtype'} =~ m/visa/i ||
     $post_query{'cardtype'} =~ m/mastercard/i ||
     $post_query{'cardtype'} =~ m/diner/i ||
     $post_query{'cardtype'} =~ m/discover/i ) 
     &&
     ($post_query{'expdate'} eq "" || 
      $post_query{'CCN'} eq "" ||
      $post_query{'card_name'} eq "")) {

print qq[
<center>
<table bgcolor=$Table_Body_Color cellpadding=10 border=1><tr><td>
<h1>Insufficient Credit Card Information</h1>
In order to process your order using a credit card, you must
provide the Card Name, Card Number, Expiration Data, and the name 
on the card.
</td>
</tr>
</table>
</center>
<p>
];
&billing;
}

if ($post_query{'cardtype'} eq "onlinecheck") {
  &online_check_init;
  &online_check_info;
}


# subroutine to print an off-line invoice that the customer could print out and fax
print "<p>";
if ($post_query{'billing'} ne "1" && !$no_billing_address) { 
  print qq( 
  <center> 
  <table border=1 width=$Table_width cellspacing=0 cellpadding=10 bgcolor=$Table_Body_Color> 
  <tr> 
  <td><b>Bill To:</b><br>
  $post_query{'ornameb'}<br> 
  $post_query{'streetb'}<br> 
  ); 
  if ($post_query{'street2b'}) { 
    print "$post_query{'street2b'}<br>";
  }
  print qq( 
  $post_query{'cityb'},$post_query{'stateb'},$post_query{'zipb'}</br>
  $post_query{'phoneb'}<br>
  $post_query{'emailb'}<br>
  </td>
  <td><b>Ship To:</b><br>
  $post_query{'orname'}<br>
  $post_query{'street'}<br>
  );
  if ($post_query{'street2'}) {
    print "$post_query{'street2'}<br>";
  }
  print qq(
  $post_query{'city'},$post_query{'state'},$post_query{'zip'}</br>
  $post_query{'phone'}<br>
  $post_query{'email'}<br>
  </tr>
  </table> 
  <p> ); 
} else {
  print qq( 
  <center> 
  <table width=$Table_width border=1 cellpadding=10 bgcolor=$Table_Body_Color> 
  <tr><td> <b>Bill and Ship To:</b><br>
  $post_query{'orname'}<br> $post_query{'street'}<br> ); 
  if ($post_query{'street2'}) {
    print "$post_query{'street2'}<br>";
  }
  print qq(
  $post_query{'city'},$post_query{'state'},$post_query{'zip'}<br>
  $post_query{'phone'}<br>
  $post_query{'email'}
  </td></tr></table></center><p>
  );
}

&show_order;

if ($post_query{'processing'} eq "fax") {
  print qq(
  <center>
  <table width=$Table_width>
  <tr>
  <td>
  <pre>
  __ Check here for payment by check. 
     Note: We will send your order after 
     receiving your check.

  Credit Card Information:

  Card _________________________________

  Number________________________________

  Exp. Date ____________________________

  Name on Card _________________________

  Signature ____________________________
  </pre>
  </td>
  <td valign=top>
  <b>
  NOTE: Use your browser to print a copy of this order form, fill out the 
  Credit Card Information, and then either mail or fax it to us.
  </b>
  </td>
  </tr>
  </table>
  <p>
  );
  &return_page;
  print "</center>";
  &print_links;
  &footer;
  exit;

} elsif ($post_query{'CCN'}) {
  # Electronic billing with Credit Card
  print qq(
  <center>
  <table width=$Table_width cellpadding=10 border=1 bgcolor=$Table_Body_Color>
  <tr>
  <td>
  <font size=+1>Credit Card Information:</font><br>
  <b>Name:</b> $post_query{'cardtype'}<br>
  <b>Number:</b> $post_query{'CCN'}<br>
  <b>Exp. Date:</b> $post_query{'expdate'}<br>
  <b>Name on Card:</b> $post_query{'card_name'}<br>
  </td>
  <td valign=top>
  <b>NOTE: Use your browser to print out a copy of this order form for your
  records.  Then SUBMIT the order for electronic billing.</b>
  </td>
  </tr>
  </table>
  </center>
  );

} elsif ($post_query{'cardtype'} eq "Check") {
  # Electrontic billing with check
  print qq(
  <center>
  <table width=$Table_width cellspacing=0 cellpadding=10 border=1 bgcolor=$Table_Body_Color>
  <tr>
  <td>
  Payment by check.  <b>NOTE: Your order will be shipped when your check is 
  received.
  );
  if ($checks) {
    print "  Please make your check out to $checks.";
  }
  print qq(

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -