#!/usr/bin/perl
require "./ain.pl";
#--------------------------------------------------------------------------
# 初期処理
#--------------------------------------------------------------------------
if ($] < 5) { &error('システムエラー','Perlはv5以降のバージョンを使用してください.'); }
if (!-e $base_dir) { &error('エラー',"データディレクトリが見つかりません."); }
$date_now = sprintf("%01d/%01d(%s)%02d:%02d:%02d",$mon +1,$mday,$wday_array[$wday],$hour,$min,$sec);
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
if ($ENV{'QUERY_STRING'} ne '') { $buffer .= "\&$ENV{'QUERY_STRING'}"; }
if ($center) { $center1 = '
EOF
}
if (!@NEW) { print "○ありません.
\n"; }
else {
print "検索結果 $FORM{'allhits'} 件 [ ";
$buf = join('&',@Buf);
$idx = join('+',@Index);
foreach (0 .. $#Index) {
$view_page = $_ + 1;
if ($FF == $Index[$_] || ($FORM{'FF'} eq '' && $_ == 0)) { print " $view_page"; $page_now = $view_page; }
else { print " $view_page"; }
}
$FROM = $page_now * $page - ($page - 1);
$LAST = $FROM + $count_new - 1;
if ($FORM{'action'} eq 'endlist') { $tmes = "落札情報"; } else { $tmes = "残り入札時間"; }
print <<"EOF";
] [最新の状態][登録する]
ページ
$page_now ($FROM〜$LAST)
登録日付 |
画像 |
猫種類 |
紹介文 |
EOF
if ($FORM{'action'} eq 'endlist') { print "(再)登録時間\n"; }
print " |
\n";
$f = 0;
foreach $directory (@NEW) {
1 while $GOODS{$directory}{'min_fee'} =~ s/(.*\d)(\d\d\d)/$1,$2/g;
$c++;
unless ($c % 2) { $bg = "#ffeedd"; } else { $bg = "#ffffff"; }
if ($GOODS{$directory}{'attc'} ne '') { $goods_view = "
"; } #写真付き
else { $goods_view = ""; }
if (open(DATA,"$base_dir$directory\.o\/tender.dat")) {
@TEND = ;
close(DATA);
($number2,$pwd,$now_fee,$handle,$user_name,$email,$post_number,$addr,$tel,$fax,$birth,$pref,$date,$host) = &DecodeCSV($TEND[$#TEND]);
1 while $now_fee =~ s/(.*\d)(\d\d\d)/$1,$2/g;
$now_fee2 = 0;
}
else { $now_fee = "(入札なし)"; $now_fee2 = 1; }
($limit,$remain) = &remain($directory);
if ($remain > 0) {
$bar = int($remain / 8640);
if ($bar == 0) { $bar = 1; }
if ($remain < 86400) { $bar_image ="red.gif"; }
elsif ($remain >= 86400 && $remain < 172800) { $bar_image ="yellow.gif"; }
else { $bar_image ="blue.gif"; }
$limit_time = " | ";
}
else {
if ($now_fee2) { $limit_time = "処理待機中(終了/再登録) | "; }
else { $limit_time = "落札者決定(案内中) | "; }
}
print <<"EOF";
$GOODS{$directory}{'start'} |
$goods_view |
$GOODS{$directory}{'goods_name'} |
$GOODS{$directory}{'goods_remarks'} |
EOF
if ($FORM{'action'} eq 'endlist') {
@START = ();
foreach (split("\0",$GOODS{$directory}{'start'})) { push(@START,$_); }
$START = join('
',@START);
}
print "
\n";
}
print <<"EOF";
EOF
}
print <<"EOF";
[
最新の状態]
[
登録する]
EOF
if ($FORM{'action'} ne 'endlist') { print "\n"; }
else { print "[
登録一覧]\n"; }
print <<"EOF";
$center2
Copyright(C) 2000 Wan Nyan Love Land Link All Rights Reserved,

EOF
exit;
sub DecodeCSV {
#--------------------------------------------------------------------------
# CSVデコード処理
#--------------------------------------------------------------------------
local($text) = @_;
local(@fields) = ();
local($a);
$text =~ s/\n//;
if ($text eq '') { return (); }
while ($text =~ m/"([^\\]*(\\.[^\\]*)*)",?|([^,]+),?|,/g) {
$a = defined($1) ? $1 : $3;
$a =~ s/""/"/g;
$a =~ s/&/&/g;
$a =~ s/"/"/g;
$a =~ s/</g;
$a =~ s/>/>/g;
push(@fields,$a);
}
push(@fields, undef) if $text =~ m/,$/;
@fields;
}
sub delete_all {
#--------------------------------------------------------------------------
# ディレクトリ内のファイルをすべて削除する処理
#--------------------------------------------------------------------------
local($dir) = @_; #ディレクトリ名
local($file,@list,$count,$count1);
$check = (eval { opendir(DIR,$dir); }, $@ eq "");
if (!$check) { &error("致命的なエラー","Can't get directory"); }
@list = readdir(DIR);
foreach $file (@list) {
next if $file eq '.';
next if $file eq '..';
$count1 = unlink "$dir/$file";
$count += $count1;
}
close(DIR);
return $count; #削除した数を返す
}
sub remain {
#--------------------------------------------------------------------------
# 残時間処理
#--------------------------------------------------------------------------
local($limit) = @_;
local($sec,$remain);
$now = time;
$remain = $sec = $limit - $now;
$DAY{'day'} = int($sec / 86400);
$sec = $sec - ($DAY{'day'} * 86400);
$DAY{'hour'} = int($sec / 3600);
$sec = $sec - ($DAY{'hour'} * 3600);
$DAY{'min'} = int($sec / 60);
$DAY{'sec'} = $sec - ($DAY{'min'} * 60);
if ($DAY{'day'} == 0) { return $DAY{'hour'} . '時間' . $DAY{'min'} . '分' . $DAY{'sec'} .'秒' , $remain; }
else { return $DAY{'day'} . '日' . $DAY{'hour'} . '時間' . $DAY{'min'} . '分' . $DAY{'sec'} .'秒' , $remain; }
}
sub GetData {
#--------------------------------------------------------------------------
# 出品データの読みこみ
#--------------------------------------------------------------------------
local($directory) = @_;
local($data,$key,$val);
if (open(DAT,"$base_dir$directory\.o/index.dat")) {
while (
) {
s/\n//g;
($key,$val) = split(/\t/);
$GOODS{$directory}{$key} .= "\0" if (defined($GOODS{$directory}{$key}));
$GOODS{$directory}{$key} .= $val;
}
close(DAT);
}
}
sub error {
#--------------------------------------------------------------------------
# エラー処理
#--------------------------------------------------------------------------
local (@msg) = @_;
local ($i);
print "Content-type: text/html\n\n";
print <<"EOF";
ERROR
$body
$center1
$_[0]
EOF
print "\n";
foreach $i (1 .. $#msg) { print "- $msg[$i]\n"; }
print "
\n";
print <<"EOF";
$center2