#!/usr/local/bin/perl use lib qw(/usr/home/ultra1/usr/local/lib/perl5 /usr/home/ultra1/usr/local/lib/perl5/site_perl); use Jcode; use CGI qw(:cgi-lib); &ReadParse; require "./shop.pl"; while (($k,$v) = each %in) { Jcode::convert(\$v,"euc"); $in{$k} = $v; } ################################################################# # ¤³¤Î´Ê°×Ç㤤ʪäÆ¥¹¥¯¥?ץȤϡ¢½é´?ßÄê¤ò¼«Ê¬¤Ç¹Ô¤¦¾?ç¡¢ # # SPEEDEX ¥µ¡¼¥Ð¡¼¾å¤Ç¤Ï̵ÎÁ¤ÇÍøÍѤǤ­¤Þ¤¹¡£ # # ¤Þ¤¿¡¢»öÁ°¤ËÏ¢Íí¤ò夭¡¢²?Äî¬Ç̵ÎÁÍøÍѸ¢¤? SPEEDEX ¤Ë # # Í¿¤¨¤?³¤È¤ËƱ°Õ¤¤¤¿¤À¤±¤??ç¤Ï¡¢²?Äê¤Ï¼«Í³¤Ç¤¹¡£ # # # # ¥»¥Ã¥È¥¢¥Ã¥× # # ¥â¥¸¥å¡¼¥?Î¥¤¥ó¥¹¥È¡¼¥? # # ¥â¥¸¥å¡¼¥? # # cgi-lib Base64 Jcode ¤¬¥¤¥ó¥¹¥È¡¼¥?µ¤?Ƥ¤¤Ê¤¤¾?? # # ¥³¥ó¥½¡¼¥?èÌ̤ǡ¢°Ê²¼¤Î vcpan ¥³¥Þ¥ó¥É¤ÇɬÍפʥ⥸¥å¡¼¥?? # # ¥¤¥ó¥¹¥È¡¼¥?·¤Æ¤¯¤À¤µ¤¤¡£ # # # # vcpan -f ExtUtils::MakeMaker # # vcpan -f File::Spec # # vcpan -f Text::EtText # # vcpan -f IO::String # # vcpan -f HTML::WebMake # # vcpan -f MIME::Base64 # # vcpan -f Jcode # # # # ¥Õ¥¡¥¤¥?γÎǧ¤ÈÊÔ½¸ # # ¥Õ¥¡¥¤¥?ÎÊÔ½¸¤Ï EUC (²?¹Ô CR+LF) ¤Ç¹Ô¤Ã¤Æ¤¯¤À¤µ¤¤¡£ # # FTP ¤Ï ASCII ¥â¡¼¥É¤Ç¹Ô¤Ã¤Æ¤¯¤À¤µ¤¤¡£ # # # # ɬ¿Ü¥Õ¥¡¥¤¥?£°Ê²¼¤Î¥Õ¥¡¥¤¥?Ïɬ¿Ü¤Ç¤¹¡£ # # basket.cgi, shop.pl, pref.csv, product.dat # # ¾åµ­¥Õ¥¡¥¤¥?ÏƱ°?Ç¥£¥?¯¥È¥ê¡¼¤Ë¤¢¤ê¤Þ¤¹¡£ # # # # basket.cgi ¤³¤Î¥Õ¥¡¥¤¥?Ǥ¹¡£ # # ¤³¤Î¥Õ¥¡¥¤¥?ǤÎÊѹ¹²Õ½ê¤Ï°Ê²¼¤Î°?Õ½ê¤Î¤ß¤Ç¤¹¡£ # # £²¹ÔÌܤΠ***** ¤ÎÉôʬ¤ò¤ª»È¤¤¤Î¥µ¡¼¥Ð¡¼Ì¾¤ËÊѹ¹¤·¤Æ¤¯¤À¤µ¤¤ # # # # use lib qw(/usr/home/*****/usr/local/lib/perl5 # # /usr/home/*****/usr/local/lib/perl5/site_perl); # # # # shop.pl ¥Õ¥¡¥¤¥? # # shop.pl ¥Õ¥¡¥¤¥?â¤Îµ­ºÜ¤Ë½¾¤Ã¤ÆÊÔ½¸¤·¤Æ¤¯¤À¤µ¤¤¡£ # # # # pref.csv ¥Õ¥¡¥¤¥? # # ÊÔ½¸¤ÎɬÍפϤ¢¤ê¤Þ¤»¤? # # # # product.dat ¥Õ¥¡¥¤¥? # # ¸½ºß¤Ï¡¢¥µ¥ó¥×¥?¬Æ?¤Ã¤Æ¤¤¤Þ¤¹¡£ # # ¥µ¥ó¥×¥?ηÁ¼°¤ò¸«½¬¤Ã¤Æ¡¢°Ê²¼¤ò½çÈÖ¤ËȾ³Ñ¥«¥ó¥Þ¶èÀÚ¤ê¤Ç # # ¾¦ÉÊ¥¸¥ã¥ó¥?³¡¼¥É¡Ê¥·¥ç¥Ã¥×¥³¡¼¥É¡Ë # # ¾¦ÉÊ¥³¡¼¥É # # ¾¦ÉÊ̾ # # ¾¦ÉÊñ²Á # # ¾¦ÉʽÅÎÌ # # ¾¦ÉÊ¥¸¥ã¥ó¥?³¡¼¥É¤Ï shop.pl ¤È°?פµ¤»¤Æ¤¯¤À¤µ¤¤¡£ # # # # how_to_pay, message ¤Î£²¥Õ¥¡¥¤¥?ÏǤ°Õ¤ËÊÔ½¸¤·¤Æ¤¯¤À¤µ¤¤¡£ # # ÊÔ½¸¸å¤Ï¤³¤Î¥Õ¥¡¥¤¥?ÈƱ°?Ç¥£¥?¯¥È¥ê¡¼¤ËÃÖ¤¤¤Æ¤¯¤À¤µ¤¤¡£ # # how_to_pay # # ¸ÜµÒ¤Ø¤Î¥á¡¼¥?ËÆ?¤?ÙʧÊ?Ë¡¤ËÉÕ¤¤¤Æ¤Î¤ªÃΤ餻¤Ç¤¹¡£ # # µ­ºÜ¤µ¤?¿Ê¸¾Ï¤¬¤½¤Î¤Þ¤ÞÄ?¿Ê¸¤È¤Ê¤ê¤Þ¤¹¡£ # # message # # ¸ÜµÒ¤Ø¤Î¥á¡¼¥?ËÆ?¤?½¤Î¾¤Î¤ªÃΤ餻¤Ç¤¹¡£ # # µ­ºÜ¤µ¤?¿Ê¸¾Ï¤¬¤½¤Î¤Þ¤ÞÄ?¿Ê¸¤È¤Ê¤ê¤Þ¤¹¡£ # # # ################################################################# $address_owner = ""; $domain = "$uri"; $orderdat_dir = "$data_dir/orderdat"; $memberdir = "$data_dir/memberdat"; $passwd_file = "$data_dir/memberdat/passwd"; $passwd_file_tmp = "$data_dir/memberdat/passwd.tmp"; $passwd_keep = "$data_dir/memberdat/passwd.keep"; $how_to_pay_file = "./how_to_pay"; $message_file = "./message"; #--------------------------------------------------------------------------------------- #--------# # ¥¯¥Ã¥­¡¼¤ò¥Á¥§¥Ã¥¯¤·¡¢order_num ¤ò·èÄꤹ¤?£ $cookies = $ENV{'HTTP_COOKIE'}; @cookie_pairs = split(/;/,$cookies); foreach $cookie_pair (@cookie_pairs) { ($name, $value) = split(/=/, $cookie_pair); $name =~ s/ //g; $cookie{$name} = $value; } while (($k,$v) = each %cookie) { Jcode::convert(\$v,"euc"); $cookie{$k} = $v; } if (($cookie{domain} eq $domain) && ($cookie{Title} eq $title)) { unless ($in{order_num}) { if ($cookie{Order_num} ne "" || $cookie{Order_num} != 0) { $order_num = $cookie{Order_num}; } else { &get_order_num; } } else { $order_num = $in{order_num}; } unless ($in{user_num}) { if ($cookie{User_num}) { $user_num = $cookie{User_num}; } } else { $user_num = $in{user_num}; } } else { &get_order_num; } $order_dat_file = "$data_dir/ordered/$order_num.dat"; #--------# # $order_tmp_file ¥Õ¥¡¥¤¥?Ë order ¤ò½ñ¤­½Ð¤¹¡£ $order_tmp_file = "$data_dir/ordered/$order_num.tmp"; if (($in{Action} eq "ADPR") || ($in{Action} eq "BUYPR")){ if (-e $order_tmp_file) { $warning_title = "Cannot open $order_tmp_file for add"; open (ORDERDAT, ">>$order_tmp_file") || (&warning, exit(0)); print ORDERDAT "$in{Store_Code},$in{Product_Code},$in{volume}\n"; close ORDERDAT; } else { $warning_title = "Cannot open $order_tmp_file for new"; open (ORDERDAT, ">$order_tmp_file") || (&warning, exit(0)); print ORDERDAT "$in{Store_Code},$in{Product_Code},$in{volume}\n"; close ORDERDAT; } } if ($in{Action} eq "ADPR") { &thanks_and_go_back; } elsif ($in{Action} eq "BUYPR") { &show_order_conferm; } elsif ($in{Action} eq "BASKET") { &show_basket; } elsif ($in{Action} eq "CHECKOUT") { &show_checkout; } elsif ($in{Action} eq "DELETE") { &delete; } elsif ($in{Action} eq "GOBACK") { $wait = 0; &set_cookie; print "Content-type: text/html\n\n"; &referer_back; }elsif ($in{Action} eq "ENTRY") { &show_entry; } ########################################################## # &thanks_and_go_back; sub thanks_and_go_back { &set_cookie; print "Content-type: text/html\n\n"; $wait = 2; &referer_back; print "\n"; print "\n"; print "¥¹¥È¥¢-¥Ç¥?: Æ«¼§´?\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; &print_formatted_head; print "
\n"; print "$in{Product_Code} ¤? $in{volume} ¸Ä¥Ð¥¹¥±¥Ã¥È¤ËÆ?¤?Þ¤·¤¿¡£\n"; print "
\n"; print "¼«Æ°Åª¤Ë¡¢¥·¥ç¥Ã¥×¤Î¥È¥Ã¥×¥Ú¡¼¥¸¤ËÌá¤ê¤Þ¤¹¡£\n"; print "
\n"; print "Ìá¤?ʤ¤¾?ç¤Ï¥Ö¥é¥¦¥¶¤ÎÌá¤?Ü¥¿¥ó¤ò»È¤Ã¤Æ¤¯¤À¤µ¤¤¡£\n"; # foreach $key (keys %cookie) { # print "$key: \n"; # print "$cookie{$key}
\n"; # } print "
\n"; &print_formatted_bottom; } ########################################################## # &set_cookie; sub set_cookie { if (($order_num) && ($user_num)) { print "Set-Cookie: domain=$domain;\n"; print "Set-Cookie: Title=$title;\n"; print "Set-Cookie: Order_num=$order_num;\n"; print "Set-Cookie: User_num=$user_num; \n"; } elsif ($order_num) { print "Set-Cookie: domain=$domain;\n"; print "Set-Cookie: Title=$title;\n"; print "Set-Cookie: Order_num=$order_num; \n"; } elsif ($user_num) { print "Set-Cookie: domain=$domain;\n"; print "Set-Cookie: Title=$title;\n"; print "Set-Cookie: User_num=$user_num; \n"; } } ########################################################## # &referer_back; sub referer_back { if ($in{Store_Code}) { $Store_Code = $in{Store_Code}; } else { $Store_Code = $store_code; } if ($Store_Code) { print "\n"; } else { print "\n"; } } ########################################################## # &print_formatted_head; sub print_formatted_head { print "\n"; print "
\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "
\n"; print "\n"; print "\n"; print "
\n"; print "\"Account\" \n"; print "\"Product \n"; print "\"Basket\n"; print "\n"; print "\"Checkout\"\n"; print "
\n"; print "
\n"; print "\n"; print "\n"; print "
\n"; print "\n"; print "½ð̾¤·¤ÆÆ?Ź¤¹¤?\n"; print "

\n"; $stores_length = @stores_name; for ($i = 0; $i < $stores_length; $i++) { print "$stores_name[$i]\n"; print "
\n"; } print "
\n"; print "
\n"; print "
\n"; print "
\n"; } ########################################################## # &print_formatted_bottom sub print_formatted_bottom { print "
\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; } ########################################################## # &show_order_conferm; sub show_order_conferm { $product_code = $in{Product_Code}; &read_product_file; &set_cookie; print "Content-type: text/html\n\n"; $product_total = $target_Product_Cost * $in{volume}; $commas_product_total = &commas ($product_total); $product_total_Weight = $target_Product_Weight * $in{volume}; $commas_product_total_Weight = &commas ($product_total_Weight); print "\n"; print "\n"; print "¥¹¥È¥¢-¥Ç¥?: Æ«¼§´?\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; &print_formatted_head; print "
\n"; print "
\n"; print "¤´¹ØÆ?Í­Æñ¤¦¤´¤¶¤¤¤Þ¤¹¡£
¤´¹ØÆ?ÆâÍƤϰʲ¼¤Ç¤¹¡£
\n"; print "
\n"; print "
\n"; print "\n"; print "\n"; print "\n"; print "
¾¦ÉÊÈÖ¹?¾¦ÉÊ̾ñ²Á¹ØÆ?¿?¹ØÆ?³Ûñ°Ì½ÅÎ̹ØÆ?½ÅÎÌ
$target_Product_Code$target_Product_Name$target_Product_Cost$in{volume}$commas_product_total$target_Product_Weight$commas_product_total_Weight
\n"; print "
\n"; print "\n"; print "\n"; if ($user_num) { print "\n"; } print "\n"; print "
\n"; print "
\n"; print "
\n"; print "\n"; print "\n"; if ($user_num) { print "\n"; } print "\n"; print "\n"; print "\n"; print "\n"; print "
\n"; print "
\n"; print "
\n"; print "\n"; print "\n"; print "\n"; if ($user_num) { print "\n"; } print "\n"; print "
\n"; print "
\n"; &print_formatted_bottom; } ########################################################## # &read_product_file; sub read_product_file { if ($in{Store_Code}) { $Store_Code = $in{Store_Code}; } elsif ($store_code) { $Store_Code = $store_code; } $product_file = "$data_dir/product.dat"; unless (-e $product_file) { print "ɬÍפʥե¡¥¤¥?¬¸«¤Ä¤«¤ê¤Þ¤»¤ó¡£\n$owner_mail ¤Ë¤ªÌ䤤¹ç¤?»²¼¤µ¤¤¡£$product_file \n"; &warning; exit(0); } else { $warning_title = "Cannot open $product_file"; open (PRODUCT, "$product_file") || (&warning, exit(0)); $found_flg = 0; while () { chomp; ($Store_Code,$Product_Code,$Product_Name,$Product_Cost,$Product_Weight) = split (/,/,$_); if ($Product_Code eq $product_code) { $target_Product_Code = $Product_Code; $target_Product_Name = $Product_Name; $target_Product_Cost = $Product_Cost; $target_Product_Weight = $Product_Weight; $found_flg = $found_flg + 1; last; } } if ($found_flg == 0) { $warning_title = "¾¦Éʤ¬ÅÐÏ¿¤µ¤?Ƥ¤¤Þ¤»¤ó¡£\n$owner_mail ¤Ë¤ªÌ䤤¹ç¤?»²¼¤µ¤¤¡£"; &warning; exit(0); } } } ########################################################## # &show_entry; sub show_entry { if ($in{Entry} eq "new") { &set_cookie; print "Content-type: text/html\n\n"; print "\n"; } elsif ($in{Entry} eq "already") { unless (($in{user_num}) || ($in{passwd})) { $warning_title = "¤ªµÒÍÍÈÖ¹æ¤È¥Ñ¥¹¥?¼¥É¤ÎξÊ?¤¬É¬¿Ü¤Ç¤¹"; &warning; exit(0); } elsif ($in{user_num} =~ /[^0-9]/) { $warning_title = "¤ªµÒÍÍÈÖ¹æ¤Ë¸í¤ê¤¬¤¢¤ê¤Þ¤¹"; &warning; exit(0); } else { if (-e $passwd_file) { $warning_title = "Cannot open password file"; open (PASSWD, $passwd_file) || (&warning, exit(0)); while () { chomp; ($file_user_num, $file_passwd) = split (/,/,$_); if ($file_user_num eq $in{user_num}) { if ($in{passwd} eq $file_passwd) { &read_user_profile_and_show; } else { $warning_title = "¥Ñ¥¹¥?¼¥É¤¬°ã¤¤¤Þ¤¹"; &warning; exit(0); } last; } } } else { $warning_title = "Cannot find password file"; &warning; exit(0); } } } elsif ($in{Entry} eq "input") { &data_check_a; &get_user_num; $p_number_now = $in{pref}; &get_pref_name; &show_profile_confirm; } elsif ($in{Entry} eq "confirm") { &keep_passwd; &keep_profile; unless ($order_num) { # index ¥Ú¡¼¥¸¤òɽ¼¨ &set_cookie; print "Content-type: text/html\n\n"; print "\n"; print "\n"; print "\n"; print "ÅÐÏ¿Í­Æñ¤¦¤´¤¶¤¤¤Þ¤¹¡£
\n"; print "¼«Æ°Åª¤Ë¥È¥Ã¥×¥Ú¡¼¥¸¤ËÌá¤ê¤Þ¤¹¡£
\n"; print "Ìá¤é¤Ê¤¤¾?ç¤Ï¡¢°Ê²¼¤ò¥¯¥?Ã¥¯¤·¤Æ¤¯¤À¤µ¤¤¡£
\n"; print "¥È¥Ã¥×¥Ú¡¼¥¸
\n"; print "\n"; print "\n"; } else { &show_checkout; } } } ########################################################## # &show_profile_confirm: sub show_profile_confirm { &set_cookie; print "Content-type: text/html\n\n"; print "\n"; print "\n"; print "\n"; print "¥¹¥È¥¢-¥Ç¥?: ¸ÜµÒÅÐÏ¿³Îǧ\n"; print "\n"; print "\n"; print "\n"; print "\n"; &print_formatted_head; 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"; 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 " $in{p_name_j}\n"; print "
\n"; print " ¤´Ã´Åö¼Ô¤Î¥á¡¼¥?¢¥É¥?¹\n"; print " \n"; print " $in{e_mail}\n"; print "
\n"; print " ¤ª¿½¹?¤ß¤ÎÁÈ¿¥Ì¾\n"; print " \n"; print " $in{mem_name_j}\n"; print "
\n"; print " ÅÅÏÃÈÖ¹?\n"; print " \n"; print " $in{tel}\n"; print "
\n"; print " £Æ£Á£ØÈÖ¹?\n"; print " \n"; print " $in{fax}\n"; print "
\n"; print " ͹ÊØÈÖ¹?\n"; print " \n"; print " $in{zip}\n"; print "
ÅÔÆ»Éܸ©Ì¾\n"; print "$pref_name\n"; print "
\n"; print " ¤´½»½?\n"; print " \n"; print " $in{address_j}\n"; print "
\n"; print " ¤ªµÒÍÍÈÖ¹?\n"; print " \n"; print " $user_num\n"; print "
\n"; print " ¥Ñ¥¹¥?¼¥É\n"; print " \n"; print " $in{passwd}   ¥á¥â¤·¤Æ¤¯¤À¤µ¤¤\n"; print "
\n"; print "\n"; print "
\n"; print "
\n"; &print_formatted_bottom; } ########################################################## # &get_pref_name; sub get_pref_name { $warning_title = "Cannot open pref.csv"; open(PREF, "./pref.csv") || (&warning, exit(0)); while() { chomp; ($p_number, $j_title) = split (/,/, $_); $pref{$p_number} = $j_title; } $pref_name = $pref{$p_number_now}; } ########################################################## #¥Ç¡¼¥¿¥Á¥§¥Ã¥¯ ̾Á°¡¦¥á¡¼¥?¦ÁÈ¿¥¡¦ÅÅÏá¦FAX # &data_check_a; sub data_check_a { $ckeck_p_name_j = $in{"p_name_j"}; $len_p_name_j = length($ckeck_p_name_j); $ckeck_e_mail = $in{"e_mail"}; $len_e_mail = length($ckeck_e_mail); $ckeck_mem_name_j = $in{"mem_name_j"}; $len_mem_name_j = length($ckeck_mem_name_j); $ckeck_tel = $in{"tel"}; $len_tel = length($ckeck_tel); $ckeck_fax = $in{"fax"}; $len_fax = length($ckeck_fax); $ckeck_zip = $in{"zip"}; $len_zip = length($ckeck_zip); $ckeck_address_j = $in{"address_j"}; $len_address_j = length($ckeck_address_j); #¤ªÌ¾Á°¡¦ÏÂʸ if ($len_p_name_j < 2) { $warning_title = "¤ªÌ¾Á°¤òÆ?ÎϤ·¤Æ¤¯¤À¤µ¤¤"; &warning; exit(0); #¥á¡¼¥?¢¥É¥?¹ } elsif ($ckeck_e_mail) { if ($ckeck_e_mail !~ /@/ || $ckeck_e_mail !~ /\./ || $len_e_mail < 7) { $warning_title = "¥á¡¼¥?¢¥É¥?¹¤Î·Á¼°¤¬Àµ¤·¤¯¤¢¤ê¤Þ¤»¤?"; &warning; exit(0); } elsif ($ckeck_e_mail !~ /\.jp\b/i && $ckeck_e_mail =~ /[^a-zA-Z0-9\.\-,_@]/) { $warning_title = "¥á¡¼¥?¢¥É¥?¹¤Ï±Ñ¿ôȾ³Ñ¤ÇÆ?ÎϤ·¤Æ¤¯¤À¤µ¤¤"; &warning; exit(0); }elsif($ckeck_e_mail =~ /\.jp\b/i ){ #@¤ÎÁ°¤ÎȾ³Ñ¥Á¥§¥Ã¥¯ undef @sep; @sep = split(/@/, $ckeck_e_mail); $check = $sep[0]; if ($check =~ /[^a-zA-Z0-9\-_,\.]/) { $warning_title = "¥á¡¼¥?¢¥É¥?¹¤Ï±Ñ¿ôȾ³Ñ¤ÇÆ?ÎϤ·¤Æ¤¯¤À¤µ¤¤"; &warning; exit(0); } #@¤Î¸å¤ÎȾ³Ñ¥Á¥§¥Ã¥¯ undef @sep2; #undef @sep3; undef $check; @sep2 = split(/\./, $sep[1]); $a = @sep2; if ($a >2){ pop(@sep2); pop(@sep2); foreach $check (@sep2) { if ($check =~ /[^a-zA-Z0-9\.\-_@,]/) { $warning_title = "E¥á¡¼¥?Υɥᥤ¥ó¤Ï±Ñ¿ôȾ³Ñ¤ÇÆ?ÎϤ·¤Æ¤¯¤À¤µ¤¤"; &warning; exit(0); } } } } #ÁÈ¿¥Ì¾¡¦ÏÂʸ } elsif ( $len_mem_name_j < 2 ) { $warning_title = "ÁÈ¿¥Ì¾¤òÆ?ÎϤ·¤Æ¤¯¤À¤µ¤¤"; &warning; exit(0); #ÅÅÏÃÈÖ¹? } elsif ($ckeck_tel =~ /[^0-9\- ext\.]/|| $ckeck_tel !~ /.+\-.+\-.+/ || $len_tel < 10 ) { $warning_title = "ÅÅÏÃÈÖ¹æ¤ÏȾ³Ñ¤Î¿ô»íˆÈ¥Ï¥¤¥Õ¥ó¡¢ÆâÀ?¤Ïext.¤òÍѤ¤¤ÆÆ?ÎϤ·¤Æ²¼¤µ¤¤"; &warning; exit(0); #FAXÈÖ¹? } elsif ($ckeck_fax =~ /[^0-9\- ext\.]/|| $ckeck_fax !~ /.+\-.+\-.+/ || $len_fax < 10 ) { $warning_title = "FAXÈÖ¹æȾ³Ñ¤Î¿ô»íˆÈ¥Ï¥¤¥Õ¥ó¡¢ÆâÀ?¤Ïext.¤òÍѤ¤¤ÆÆ?ÎϤ·¤Æ²¼¤µ¤¤"; &warning; exit(0); #͹ÊØÈÖ¹? } elsif ($ckeck_zip =~ /[^0-9\-]/ || $ckeck_zip !~ /.+\-.+/ || $len_zip < 8 ) { $warning_title = "͹ÊØÈÖ¹æ¤Ï¥Ï¥¤¥Õ¥ó¤òÍѤ¤¤Æ7·åÀµ³Î¤ËÆ?ÎϤ·¤Æ¤¯¤À¤µ¤¤"; &warning; exit(0); #½»½? } elsif ($len_address_j < 4 ) { $warning_title = "¤´½»½ê¤òÆ?ÎϤ·¤Æ¤¯¤À¤µ¤¤"; &warning; exit(0); } } ########################################################## #¸ÜµÒÈÖ¹æ¼èÆÀ # &get_user_num; sub get_user_num { unless ($user_num) { undef @mem_numberdat; $warning_title = "Cannot open user_num.dat"; open (NUMBER, "$memberdir/user_num.dat") || (&warning, exit(0)); flock(NUMBER, 2); while() { chomp; @mem_numberdat = (@mem_numberdat,$_); } @mem_numberdat = sort { $b <=> $a } @mem_numberdat; if ($mem_numberdat[0] == 0) { $user_num = 20001; } else { $user_num = $mem_numberdat[0] + 1; } close (NUMBER); $warning_title = "Cannot open user_num.dat"; open (NUMBER, ">>$memberdir/user_num.dat") || (&warning, exit(0)); print NUMBER "$user_num\n"; flock(NUMBER, 8); } } ########################################################## #¥ª¡¼¥À¡¼ÈÖ¹æ¤ò¼èÆÀ¤¹¤? sub sub get_order_num { @order_numberdat = (); $warning_title = "Cannot open order_num.dat"; open (NUMBER, "$orderdat_dir/order_num.dat") || (&warning, exit(0)); flock(NUMBER, 2); while() { chomp; @order_numberdat = (@order_numberdat,$_); } @order_numberdat = sort { $b <=> $a } @order_numberdat; if ($order_numberdat[0] == 0) { $order_num = 120001; } else { $order_num = $order_numberdat[0] + 1; } $warning_title = "Cannot open order_num.dat for add"; open (NUMBER, ">>$orderdat_dir/order_num.dat"); print NUMBER "$order_num\n"; flock(NUMBER, 8); } ########################################################## #¥Ñ¥¹¥?¼¥É¤òÊݸ¤¹¤? # &keep_passwd; sub keep_passwd { if (-e $passwd_file) { $warning_title = "Cannot open password file"; open (PASSWDR, "$passwd_file") || (&warning, exit(0)); flock(PASSWDR, 2); $warning_title = "Cannot open password tmp file"; open (PASSWD, ">$passwd_file_tmp") || (&warning, exit(0)); while () { chomp; ($file_user_num, $file_passwd) = split (/,/,$_); unless ($file_user_num eq $user_num) { print PASSWD "$_\n"; } } print PASSWD "$user_num,$in{passwd}\n"; $warning_title = "Cannot rename password file"; rename ($passwd_file,$passwd_keep) || (&warning, exit(0)); $warning_title = "Cannot rename password tmp file"; rename ($passwd_file_tmp,$passwd_file) || (&warning, exit(0)); $warning_title = "Cannot rename password keep file"; unlink ($passwd_keep) || (&warning, exit(0)); flock(PASSWDR, 8); } else { $warning_title = "Cannot open password file"; open (PASSWD, ">$passwd_file") || (&warning, exit(0)); flock(PASSWD, 2); print PASSWD "$user_num,$in{passwd}\n"; flock(PASSWD, 8); } } ########################################################## #¸ÜµÒ¥Ç¡¼¥¿¤òÊݸ¤¹¤? # &keep_profile; sub keep_profile { $warning_title = "Cannot open $user_num.prof"; open (PROF, ">$memberdir/$user_num.prof") || (&warning, exit(0)); flock(PROF, 2); print PROF "user_num\n"; print PROF "$in{user_num}\n"; print PROF "p_name_j\n"; print PROF "$in{p_name_j}\n"; print PROF "e_mail\n"; print PROF "$in{e_mail}\n"; print PROF "mem_name_j\n"; print PROF "$in{mem_name_j}\n"; print PROF "tel\n"; print PROF "$in{tel}\n"; print PROF "fax\n"; print PROF "$in{fax}\n"; print PROF "zip\n"; print PROF "$in{zip}\n"; print PROF "pref\n"; print PROF "$in{pref}\n"; print PROF "address_j\n"; print PROF "$in{address_j}\n"; print PROF "passwd\n"; print PROF "$in{passwd}\n"; flock(PROF, 8); } ########################################################## #¥Ð¥¹¥±¥Ã¥ÈÆâÍƤκ?? # &delete; sub delete { $order_num = $in{order_num}; $line_num = $in{line_num}; $order_tmp_file = "$data_dir/ordered/$order_num.tmp"; $order_tmp_tmp_file = "$data_dir/ordered/$order_num.tmp.tmp"; if (-e $order_tmp_file) { $warning_title = "Cannot open $order_tmp_file for read"; open (READ,"$order_tmp_file") || (&warning, exit(0)); $warning_title = "Cannot open $order_tmp_tmp_file for write"; open (WRITE,">$order_tmp_tmp_file") || (&warning, exit(0)); $new_line_num = 1; while () { chomp; if ($new_line_num != $line_num) { print WRITE "$_\n"; } $new_line_num = $new_line_num + 1; } $order_keep_file = "$data_dir/ordered/$order_num.keep"; $warning_title = "Cannot link $order_tmp_file"; link ($order_tmp_file,$order_keep_file) || (&warning, exit(0)); $warning_title = "Cannot rename $order_tmp_tmp_file"; rename ($order_tmp_tmp_file,$order_tmp_file) || (&warning, exit(0)); $warning_title = "Cannot remove $order_keep_file"; unlink ($order_keep_file) || (&warning, exit(0)); } else { $warning_title = "Cannot find $order_tmp_file"; &warning; exit(0); } &set_cookie; print "Content-type: text/html\n\n"; print "\n"; print "\n"; &print_formatted_head; print "
\n"; print "º??·¤Þ¤·¤¿¡£
\n"; print "¼«Æ°Åª¤Ë¥È¥Ã¥×¥Ú¡¼¥¸¤ËÌá¤ê¤Þ¤¹¡£
\n"; print "Ìá¤é¤Ê¤¤¾?ç¤Ï¡¢°Ê²¼¤ò¥¯¥?Ã¥¯¤·¤Æ¤¯¤À¤µ¤¤¡£
\n"; print "¥È¥Ã¥×¥Ú¡¼¥¸
\n"; print "
\n"; &print_formatted_bottom; } ########################################################## #¸ÜµÒ¥Ç¡¼¥¿¤òÆɤßɽ¼¨¤¹¤? # &read_user_profile_and_show; sub read_user_profile_and_show { $warning_title = "Cannot open $user_num.prof"; open (PROF, "$memberdir/$user_num.prof") || (&warning, exit(0)); while ($name = ) { chomp($name); $value = ; chomp($value); $prof{$name} = $value; } &set_cookie; print "Content-type: text/html\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_formatted_head; 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"; 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"; print " \n"; print " ɬ¿Ü¡¡¸Ä¿Í¤Î¾?ç¤Ï¡¢¤ªÌ¾Á°\n"; print "
\n"; print " ÅÅÏÃÈÖ¹?\n"; print " \n"; print " ±ÑʸȾ³Ñ¡¢É¬¿Ü¡¡ÆâÀ?¤Ïext.¤Ë³¤±¤Æ
\n"; print " £Æ£Á£ØÈÖ¹?\n"; print " \n"; print " ±ÑʸȾ³Ñ¡¢É¬¿Ü
\n"; print " ͹ÊØÈÖ¹?\n"; print " \n"; print " ±ÑʸȾ³Ñ¤Ç¡¢000-0000¤Î¤è¤¦¤Ë¡¢µ­Æ?¤·¤Æ²¼¤µ¤¤¡£É¬¿Ü\n"; print "
ÅÔÆ»Éܸ©Ì¾\n"; print "\n"; print "ɬ¿Ü\n"; print "
\n"; print " ¤´½»½?\n"; print " \n"; print " ɬ¿Ü\n"; print "
\n"; print " ¤ªµÒÍÍÈÖ¹?\n"; print " \n"; print " $user_numɬ¿Ü\n"; print "
\n"; print " ¥Ñ¥¹¥?¼¥É\n"; print " \n"; print " Æü?¸»íˆò½?¯±Ñ¿ôȾ³Ñ¡¢É¬¿Ü
Êѹ¹¤ÎɬÍפ¬¤Ê¤¤¾?ç¤Ï¤½¤Î¤Þ¤Þ¤Ë¤·¤Æ¤¯¤À¤µ¤¤¡£Æ?ÎϤµ¤?Þ¤¹¤ÈÊѹ¹¤µ¤?Þ¤¹\n"; print "
\n"; print "\n"; print "
\n"; print "
\n"; &print_formatted_bottom; } ########################################################## #¥Á¥§¥Ã¥¯¥¢¥¦¥È²èÌ̤Îɽ¼¨ # &show_checkout; sub show_checkout { $order_tmp_file = "$data_dir/ordered/$order_num.tmp"; &set_cookie; print "Content-type: text/html\n\n"; unless ($user_num) { $wait = 3; print "\n"; print "\n"; print "\n"; print "¥¹¥È¥¢-¥Ç¥?: Æ«¼§´?\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; &print_formatted_head; print "
\n"; print "¤ªµÒÍͥǡ¼¥¿¤ÎÅÐÏ¿¤¬¤Þ¤À¤Ç¤¹¡£\n"; print "
\n"; print "¤ªµÒÍͥǡ¼¥¿¤ÎÅÐÏ¿¤ò¤·¤Æ¤«¤é¥Á¥§¥Ã¥¯¥¢¥¦¥È¤·¤Æ¤¯¤À¤µ¤¤¡£\n"; print "
\n"; print "¼«Æ°Åª¤Ë¡¢¡Ö¤ªµÒÍͥǡ¼¥¿ÅÐÏ¿¡×¥Ú¡¼¥¸¤¬É½¼¨¤µ¤?Þ¤¹¡£\n"; print "
\n"; print "ɽ¼¨¤µ¤?ʤ¤¾?ç¤Ï²èÌ̺¸¤Î¡Ö½ð̾¤·¤ÆÆ?Ź¤¹¤?פò¥¯¥?Ã¥¯¤·¤Æ¤¯¤À¤µ¤¤¡£\n"; print "
\n"; &print_formatted_bottom; } else { unless (-e "$order_tmp_file") { $wait = 2; &referer_back; print "\n"; print "\n"; print "¥¹¥È¥¢-¥Ç¥?: Æ«¼§´?\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; &print_formatted_head; print "
\n"; print "001¸½ºß¡¢¥Ð¥¹¥±¥Ã¥È¤Ï¶õ¤Ç¤¹¡£
\n"; print "¹ØÆ?·èÄ?å¡¢¥Á¥§¥Ã¥¯¥¢¥¦¥È¤·¤Æ¤¯¤À¤µ¤¤¡£
\n"; print "
\n"; &print_formatted_bottom; } elsif (-z "$order_tmp_file") { $wait = 2; &referer_back; print "\n"; print "\n"; print "¥¹¥È¥¢-¥Ç¥?: Æ«¼§´?\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; &print_formatted_head; print "
\n"; print "¸½ºß¡¢¥Ð¥¹¥±¥Ã¥È¤Ï¶õ¤Ç¤¹¡£
\n"; print "¹ØÆ?·èÄ?å¡¢¥Á¥§¥Ã¥¯¥¢¥¦¥È¤·¤Æ¤¯¤À¤µ¤¤¡£
\n"; print "
\n"; &print_formatted_bottom; } else { if ($in{proccess_flg} eq "finish") { &finish; } else { $warning_title = "Cannot open $user_num.prof"; open (PROF, "$memberdir/$user_num.prof") || (&warning, exit(0)); while ($name = ) { chomp($name); $value = ; chomp($value); $prof{$name} = $value; } print "\n"; print "\n"; print "¥¹¥È¥¢-¥Ç¥?: Æ«¼§´?\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; &print_formatted_head; 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"; 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 " $prof{p_name_j}\n"; print "
\n"; print " ¤´Ã´Åö¼Ô¤Î¥á¡¼¥?¢¥É¥?¹\n"; print " \n"; print " $prof{e_mail}\n"; print "
\n"; print " ¤ª¿½¹?¤ß¤ÎÁÈ¿¥Ì¾\n"; print " \n"; print " $prof{mem_name_j}\n"; print "
\n"; print " ÅÅÏÃÈÖ¹?\n"; print " \n"; print " $prof{tel}\n"; print "
\n"; print " £Æ£Á£ØÈÖ¹?\n"; print " \n"; print " $prof{fax}\n"; print "
\n"; print " ͹ÊØÈÖ¹?\n"; print " \n"; print " $prof{zip}\n"; print "
ÅÔÆ»Éܸ©Ì¾\n"; $p_number_now = $prof{pref}; &get_pref_name; print "$pref_name\n"; print "
\n"; print " ¤´½»½?\n"; print " \n"; print " $prof{address_j}\n"; print "
\n"; print " ¤ªµÒÍÍÈÖ¹?\n"; print " \n"; print " $user_num\n"; print "
\n"; print " ¥Ñ¥¹¥?¼¥É\n"; print " \n"; print " $prof{passwd}   ¥á¥â¤·¤Æ¤¯¤À¤µ¤¤\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"; &calculate_product_volume; $z_sub_total_weight = 0; $z_sub_total = 0; foreach $key (sort keys %new_store_code) { $last_store_code = "$key" . "__" . "store_code"; $last_product_code = "$key" . "__" . "product_code"; $last_product_name = "$key" . "__" . "product_name"; $last_product_cost = "$key" . "__" . "product_cost"; $last_product_volume = "$key" . "__" . "product_volume"; $last_product_weight = "$key" . "__" . "product_weight"; $last_u_of_weight = "$key" . "__" . "u_of_weight"; $last_sub_total_weight = "$key" . "__" . "sub_total_weight"; $last_sub_total = "$key" . "__" . "sub_total"; $product_code = $new_product_code{$key}; &read_product_file; 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"; print " \n"; print "ñ²Á\n"; print " \n"; print "¸Ä¿?\n"; print " \n"; print "ñ°Ì½ÅÎÌ\n"; print " \n"; print "¾®·×½ÅÎÌ\n"; print " \n"; print "¶â³Û\n"; print "
\n"; print "$order_num\n"; #print "\n"; print " \n"; print "$new_store_code{$key}\n"; print "\n"; print " \n"; print "$new_product_code{$key}\n"; print "\n"; print " \n"; print "$target_Product_Name\n"; print "\n"; print " \n"; $comma_target_Product_Cost = &commas ($target_Product_Cost); print "$comma_target_Product_Cost ±ß\n"; print "\n"; print " \n"; $comma_target_volume = &commas ($new_volume{$key}); print "$comma_target_volume\n"; print "\n"; print " \n"; $comma_target_Product_Weight = &commas ($target_Product_Weight); print "$comma_target_Product_Weight\n"; print "\n"; if ($u_of_weight) { print " $u_of_weight\n"; print "\n"; } print "\n"; print " \n"; $sub_total_weight = $target_Product_Weight * $new_volume{$key}; $comma_sub_total_weight = &commas ($sub_total_weight); $z_sub_total_weight = $z_sub_total_weight + $sub_total_weight; print "$comma_sub_total_weight\n"; print "\n"; if ($u_of_weight) { print " $u_of_weight\n"; } print "\n"; print " \n"; $sub_total = $target_Product_Cost * $new_volume{$key}; $comma_sub_total = &commas ($sub_total); $z_sub_total = $z_sub_total + $sub_total; print "$comma_sub_total ±ß\n"; print "\n"; print "
\n"; print "¾®·×¶â³Û\n"; print " \n"; $comma_z_sub_total = &commas ($z_sub_total); print "$comma_z_sub_total ±ß\n"; print "\n"; print "
\n"; if ($freight_rate) { $tax = ($z_sub_total + $freight) * 0.05; } else { $tax = ($z_sub_total) * 0.05; } $comma_tax = &commas ($tax); print "¾ÃÈñÀÇ\n"; print " \n"; print "$comma_tax ±ß\n"; print "\n"; print "
\n"; print "¹ç·×\n"; print " \n"; if ($freight_rate) { $gross_total = ($z_sub_total + $freight) * 1.05; } else { $gross_total = ($z_sub_total) * 1.05; } $comma_gross_total = &commas ($gross_total); print "$comma_gross_total ±ß\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_formatted_bottom; } } } } ########################################################## #¥Ð¥¹¥±¥Ã¥ÈÆâÍÆɽ¼¨ # &show_basket; sub show_basket { &set_cookie; print "Content-type: text/html\n\n"; print "\n"; print "\n"; print "\n"; print "¥Ð¥¹¥±¥Ã¥ÈÆâÍÆɽ¼¨\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; &print_formatted_head; print "
\n"; print "
\n"; print "¥Ð¥¹¥±¥Ã¥ÈÆâÍÆ\n"; print "
\n"; print "
\n"; unless (-e $order_tmp_file) { print "¸½ºß¡¢¥Ð¥¹¥±¥Ã¥È¤Ï¶õ¤Ç¤¹¡£
\n"; } elsif (-z $order_tmp_file) { print "¸½ºß¡¢¥Ð¥¹¥±¥Ã¥È¤Ï¶õ¤Ç¤¹¡£
\n"; } else { 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"; $warning_title = "Cannot open $order_tmp_file file."; open (DATA, "$order_tmp_file") || (&warning, exit(0)); $line_num = 0; $z_sub_total = 0; $z_sub_total_weight = 0; while () { $line_num = $line_num + 1; chomp; ($store_code,$product_code,$volume) = split (/,/,$_); &read_product_file; 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"; 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 "$order_num\n"; print " \n"; print "$line_num\n"; print " \n"; print "$store_code\n"; print " \n"; print "$target_Product_Code\n"; print " \n"; print "$target_Product_Name\n"; print " \n"; $c_target_Product_Cost = &commas($target_Product_Cost); print "$c_target_Product_Cost\n"; print " \n"; $c_volume = &commas($volume); print "$c_volume\n"; print " \n"; $comma_target_Product_Weight = &commas ($target_Product_Weight); print "$comma_target_Product_Weight\n"; if ($u_of_weight) { print " $u_of_weight\n"; } print "\n"; print " \n"; $sub_total_weight = $target_Product_Weight * $volume; $comma_sub_total_weight = &commas ($sub_total_weight); $z_sub_total_weight = $z_sub_total_weight + $sub_total_weight; print "$comma_sub_total_weight\n"; if ($u_of_weight) { print " $u_of_weight\n"; } print "\n"; print " \n"; $sub_total = $target_Product_Cost * $volume; $comma_sub_total = &commas ($sub_total); $z_sub_total = $z_sub_total + $sub_total; print "$comma_sub_total ±ß\n"; print " \n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "
\n"; print "¾®·×¶â³Û\n"; print " \n"; $comma_z_sub_total = &commas ($z_sub_total); print "$comma_z_sub_total ±ß\n"; print "\n"; print " \n"; print " \n"; print "
\n"; if ($freight_rate) { $tax = ($z_sub_total + $freight) * 0.05; } else { $tax = ($z_sub_total) * 0.05; } $comma_tax = &commas ($tax); print "¾ÃÈñÀÇ\n"; print " \n"; print "$comma_tax ±ß\n"; print "\n"; print " \n"; print " \n"; print "
\n"; print "¹ç·×\n"; print " \n"; if ($freight_rate) { $gross_total = ($z_sub_total + $freight) * 1.05; } else { $gross_total = ($z_sub_total) * 1.05; } $comma_gross_total = &commas ($gross_total); print "$comma_gross_total ±ß\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_formatted_bottom; } ############################################## # calculate_product_volume; sub calculate_product_volume { $warning_title = "Cannot open $order_tmp_file"; open (DATA, $order_tmp_file) || (print "Cannot open $order_tmp_file", exit(0)); $line_num = 0; while () { $line_num = $line_num + 1; chomp; ($store_code,$product_code,$volume) = split (/,/,$_); $store_code{$line_num} = $store_code; $product_code{$line_num} = $product_code; $volume{$line_num} = $volume; } @w1 = (); $number = 0; @pairs = (); for ($i = 1; $i <= $line_num; $i++) { $w1_flg = 0; foreach (@w1) { if ($i == $_) { $w1_flg = $w1_flg + 1; last; } } if ($w1_flg == 0) { $w_flg = 0; $pair = "$i"; for ($j = ($i + 1); $j <= $line_num; $j++) { if (($store_code{$i} eq $store_code{$j}) && ($product_code{$i} eq $product_code{$j})) { $w_flg = $w_flg + 1; @w1 = (@w1,$i,$j); $pair = "$pair" . ":" . "$j"; } else { $w_flg = $w_flg + 0; } } if ($w_flg == 0) { $number = $number + 1; $new_store_code{$number} = $store_code{$i}; $new_product_code{$number} = $product_code{$i}; $new_volume{$number} = $volume{$i}; } else { @pairs = (@pairs, $pair); } } } $numbers = keys (%new_store_code);#¥À¥Ö¤ê¤Î¤Ê¤¤¥Ç¡¼¥¿¤Î¿? $new_number = $numbers; if (@pairs) { $w_length = @pairs; # @ww_check = (); for ($i = 0; $i < $w_length; $i++) { $new_number = $new_number + 1; # $ww_flg = 0; # foreach (@ww_check) { # if ($i == $_) { # $ww_flg = $ww_flg +1; # last; # } # } # if ($ww_flg == 0) { @wpairs = split (/:/,$pairs[$i]); # @ww_check = (@ww_check, @wpairs); $first = $wpairs[0]; $tmp_volume = 0; $new_store_code{$new_number} = $store_code{$first}; $new_product_code{$new_number} = $product_code{$first}; foreach $line (@wpairs) { $tmp_volume = $tmp_volume + $volume{$line}; } $new_volume{$new_number} = $tmp_volume; } } } # @ww = ($pair_front_first, $pair_end_first); # for ($j = 0; $j < $w_length; $j++) { # if ($i != $j) { # ($pair_front_second,$pair_end_second) = split (/:/,$w[$j]); # if (($pair_front_first eq $pair_front_second) && ($pair_end_first ne $pair_end_second)) { # @ww = (@ww, $pair_end_second); # } # } # $new_number = $numbers + 1 + $i; # $new_volume{$new_number} = 0; # $new_store_code{$new_number} = $store_code{$pair_front_first}; # $new_product_code{$new_number} = $product_code{$pair_front_first}; # foreach (@ww) { # $new_volume{$new_number} = $new_volume{$new_number} + $volume{$_}; # } # } # } #} ############################################## # &finish; sub finish { # ¥ª¡¼¥À¡¼ÆâÍƤò¥Õ¥¡¥¤¥?ËÊݸ¤¹¤?£ $order_dat_file = "$data_dir/ordered/$order_num.dat"; $warning_title = "Cannot open Ordered file"; open (DATA, ">$order_dat_file") || (&warning, exit(0)); @numbers = (); foreach $key (sort keys %in) { if ($key =~ /__/) { @elements = split (/__/,$key); $check_flg = 0; foreach $number (@numbers) { if ($number eq $elements[0]) { $check_flg = $check_flg + 1; last; } } if ($check_flg == 0) { @numbers = (@numbers, $elements[0]); } } } undef ($number); foreach $number (@numbers) { foreach $key (sort keys %in) { if ($key =~ /__/) { @elements = split (/__/,$key); } if ($number eq $elements[0]) { print DATA "$key\n"; print DATA "$in{$key}\n"; } } } foreach $key (sort keys %in) { unless ($key =~ /__/) { print DATA "$key\n"; print DATA "$in{$key}\n"; } } # ¥ª¡¼¥À¡¼ tmp ¥Õ¥¡¥¤¥?òº??¹¤?£ $order_tmp_file = "$data_dir/ordered/$order_num.tmp"; $warning_title = "Cannot remove order tmp file."; unlink ($order_tmp_file) || (&warning, exit(0)); # ¥ª¡¼¥À¡¼ÆâÍƤòȯÃí¼Ô¤ÈŹÊÞ¥ª¡¼¥Ê¡¼¤Ë¥á¡¼¥?¹¤?£ $warning_title = "Cannot open $user_num.prof"; open (PROF, "$memberdir/$user_num.prof") || (&warning, exit(0)); while ($name = ) { chomp($name); $value = ; chomp($value); $prof{$name} = $value; } $p_number_now = $prof{pref}; &get_pref_name; #$pref_name = $pref{$p_number_now}; $subject_to_user = "$title" . " " . "ÃíʸÀÁ½?"; $subject_to_owner = "¼õÃíÊó¹?"; unless ($address_owner) { $address_owner = $prof{e_mail}; } $address_user = $prof{e_mail}; $prof_data = <) { chomp($name); $value = ; chomp($value); $ordered{$name} = $value; } $ordered_data = ""; $ordered_data = "$ordered_data" . " ÃíʸÈÖ¹? ------------------- $order_num \n\n" . " ŹÊÞÈÖ¹? ¾¦ÉÊÈÖ¹? ¾¦ÉÊ̾ ñ²Á ¸Ä¿? ñ°Ì½ÅÎÌ ¾®·×½ÅÎÌ ¶â³Û \n"; foreach $number (@numbers) { $last_store_code = "$number" . "__" . "store_code"; $last_product_code = "$number" . "__" . "product_code"; $last_product_name = "$number" . "__" . "product_name"; $last_product_cost = "$number" . "__" . "product_cost"; $comma_cost = &commas ($ordered{$last_product_cost}); $last_product_volume = "$number" . "__" . "product_volume"; $comma_volume = &commas ($ordered{$last_product_volume}); $last_product_weight = "$number" . "__" . "product_weight"; $comma_weight = &commas ($ordered{$last_product_weight}); $last_sub_total_weight = "$number" . "__" . "sub_total_weight"; $comma_sub_total_weight = &commas ($ordered{$last_sub_total_weight}); $last_sub_total = "$number" . "__" . "sub_total"; $comma_sub_total = &commas ($ordered{$last_sub_total}); $ordered_data = "$ordered_data" . " $ordered{$last_store_code} $ordered{$last_product_code} $ordered{$last_product_name} $comma_cost ±ß $comma_volume $comma_weight $comma_sub_total_weight $comma_sub_total ±ß\n"; } if ($u_of_weight) { $ordered_data = "$ordered_data" . "ñ°Ì½ÅÎÌ $u_of_weight\n"; } $c_ordered_z_sub_total = &commas($ordered{z_sub_total}); $ordered_data = "$ordered_data" . "\n ¾®·×¶â³Û ------------------- $c_ordered_z_sub_total ±ß \n"; if ($ordered{freight}) { $c_ordered_freight = &commas($ordered{freight}); $ordered_data = "$ordered_data" . " ±¿Ä ----------------------- $c_ordered_freight ±ß \n"; } $c_ordered_tax = &commas($ordered{tax}); $ordered_data = "$ordered_data" . " ¾ÃÈñÀÇ --------------------- $c_ordered_tax ±ß \n"; $c_ordered_gross_total = &commas($ordered{gross_total}); $ordered_data = "$ordered_data" . " ¹ç·× ----------------------- $c_ordered_gross_total ±ß \n\n"; if (-e $how_to_pay_file) { $how_to_pay = ""; $warning_title = "$how_to_pay_file"; open (HOW, "$how_to_pay_file") || (&warning, exit(0)); while () { chomp; $how_to_pay = "$how_to_pay" . "$_\n"; } } else { $how_to_pay = <) { chomp; $message = "$message" . "$_\n"; } } else { $message = <h2z->jis; $owner_body = jcode($user_body)->h2z->jis; $subject_to_user = jcode($subject_to_user)->h2z->jis; $header_coded_user = jcode($subject_to_user)->mime_encode; $subject_to_owner = jcode($subject_to_owner)->h2z->jis; $header_coded_owner = jcode($subject_to_owner)->mime_encode; $mailprog="sendmail -t"; open(MESSAGE, "|$mailprog") || die("System Error ! mailprog not available"); print MESSAGE "To: $address_owner, \n"; print MESSAGE "From: $address_owner, \n"; print MESSAGE "Subject: $header_coded_owner\n\n"; print MESSAGE "$owner_body\n"; close(MESSAGE); open(MESSAGEUS, "|$mailprog") || die("System Error ! mailprog not available"); print MESSAGEUS "To: $address_user, \n"; print MESSAGEUS "From: $address_owner, \n"; print MESSAGEUS "Subject: $header_coded_user\n\n"; print MESSAGEUS "$user_body\n"; close(MESSAGEUS); # Thank you ²èÌ̤òɽ¼¨¤¹¤?£ print "\n"; print "\n"; print "\n"; print "Thank you ɽ¼¨\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; &print_formatted_head; print "
\n"; print "
\n"; print "¤´Ãíʸ´°Î»\n"; print "
\n"; print "
\n"; print "¤´ÃíʸͭÆñ¤¦¤´¤¶¤¤¤Þ¤¹¡£
\n"; print "¤´ÃíʸÆâÍƤò¡¡$address_user¡¡¤Ë¥á¡¼¥?ǤªÃΤ餻¤·¤Æ¤¤¤Þ¤¹¡£
\n"; print "ÆâÍƤò³Îǧ¤·¸í¤ê¤¬¤¢¤??ç¤Ï¡¡$address_owner¡¡¤Þ¤Ç»?ޥ᡼¥?ǤªÃΤ餻²¼¤µ¤¤¡£

\n"; print "
\n"; &print_formatted_bottom; } ############################################### #´Ö°ã¤¤¤Î¹ðÃÎsub sub warning { ################################################# #html¥È¥Ã¥×¤Îɽ¼¨ #$type = ""; $title = "TOROKU_Wrong_$warning_title"; &make_top; print "
\n"; print "
\n"; print "$warning_title\n"; print "
\n"; ################################################# #html¥Ü¥È¥à¤Îɽ¼¨ &make_bottom; } ######################################### #html¥È¥Ã¥×¤Îɽ¼¨ sub make_top { print "Content-type: text/html\n\n"; print "\n"; print "\n"; #print "$type\n"; print "\n"; print "$title\n"; print "\n"; print "\n"; print "\n"; } ######################################### #html¥Ü¥È¥à¤Îɽ¼¨ sub make_bottom { print "\n"; print "\n"; } ######################################### #²Á³Ê¤ò¥«¥ó¥ÞÆ?¤ê¤Çɽ¼¨ sub commas { local($_) = @_; 1 while s/(.*\d)(\d\d\d)/$1,$2/; $_; }