📄 cybercart.pl
字号:
<option value=ON>Ontario
<option value=PE>P.E.I.
<option value=PQ>Quebec
<option value=SK>Saskatchewan
<option value=YT>Yukon
</select>\n\n);
}
print "Zip or Postal Code:<input name=zip size=25 maxlength=256>\n\n";
print " Country:";
print "<select name=country><option selected>US\n";
unless ($no_world_shipping) {
for ($i = 0; $i < @countries; $i++) {
print "<option>$countries[$i]";
}
}
print "</select>\n";
print qq(
Phone:<input name=phone size=25 maxlength=256>\n
Email:<input name=email size=47 maxlength=256>\n);
if (%additional_fields) {
foreach $addit (keys %additional_fields) {
# split this up, to print form tag and selection message
($ty,$field) = split(/\|/,$additional_fields{$addit});
$padln = 18-length($ty);
$pad = " " x $padln;
if ($field =~ m/textarea/i) {
print "\n$pad$ty:\n";
$pad = " " x 19;
print "$pad$field";
} else {
print "\n$pad$ty:$field";
}
print "\n\n";
}
}
if (!$no_gift_message) {
print qq(
Gift Message: If order is a gift, enter message to attach here.\n
<textarea name="giftmessage" rows=8 cols=40 valign=top></textarea>\n);
}
if (!$no_billing_address) {
print qq(
<p><b>
<u>Billing Address:</u></b> <input type=checkbox name=billing value="1" checked> Same as Shipping Address\n<br>
Name:<input name=ornameb size=47 maxlength=256>\n
Street:<input name=streetb size=47 maxlength=256>\n
Street2:<input name=street2b size=47 maxlength=256>\n
City:<input name=cityb size=47 maxlength=256>\n);
if ($state_textbox) {
print "\n State or Province:<input name=stateb size=47 maxlength=256>\n\n";
} else {
print qq(\n State or Province:<select name=stateb>
<option value=NA>Not Applicable
<option value=AL>Alabama
<option value=AK>Alaska
<option value=AZ>Arizona
<option value=AR>Arkansas
<option value=CA>California
<option value=CO>Colorado
<option value=CT>Connecticut
<option value=DE>Delaware
<option value=DC>District of Columbia
<option value=FL>Florida
<option value=GA>Georgia
<option value=HI>Hawaii
<option value=ID>Idaho
<option value=IL>Illinois
<option value=IN>Indiana
<option value=IA>Iowa
<option value=KS>Kansas
<option value=KY>Kentucky
<option value=LA>Louisiana
<option value=ME>Maine
<option value=MD>Maryland
<option value=MA>Massachusetts
<option value=MI>Michigan
<option value=MN>Minnesota
<option value=MS>Mississippi
<option value=MO>Missouri
<option value=MT>Montana
<option value=NE>Nebraska
<option value=NV>Nevada
<option value=NH>New Hampshire
<option value=NJ>New Jersey
<option value=NM>New Mexico
<option value=NY>New York
<option value=NC>North Carolina
<option value=ND>North Dakota
<option value=OH>Ohio
<option value=OK>Oklahoma
<option value=OR>Oregon
<option value=PA>Pennsylvania
<option value=RI>Rhode Island
<option value=SC>South Carolina
<option value=SD>South Dakota
<option value=TN>Tennessee
<option value=TX>Texas
<option value=UT>Utah
<option value=VT>Vermont
<option value=VA>Virginia
<option value=WA>Washington
<option value=WV>West Virginia
<option value=WI>Wisconsin
<option value=WY>Wyoming
<option value=AB>Alberta
<option value=BC>British Columbia
<option value=MB>Manitoba
<option value=NB>New Brunswick
<option value=NF>Newfoundland
<option value=NT>NWT
<option value=NS>Nova Scotia
<option value=ON>Ontario
<option value=PE>P.E.I.
<option value=PQ>Quebec
<option value=SK>Saskatchewan
<option value=YT>Yukon
</select>\n
);
}
print "Zip or Postal Code:<input name=zipb size=25 maxlength=256>\n\n";
print " Country:";
print "<select name=countryb><option selected>US\n";
unless ($no_world_shipping) {
for ($i = 0; $i < @countries; $i++) {
print "<option>$countries[$i]";
}
}
print "</select>\n\n";
print " Phone:<input name=phoneb size=25 maxlength=256>\n\n";
print " Email:<input name=emailb size=47 maxlength=256>\n\n";
} # end billing address
print "<u><b>Order Comments:</b></u> Enter message to merchant here.\n\n";
print " <textarea name=comments cols=40 rows=8></textarea>\n";
if (%special_selections) {
print "\n<u><b>Special Options:</b></u>\n\n";
foreach $sel (keys %special_selections) {
# split this up, to print form tag and selection message
($ty,$special_sel) = split(/\|/,$special_selections{$sel});
print "$ty $special_sel\n\n";
}
}
print "</pre>";
print "<center>";
print "When you are done shopping and ready to submit your order, press\n";
print "this button.</center><p>\n";
printf "<INPUT TYPE=HIDDEN NAME=Total VALUE=\"%6.2f\">\n", $order_total;
print "<INPUT TYPE=HIDDEN NAME=action VALUE=\"ship\">";
# 11/25
print "<INPUT TYPE=HIDDEN NAME=discount value=$dis>\n";
print "<center>\n";
print "<input type=hidden name=processing value=$post_query{'processing'}>\n";
if ($button_continue) {
if ($post_query{'processing'} eq "secure") {
if ($button_clear =~ m/https:/) {
print "<INPUT TYPE=IMAGE SRC=$button_continue border=0>\n";
} else {
print "<INPUT TYPE=SUBMIT VALUE=\"Continue\">\n";
}
} else {
print "<INPUT TYPE=IMAGE SRC=$button_continue border=0>\n";
}
} else {
print "<INPUT TYPE=SUBMIT VALUE=\"Continue\">\n";
}
print "</center>\n";
print "</FORM>\n";
print "</td></table>\n";
print "</center><p>";
&print_links;
&footer;
exit;
}
# End sub place2
#----------------------------------------------------#
sub print_links {
#Prints out the links to other pages
#Put in the catalog data filename for each page
print "<center><h5>";
foreach $p (keys %pagelinks) {
$plink = $home_url . "$p";
print "<A href=$plink>[$pagelinks{$p}]</A>\n";
}
print "</center></h5>";
}
# End sub print_links
#----------------------------------------------------#
sub print_thanks {
#expire the current cookie so they have to get another one to order
# $session_id = $$ . $ENV{'REMOTE_ADDR'};
# $session_id =~ s/\.//g;
# $session_id = substr($session_id,0,8);
# Or use ip number:
#$session_id = $ENV{'REMOTE_ADDR'};
print "Set-Cookie: ID=1; path=/\n";
&header;
if (!$thankyou) {
print "<h1>Order Sent!</h1>\n";
print "Thank you for ordering from $company! ";
if ($success) {
print "<b>$success</b>";
}
print "You will receive an Email receipt shortly.<br><br>\n";
} else {
print "$thankyou";
if ($sucess) {
print "<b>$success</b>";
}
}
&return_page;
&print_links;
}
# End sub print_thanks
#----------------------------------------------------#
sub recalc {
# Recalculate order for changed quantities
open(OUTPUT, ">$order_file") || &error("Cant open $order_file in sub recalc");
foreach $key (keys %post_query) {
if ($key =~ m/quant/) {
($code, $gar) = split(/_/,$key);
$add_key = $code;
$quant_key = $code . "_quant";
$min_key = $code . "_min";
if ($post_query{$min_key}) {
if ($post_query{$key} < $post_query{$min_key}) {
$post_query{$key} = $post_query{$min_key};
}
}
$max_key = $code . "_max";
if ($post_query{$max_key}) {
if ($post_query{$key} > $post_query{$max_key}) {
$post_query{$key} = $post_query{$max_key};
}
}
if ($post_query{$key} > 0) {
$add_string = "";
$order_exist = 1;
($code,$items) = split(/--/,$code);
if ($price_file eq "none") {
$item_name = $code . "--$items" . "_name";
$add_string .= "$post_query{$item_name}:";
}
if ($post_query{$min_key} && $post_query{$max_key}) {
$add_string .= "$code:$post_query{$key}\!$post_query{$min_key}to$post_query{$max_key}:";
} elsif ($post_query{$min_key} && !$post_query{$max_key}) {
$add_string .= "$code:$post_query{$key}\!$post_query{$min_key}:";
} elsif ($post_query{$max_key} && !$post_query{$min_key}) {
$add_string .= "$code:$post_query{$key}\!0to$post_query{$max_key}:";
} else {
$add_string .= "$code:$post_query{$key}:";
}
$item_price = $code . "--$items" . "_price";
$add_string .= "$post_query{$item_price}:";
$item_hand = $code . "--$items" . "_handling";
$add_string .= "$post_query{$item_hand}:";
# New shipping routine for per item
$itemship = $code . "--$items" . "_itemship";
$add_string .= "$post_query{$itemship}:";
$item_weight = $code . "--$items" . "_weight";
$add_string .= "$post_query{$item_weight}:";
$item_prop1 = $code . "--$items" . "_prop1";
$item_prop2 = $code . "--$items" . "_prop2";
$item_prop3 = $cope . "--$items" . "_prop3";
$add_string .= "$post_query{$item_prop1}:";
$add_string .= "$post_query{$item_prop2}:";
$add_string .= "$post_query{$item_prop3}:";
$item_dlfile = $code . "--$items" . "_dlfile";
$add_string .= $post_query{$item_dlfile};
print (OUTPUT "$add_string\n");
}
}
}
close(OUTPUT);
if ($post_query{'last'} =~ m/view/) {
print "<CENTER><h1>View Current Order</h1></CENTER>\n";
&show_order;
&show_order2;
&footer;
} else {
&place2;
}
}
# End sub recalc
#----------------------------------------------------#
sub return_page {
# Prints a link to last page visited if available
if ($post_query{'page_name'}) {
if ($post_query{'page_name'} =~ m/^http/) {
$script_return = $post_query{'page_name'};
} else {
$script_return = "$home_url" . "$post_query{'page_name'}";
}
print "<p><a href=$script_return>";
print "Return to Last Visited Page</a>";
} else {
$script_return = $home_page;
print "<p><a href=$script_return>";
print "Return to Home Page</a>";
}
}
# End sub return_page
#-----------------------------------------------------#
sub search {
# search engine routine
$search=$post_query{'term'};
if (!(-d $home_html)) {
$searchengine_error = qq(Cannot open $home_html. Check the merchant
setup file to see if \$home_html = is set correctly. Also, the merchant
html files must be on the same server as the cybercart script. If not,
use the CyberSearch script as the search engine, by placing it
on the server with the merchant html files. See the
<a href="http://www.lobo.net/~rtweb/Cybercart/searchengine.html">CyberSearch</a>
page for more info.);
&error("$searchengine_error");
exit;
}
if (length($search) < 3) {
print "Search terms of less than three letters are not allowed.";
exit 0;
}
$found=0;
print "<h1>Search Results</h1>\n";
print "Search term: $post_query{'term'}<br>\n";
&scan_files($home_html,$search);
if ($num == 0) {
print "No matches found.<p>";
} else {
print "</ol>\n";
}
&print_links;
&footer;
}
#-------------------------------------------------------------------------------------
sub scan_files {
my $dir=$_[0];
my $st=$_[1];
my (@dirs,@files,@results,$filename,$newdir,$list);
opendir(dir,$dir);
@dirs=grep {!(/^\./) && -d "$dir/$_"} readdir(dir);
rewinddir(dir);
@files=grep {!(/^\./) && /htm/ && -T "$dir/$_"} readdir(dir);
closedir (dir);
for $list(0..$#dirs) {
if (!($dirs[$list]=~/temp/ || $dirs[$list]=~/images/)) {
$newdir=$dir."/".$dirs[$list];
&scan_files ($newdir,$st);
}
}
for $list(0..$#files) {
$filename=$dir."/".$files[$list];
$title=$files[$list];
open file, $filename;
$anchor = "top";
while (<file>) {
if (/<title>([^<]+)<\/title>/i) {
$title=$1;
}
if (/<a name=\"([^<]+)\"/i) {
$anchor = $1;
}
@terms = split(/\s/,$st);
$num_matches = 0;
foreach $word (@terms) {
if ($_ =~ m/$word/i) {
$num_matches += 1;
}
}
$numterms = @terms;
if ($num_matches == $numterms) {
s/<[^>]*(>|$)//ig;
s/^[^>]*>//i;
$match = substr($_,0,80);
if (/$st/i) {
$num += 1;
$found = 1;
my $urlsearch=$st;
$urlsearch=~s/ /+/g;
$filename =~ s/$home_html/$home_url/i;
if ($num == 1) {
print "<ol>\n";
}
# $result_link = "$filename\#$anchor";
$result_link = "$home_url" . "$files[$list]\#$anchor";
if (!$printed_hit{$result_link}) {
print "<li><a href=\"$result_link\">$match</a>";
}
$printed_hit{$result_link} = 1;
}
}
}
}
return 1;
}
# End scan_files
#--------------------------------------------------------------
sub send {
# Send email to customer and merchant
%
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -