--- /dev/null
+#!/usr/bin/perl\r
+use vars qw(%set %in);\r
+use strict;\r
+$set{'log_file'} = './log.cgi'; #\83\8d\83O\83t\83@\83C\83\8b\96¼\r
+$set{'max_log'} = 30; #\95Û\8e\9d\8c\8f\90\94\r
+$set{'max_size'} = 1*1024; #\8dÅ\91å\93\8a\8de\97e\97Ê(KB)\r
+$set{'min_flag'} = 0; #\8dÅ\8f¬\97e\97Ê\90§\8cÀ\82ð\8eg\97p\82·\82é=1\r
+$set{'min_size'} = 100; #\8dÅ\8f¬\93\8a\8de\97e\97Ê(KB)\r
+$set{'max_all_flag'} = 0; #\91\8d\97e\97Ê\90§\8cÀ\82ð\8eg\97p\82·\82é=1\r
+$set{'max_all_size'} = 20*1024; #\91\8d\90§\8cÀ\97e\97Ê(KB)\r
+$set{'file_pre'} = 'up'; #\83t\83@\83C\83\8b\90Ú\93ª\8e«\r
+$set{'pagelog'} = 10; #1\83y\81[\83W\82É\95\\8e¦\82·\82é\83t\83@\83C\83\8b\90\94\r
+$set{'base_html'} = 'upload.html'; #1\83y\81[\83W\96Ú\82Ì\83t\83@\83C\83\8b\96¼\r
+$set{'interval'} = 0; #\93¯\88êIP\93\8a\8de\8aÔ\8au\95b\90\94\r
+$set{'deny_host'} = ''; #\93\8a\8de\8bÖ\8e~IP/HOST ,\82Å\8bæ\90Ø\82é ex.(bbtec.net,219.119.66,ac.jp)\r
+$set{'admin_name'} = 'admin'; #\8aÇ\97\9d\8eÒ\83\8d\83O\83C\83\93ID\r
+$set{'admin_pass'} = '1234'; #\8aÇ\97\9d\8eÒ\83p\83X\83\8f\81[\83h\r
+\r
+# \88È\89º5\8d\80\96Ú\82ð\8dÄ\90Ý\92è\82·\82é\8dÛ\82É\82ÍPATH\81C\83f\83B\83\8c\83N\83g\83\8a\82Í / \82Å\8fI\82í\82é\82±\82Æ\r
+# $set{'html_dir'},$set{'base_cgi'}\82ð ./ \88È\8aO\82É\90Ý\92è\82·\82é\8fê\8d\87,\r
+# \82Ü\82½\82ÍDLkey\82ð\8eg\97p\82µ \82È\82¨\82©\82ÂHTML\83L\83\83\83b\83V\83\85($set{'dummy_html'} = 2 or 3)\82ð\8eg\97p\82·\82é\8fê\8d\87\82Í\r
+# $set{'base_cgi'} , $set{'http_html_path'} , $set{'http_src_path'} \82ð\83t\83\8b\83p\83X(http://\81`\81` or /\81`\81`)\82Å\8bL\8fq\82·\82é\r
+$set{'html_dir'} = './'; # \93à\95\94HTML\95Û\91¶\83f\83B\83\8c\83N\83g\83\8a\r
+$set{'src_dir'} = './src/'; # \93à\95\94\83t\83@\83C\83\8b\95Û\91¶\83f\83B\83\8c\83N\83g\83\8a\r
+$set{'base_cgi'} = './upload.cgi'; # \82±\82Ì\83X\83N\83\8a\83v\83g\96¼ http://\81`\82Ì\8ew\92è\89Â\94\\r
+$set{'http_html_path'} = './'; # html\8eQ\8fÆ httpPATH http://\81`\82Ì\8ew\92è\89Â\94\\r
+$set{'http_src_path'} = './src/'; # file\8eQ\8fÆ httpPATH http://\81`\82Ì\8ew\92è\89Â\94\\r
+\r
+$set{'dlkey'} = 0; # DLKey\82ð\8eg\97p\82·\82é=1,DLkey\95K\90{=2\r
+$set{'up_ext'} = 'txt,lzh,zip,rar,gca,mpg,mp3,avi,swf,bmp,jpg,gif,png'; #\83A\83b\83v\83\8d\81[\83h\82Å\82«\82é\8aî\96{\8ag\92£\8eq \94¼\8ap\89p\90\94\8f¬\95¶\8e\9a ,\82Å\8bæ\90Ø\82é\r
+$set{'up_all'} = 0; #\93o\98^\88È\8aO\82Ì\82à\82Ì\82àUP\82³\82¹\82ç\82ê\82é\82æ\82¤\82É\82·\82é=1\r
+$set{'ext_org'} = 0; #$set{'up_all'}\82ª1\82Ì\8e\9e\83I\83\8a\83W\83i\83\8b\82Ì\8ag\92£\8eq\82É\82·\82é=1\r
+$set{'deny_ext'} = 'php,php3,phtml,rb,sh,bat,dll'; #\93\8a\8de\8bÖ\8e~\82Ì\8ag\92£\8eq \94¼\8ap\89p\90\94\8f¬\95¶\8e\9a ,\82Å\8bæ\90Ø\82é\r
+$set{'change_ext'} = 'cgi->txt,pl->txt,log->txt,jpeg->jpg,mpeg->mpg'; #\8ag\92£\8eq\95Ï\8a· \91O->\8cã \94¼\8ap\89p\90\94\8f¬\95¶\8e\9a ,\82Å\8bæ\90Ø\82é\r
+\r
+$set{'home_url'} = ''; #[HOME]\82Ì\83\8a\83\93\83N\90æ \91\8a\91Î\83p\83X\96\94\82Í http://\82©\82ç\8en\82Ü\82é\90â\91Î\83p\83X\r
+$set{'html_all'} = 1; #[ALL]\82ð\8fo\82·=1\r
+$set{'dummy_html'} = 0; #\83t\83@\83C\83\8b\8cÂ\95ÊHTML\82ð\8dì\90¬\82·\82é \92Ê\8fí\83t\83@\83C\83\8b\82Ì\82Ý=1,DLKey\90Ý\92è\83t\83@\83C\83\8b\82Ì\82Ý=2,\82·\82×\82Ä=3\r
+$set{'find_crypt'} = 1; #\88Ã\8d\86\89»ZIP\82ð\8c\9f\8fo\82·\82é=1\r
+$set{'binary_compare'} = 0; #\8aù\91¶\83t\83@\83C\83\8b\82Æ\83o\83C\83i\83\8a\94ä\8ar\82·\82é=1\r
+$set{'post_flag'} = 0; #PostKey\82ð\8eg\97p\82·\82é=1\r
+$set{'post_key'} = 'postkey'; #PostKey ,\82Å\8bæ\90Ø\82é\82Æ\95¡\90\94\8ew\92è ex.(postkey1,postkey2)\r
+$set{'disp_error'} = 1; #\83\86\81[\83U\81[\82É\83G\83\89\81[\82ð\95\\8e¦\82·\82é=1\r
+$set{'error_level'} = 1; #\83G\83\89\81[\83\8d\83O\82ð\8bL\98^\82·\82é=1\r
+$set{'error_log'} = './error.cgi'; #\83G\83\89\81[\83\8d\83O\83t\83@\83C\83\8b\96¼\r
+$set{'error_size'} = 1024; # \83G\83\89\81[\83\8d\83O\8dÅ\91å\97e\97Ê(KB) \90§\8cÀ\82È\82µ=0\r
+$set{'zero_clear'} = 1; #\83t\83@\83C\83\8b\82ª\8c©\82Â\82©\82ç\82È\82¢\8fê\8d\87\83\8d\83O\82©\82ç\8dí\8f\9c\82·\82é=1\r
+\r
+$set{'disp_comment'} = 1; #\83R\83\81\83\93\83g\82ð\95\\8e¦\82·\82é=1\r
+$set{'disp_date'} = 1; #\93ú\95t\82ð\95\\8e¦\82·\82é=1\r
+$set{'disp_size'} = 1; #\83T\83C\83Y\82ð\95\\8e¦\82·\82é=1\r
+$set{'disp_mime'} = 1; #MIMETYPE\82ð\95\\8e¦\82·\82é=1\r
+$set{'disp_orgname'} = 1; #\83I\83\8a\83W\83i\83\8b\83t\83@\83C\83\8b\96¼\82ð\95\\8e¦\82·\82é=1\r
+\r
+$set{'per_upfile'} = 0666; #\83A\83b\83v\83\8d\81[\83h\83t\83@\83C\83\8b\82Ì\83p\81[\83~\83b\83V\83\87\83\93 suexec=0604,other=0666\r
+$set{'per_dir'} = 0777; #\83\\81[\83X\83A\83b\83v\83f\83B\83\8c\83N\83g\83\8a\82Ì\83p\81[\83~\83b\83V\83\87\83\93 suexec=0701,other=0777\r
+$set{'per_logfile'} = 0666; #\83\8d\83O\83t\83@\83C\83\8b\82Ì\83p\81[\83~\83b\83V\83\87\83\93\81@suexec=0600,other=0666\r
+$set{'link_target'} = ''; #target\91®\90«\r
+\r
+#------\r
+$set{'ver'} = '2005/10/10e';\r
+$set{'char_delname'} = 'D';\r
+\r
+$in{'time'} = time(); $in{'date'} = conv_date($in{'time'});\r
+$in{'addr'} = $ENV{'REMOTE_ADDR'};\r
+$in{'host'} = gethostbyaddr(pack('C4',split(/\./, $in{'addr'})), 2) || $ENV{'REMOTE_HOST'} || '(none)';\r
+\r
+if($in{'addr'} eq $in{'host'}){ $in{'host'} = '(none)'; }\r
+\r
+$set{'html_head'} =<<"EOM";\r
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">\r
+<html lang="ja">\r
+<HEAD>\r
+<META name="robots" content="noindex,nofollow">\r
+<META name="ROBOTS" content="NOINDEX,NOFOLLOW">\r
+<META http-equiv="Content-type" content="text/html; charset=Shift_JIS">\r
+<META http-equiv="Pragma" content="no-cache">\r
+<META http-equiv="Cache-Control" content="no-cache">\r
+<META http-equiv="Expires" content="0">\r
+<TITLE>Uploader</TITLE>\r
+EOM\r
+\r
+$set{'html_css'} =<<"EOM";\r
+<META http-equiv="Content-Style-Type" content="text/css">\r
+<STYLE type="text/css"><!--\r
+input,td{ font-size: 10pt;font-family:Chicago,Verdana,Arial,sans-serif,"\82l\82r \82o\83S\83V\83b\83N"; }\r
+a:hover { background-color:#EECCCC; }\r
+input,textarea{ border-top : 1px solid ; border-bottom : 1px solid ; border-left : 1px solid ; border-right : 1px solid ;font-size:10pt;background-color:#FFFFFF; }\r
+-->\r
+</STYLE>\r
+EOM\r
+\r
+unless(-e $set{'log_file'}){ &init; }\r
+unless(-e $set{'base_html'}){ &makehtml; }\r
+{ #\83f\83R\81[\83h\r
+ my $readbuffsize = 1024*8;\r
+ if ($ENV{'REQUEST_METHOD'} eq "POST" && $ENV{'CONTENT_TYPE'} =~ /multipart\/form-data/i){\r
+ if ($ENV{'CONTENT_LENGTH'} > ($set{'max_size'} * 1024 + 1024)){ if($ENV{'SERVER_SOFTWARE'} =~ /IIS/){ while(read(STDIN,my $buff,$readbuffsize)){} } &error(106,$ENV{'CONTENT_LENGTH'});}\r
+ }else{\r
+ if ($ENV{'CONTENT_LENGTH'} > 1024*100){ error(98); }\r
+ }\r
+ my %ck; foreach(split(/;/,$ENV{'HTTP_COOKIE'})){ my($key,$val) = split(/=/); $key =~ s/\s//g; $ck{$key} = $val;}\r
+ my @ck = split(/<>/,$ck{'SN_USER'});\r
+ if(length($ck[0]) < 5){ \r
+ my @salt = ('a'..'z', 'A'..'Z', '0'..'9', '.', '/'); srand;\r
+ my $salt = $salt[int(rand(@salt))] . $salt[int(rand(@salt))];\r
+ $in{'user'} = crypt($in{'addr'}.$in{'time'}, $salt);\r
+ }else{ $in{'user'} = $ck[0]; }\r
+\r
+ if($ENV{'REQUEST_METHOD'} eq "POST" && $ENV{'CONTENT_TYPE'} =~ /multipart\/form-data/i){\r
+ my %FORM; my $subbuff; my $filename; my $valuename;\r
+ my $upflag; my $valueflag; my $bound; my $mime;\r
+ my $readlength = 0;\r
+ my $random = int(rand(900000)) + 100000;\r
+ my $endflag = 0;\r
+ binmode(STDIN);\r
+ while(<STDIN>){ $readlength += length($_); if(/(--.*)\r\n$/){ $bound = $1; last; }}\r
+ if(-e "$set{'src_dir'}$random.temporary"){ $random++; }\r
+ if(-e "$set{'src_dir'}$random.temporary"){ $random++; }\r
+ if(-e "$set{'src_dir'}$random.temporary"){ &error(204); }\r
+\r
+ open(OUT,">$set{'src_dir'}$random.temporary");\r
+ binmode(OUT);\r
+ my $formbuff;\r
+ while(my $buff = <STDIN>){\r
+ $readlength += length($buff);\r
+ if($upflag == 1){ if($buff =~ /Content-Type:\s(.*)\r\n$/i){ $mime = $1; } $upflag++; next;}\r
+ if($upflag == 2){\r
+ while(1){\r
+ my $readblen; my $filebuff;\r
+ if($ENV{'CONTENT_LENGTH'} - $readlength < $readbuffsize){ $readblen = $ENV{'CONTENT_LENGTH'} - $readlength; }\r
+ else{ $readblen = $readbuffsize; }\r
+ if(!read(STDIN,$filebuff,$readblen)){ last };\r
+ $readlength += length($filebuff);\r
+ if($ENV{'CONTENT_LENGTH'} - $readlength < $readbuffsize){\r
+ my $readblen = $ENV{'CONTENT_LENGTH'} - $readlength;\r
+ read(STDIN,my $subbuff,$readblen);\r
+ $readlength += length($subbuff);\r
+ $filebuff .= $subbuff;\r
+ $endflag = 1;\r
+ }\r
+ my $offset = index($filebuff,$bound);\r
+ if($offset >= 0){\r
+ $buff = substr($filebuff,0,$offset-2); my $subbuff = substr($filebuff,$offset);\r
+ print OUT $buff; $upflag = 0; $formbuff .= $subbuff; last;\r
+ }else{ print OUT $filebuff; }\r
+ }\r
+ if($endflag){ last; }\r
+ next;\r
+ }\r
+ if($buff =~ /^Content-Disposition:\sform-data;\sname=\"upfile\";\sfilename=\"(.*)\"\r\n$/i){\r
+ $filename = $1; $upflag = 1; next;\r
+ }\r
+ $formbuff .= $buff;\r
+ }\r
+ close(OUT);\r
+ chmod($set{'per_upfile'},"$set{'src_dir'}$random.temporary");\r
+ { my $value;\r
+ foreach my $buff(split(/\r\n/,$formbuff)){\r
+ $buff .= "\r\n";\r
+ if($buff =~ /^$bound\-\-/){ $FORM{$value} =~ s/\r\n$//; $valueflag = 0; last;}\r
+ if($buff =~ /^$bound/){ $FORM{$value} =~ s/\r\n$//; $valueflag = 0; next;}\r
+ if($valueflag == 1){ $valueflag++; next; }\r
+ if($valueflag == 2){ $FORM{$value} .= $buff; }\r
+ if($buff =~ /^Content-Disposition: form-data; name=\"(.+)\"\r\n$/){ $value = $1; $valueflag++; }\r
+ }\r
+ }\r
+ if($upflag || $valueflag){ unlink("$set{'src_dir'}$random.temporary"); &error(108);}\r
+\r
+ $in{'org_pass'} = $in{'pass'} = $FORM{'pass'};\r
+ $in{'dlkey'} = $FORM{'dlkey'};\r
+ $in{'comment'} = $FORM{'comment'};\r
+ $in{'jcode'} = $FORM{'jcode'};\r
+ $in{'postkey'} = $FORM{'postkey'};\r
+ $in{'upfile'} = $filename;\r
+ $in{'type'} = $mime;\r
+ $in{'tmpfile'} = "$set{'src_dir'}$random.temporary";\r
+ $in{'orgname'} = $in{'upfile'};\r
+ if(-s "$in{'tmpfile'}" == 0){ unlink("$in{'tmpfile'}"); &error(99) }\r
+ if($set{'min_flag'} && ((-s "$in{'tmpfile'}") < $set{'min_size'} * 1024)){ &error(107,(-s "$in{'tmpfile'}"));}\r
+ if((-s "$in{'tmpfile'}") > $set{'max_size'} * 1024){ &error(106,(-s "$in{'tmpfile'}"));}\r
+ if($set{'post_flag'} && !check_postkey($in{'postkey'})){ &error(109); }\r
+ if($set{'dlkey'} == 2 && !$in{'dlkey'}){ unlink("$in{'tmpfile'}"); &error(61); }\r
+ }else{\r
+ my ($buffer,%FORM,@admin_delno);\r
+ if ($ENV{'REQUEST_METHOD'} eq "POST") { read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});}\r
+ else { $buffer = $ENV{'QUERY_STRING'}; }\r
+ my @pairs = split(/&/,$buffer);\r
+ foreach my $pair (@pairs) {\r
+ my ($name, $value) = split(/=/, $pair);\r
+ $value =~ tr/+/ /;\r
+ $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;\r
+ if($name eq 'admin_delno'){\r
+ push(@admin_delno,$value);\r
+ }else{\r
+ $FORM{$name} = $value;\r
+ }\r
+ }\r
+ $in{'delpass'} = $FORM{'delpass'};\r
+ $in{'delno'} = $FORM{'delno'};\r
+ $in{'file'} = $FORM{'file'};\r
+ $in{'dlkey'} = $FORM{'dlkey'};\r
+ $in{'mode'} = $FORM{'mode'};\r
+ $in{'checkmode'} = $FORM{'checkmode'};\r
+ $in{'admin_delno'} = join(',',@admin_delno);\r
+ if($in{'delno'} eq $set{'admin_name'} && $in{'delpass'} eq $set{'admin_pass'}){ &admin_mode(); }\r
+ if(!$in{'delno'} && $in{'delpass'} eq $set{'admin_pass'}){ &makehtml; &quit; }\r
+ }\r
+\r
+ my @denyhost = split(/,/,$set{'deny_host'});\r
+ foreach my $value (@denyhost){\r
+ if ($in{'addr'} =~ /$value/ || $in{'host'} =~ /$value/){ &error(101);}\r
+ }\r
+\r
+ my @form = ($in{'comment'},$in{'orgname'},$in{'type'},$in{'dlkey'});\r
+ foreach my $value (@form) {\r
+ if (length($value) > 128) { $value = substr($value,0,128).'...'; }\r
+# $value =~ s/&/&/g;\r
+ $value =~ s/"/"/g;\r
+ $value =~ s/</</g;\r
+ $value =~ s/>/>/g;\r
+ $value =~ s/\r//g;\r
+ $value =~ s/\n//g;\r
+ $value =~ s/\t//g;\r
+ $value =~ s/\0//g;\r
+ }\r
+ ($in{'comment'},$in{'orgname'},$in{'type'},$in{'dlkey'}) = @form;\r
+}\r
+\r
+\r
+if($in{'mode'} eq 'delete'){ &delete(); &quit(); }\r
+if($in{'mode'} eq 'dl'){ &dlfile;} #DL\r
+if(!$in{'upfile'}){ &error(99); }\r
+\r
+{#\83\81\83C\83\93\8f\88\97\9d\r
+\r
+ open(IN,$set{'log_file'})||&error(303);\r
+ my @log = <IN>;\r
+ close(IN);\r
+ my ($no,$lastip,$lasttime) = split(/<>/,$log[0]);\r
+\r
+ if($set{'interval'} && $in{'time'} <= ($lasttime + $set{'interval'}) && $in{'addr'} eq $lastip){ &error(203);}\r
+ $in{'ext'} = extfind($in{'orgname'}); if(!$in{'ext'}){ &error(202); }\r
+\r
+ my $orgname;\r
+ if(split(/\//,$in{'orgname'}) > split(/\\/,$in{'orgname'})){ my @name = split(/\//,$in{'orgname'}); $orgname = $name[$#name]; }\r
+ else{ my @name = split(/\\/,$in{'orgname'}); $orgname = $name[$#name];}\r
+ \r
+ my @salt = ('a'..'z', 'A'..'Z', '0'..'9', '.', '/');\r
+ srand;\r
+ my $salt = $salt[int(rand(@salt))] . $salt[int(rand(@salt))];\r
+ $in{'pass'} = crypt($in{'pass'}, $salt);\r
+\r
+ if($set{'binary_compare'}){\r
+ my @files = globfile("$set{'src_dir'}",".*");\r
+ my @dir = globdir("$set{'src_dir'}",".*");\r
+ foreach my $dir (@dir){ push(@files,globfile($dir."/",".*")); }\r
+ foreach my $value (@files){\r
+ next if($value =~ /\.temporary$/);\r
+ if(binarycmp($in{'tmpfile'},$value)){ unlink($in{'tmpfile'}); &error(205,$value);}\r
+ }\r
+ }\r
+\r
+ if($set{'find_crypt'}){\r
+ open(FILE,$in{'tmpfile'}); binmode(FILE); seek(FILE,0,0); read(FILE,my $buff,4); my $crypt_flag = 0;\r
+ if($buff =~ /^\x50\x4b\x03\x04$/){ seek(FILE,6,0); read(FILE,my $buff,1); $crypt_flag = 1 if(($buff & "\x01") eq "\x01"); }\r
+ close(FILE);\r
+ $in{'comment'} = '<font color="#FF0000">*</font>'.$in{'comment'} if($crypt_flag);\r
+ }\r
+\r
+ open(IN,$set{'log_file'})||&error(303);\r
+ @log = <IN>;\r
+ close(IN);\r
+ ($no,$lastip,$lasttime) = split(/<>/,$log[0]);\r
+ shift(@log);\r
+ $no++;\r
+ my $tmpno = sprintf("%04d",$no);\r
+\r
+ my $dlsalt;\r
+ my $filedir;\r
+ my $allsize = (-s $in{'tmpfile'});\r
+ \r
+ if($set{'dlkey'} && $in{'dlkey'}){\r
+ my @salt = ('a'..'z', 'A'..'Z', '0'..'9'); srand;\r
+ for (my $c = 1; $c <= 20; ++$c) { $dlsalt .= $salt[int(rand(@salt))]; }\r
+ $filedir = "$set{'src_dir'}$set{'file_pre'}${tmpno}.$in{'ext'}_$dlsalt/";\r
+ mkdir($filedir,$set{'per_dir'});\r
+ rename("$in{'tmpfile'}","$filedir$set{'file_pre'}$tmpno.$in{'ext'}");\r
+ open(OUT,">${filedir}index.html");\r
+ close(OUT);\r
+ chmod($set{'per_upfile'},"${filedir}index.html");\r
+ $in{'comment'} = '<font color="#FF0000">[DLKey] </font>'.$in{'comment'};\r
+ }else{\r
+ undef $in{'dlkey'};\r
+ rename("$in{'tmpfile'}","$set{'src_dir'}$set{'file_pre'}$tmpno.$in{'ext'}");\r
+ }\r
+\r
+ if (length($orgname) > 128) { $orgname = substr($orgname,0,128).'...'; }\r
+\r
+ my @note;\r
+ if($set{'post_flag'} && $set{'post_key'}){\r
+ push(@note,'PostKey:'.$in{'postkey'});\r
+ }\r
+ if($ENV{'SERVER_SOFTWARE'} =~ /Apache|IIS/){\r
+ my $disptime;\r
+ my $time = time() - $in{'time'};\r
+ my @str = ('Upload:','\95b');\r
+ my $disptime = $time.$str[1];\r
+ push(@note,$str[0].$disptime);\r
+ }\r
+ if($in{'dlkey'}){\r
+ my @salt = ('a'..'z', 'A'..'Z', '0'..'9', '.', '/'); srand;\r
+ my $salt = $salt[int(rand(@salt))] . $salt[int(rand(@salt))];\r
+ my $crypt_dlkey = crypt($in{'dlkey'}, $salt);\r
+ push(@note,"DLKey<!-- DLKey:".$crypt_dlkey." --><!-- DLpath:".$dlsalt." -->");\r
+ }\r
+ my $note = join(',',@note);\r
+ my $usersalt = substr($in{'user'},0,2);\r
+ my $userid = crypt($in{'user'},$usersalt);\r
+ $in{'time'} = time();\r
+# $in{'date'} = conv_date(time());\r
+ my @new;\r
+ $new[0] = "$no<>$in{'addr'}<>$in{'time'}<>1\n";\r
+ my $addlog = "$no<>$in{'ext'}<>$in{'date'}<>$in{'comment'}<>$in{'type'}<>$orgname<>$in{'addr'}<>$in{'host'}<>$in{'pass'},$userid<>$set{'file_pre'}<>$note<>1\n";\r
+ $new[1] = $addlog;\r
+\r
+# open(OUT,">>./alllog.cgi"); print OUT $addlog; close(OUT);\r
+\r
+ my $i = 2;\r
+\r
+ foreach my $value (@log){\r
+ my ($no,$ext,$date,$comment,$mime,$orgname,$addr,$host,$pass,$filepre,$note,$dummy) = split(/<>/,$value);\r
+ if(!$dummy){ $filepre = $set{'file_pre'};}\r
+ $no = sprintf("%04d",$no);\r
+\r
+ my $filename;\r
+ my $filedir;\r
+ if($note =~ /DLpath:(.+)\s/){\r
+ my $dlpath = $1;\r
+ $filename = "$set{'src_dir'}$filepre$no.${ext}_$dlpath/$filepre$no.$ext";\r
+ $filedir = "$set{'src_dir'}$filepre$no.${ext}_$dlpath/";\r
+ }else{\r
+ $filename = "$set{'src_dir'}$filepre$no.$ext";\r
+ }\r
+ $allsize += (-s $filename);\r
+ \r
+ if($i <= $set{'max_log'} && !($set{'max_all_flag'} && $set{'max_all_size'}*1024 < $allsize)){ \r
+ if((-e $filename)||!$set{'zero_clear'}){ push(@new,$value); $i++; }\r
+ }else{\r
+ if(unlink($filename)){\r
+ unlink("$set{'src_dir'}$filepre$no.$ext.html"); if($filedir){ foreach(globfile($filedir,".*")){ unlink; } } rmdir($filedir);\r
+ }elsif(unlink($filename)){\r
+ unlink("$set{'src_dir'}$filepre$no.$ext.html"); if($filedir){ foreach(globfile($filedir,".*")){ unlink; } } rmdir($filedir);\r
+ }elsif(-e $filename){\r
+ push(@new,$value);\r
+ }else{\r
+ unlink("$set{'src_dir'}$filepre$no.$ext.html"); if($filedir){ foreach(globfile($filedir,".*")){ unlink; } } rmdir($filedir);\r
+ }\r
+ }\r
+ }\r
+ logwrite(@new);\r
+ if($in{'dlkey'} && ( $set{'dummy_html'} == 2 || $set{'dummy_html'} == 3)){\r
+ &makedummyhtml("$set{'file_pre'}$tmpno.$in{'ext'}",$in{'comment'},"$set{'file_pre'}$tmpno.$in{'ext'}",$dlsalt,$in{'date'},$in{'type'},$orgname,$no);\r
+ }elsif(!$in{'dlkey'} && ($set{'dummy_html'} == 1 || $set{'dummy_html'} == 3)){\r
+ &makedummyhtml("$set{'file_pre'}$tmpno.$in{'ext'}");\r
+ }\r
+ &makehtml(); &quit();\r
+}\r
+\r
+sub makehtml{\r
+\r
+ my ($buff,$init,$postval,$dlkey);\r
+ my $page = 0; my $i = 1;\r
+ \r
+ open(IN,$set{'log_file'})||&error(303);\r
+ my $log = my @log = <IN>;\r
+ close(IN);\r
+ \r
+ if($log == 1){ $log++; $init++;}\r
+ my $lastpage = int(($log - 2)/$set{'pagelog'}) + 1;\r
+ $postval = ' obj.postkey.value = unescape(p[1]);' if($set{'post_flag'});\r
+ my $header =<<"EOM";\r
+$set{'html_head'}<META http-equiv="Content-Script-Type" content="text/javascript">\r
+<script type="text/javascript">\r
+<!--\r
+function getCookie(obj,cookiename){\r
+ var i,str; c = new Array(); p = new Array("",""); str = document.cookie;c = str.split(";");\r
+ for (i = 0; i < c.length; i++) { if (c[i].indexOf(cookiename+"=") >= 0) { p = (c[i].substr(c[i].indexOf("=")+1)).split("<>"); break; }}\r
+ if(cookiename == "SN_UPLOAD"){ obj.pass.value = unescape(p[0]);$postval }\r
+ else if(cookiename == "SN_DEL"){ obj.delpass.value = unescape(p[0]);}\r
+ return true;\r
+}\r
+function delnoin(no){\r
+ document.Del.delno.value = no;\r
+ document.Del.del.focus();\r
+}\r
+//-->\r
+</script>\r
+$set{'html_css'}</HEAD>\r
+<body bgcolor="#ffffff" text="#000000" LINK="#6060FF" VLINK="#6060FF" ALINK="#6060FF" onload="getCookie(document.Form,'SN_UPLOAD');getCookie(document.Del,'SN_DEL');">\r
+<table summary="title" width="100%"><tr><td bgcolor="#caccff"><strong><font size="4" color="#3366cc">Uploader</font></strong></td></tr></table>\r
+<p>\r
+Now.. Testing..\r
+</p>\r
+EOM\r
+ my $maxsize = 'Max '.dispsize($set{'max_size'}*1024);\r
+ my ($minsize,$total);\r
+ if($set{'min_flag'}){ $minsize = 'Min '.dispsize($set{'min_size'}*1024).' - '; }\r
+ if($set{'max_all_flag'}){ $total .= ' Total '.dispsize($set{'max_all_size'}*1024);}\r
+ $header .= qq|<FORM METHOD="POST" ENCTYPE="multipart/form-data" ACTION="$set{'base_cgi'}" name="Form">FILE $minsize$maxsize (*$set{'max_log'}Files$total)<br>|;\r
+ $header .='<INPUT TYPE=file SIZE="40" NAME="upfile">';\r
+ $header .= ' DLKey: <INPUT TYPE=text SIZE="8" NAME="dlkey" maxlength="8">' if($set{'dlkey'});\r
+ $header .= '\r
+DELKey: <INPUT TYPE=password SIZE="10" NAME="pass" maxlength="8"><br>\r
+COMMENT<br>\r
+<INPUT TYPE=text SIZE="45" NAME="comment">\r
+<INPUT TYPE=hidden NAME="jcode" VALUE="\8a¿\8e\9a">\r
+<INPUT TYPE=submit VALUE="Upload"><INPUT TYPE=reset VALUE="Cancel"><br>\r
+';\r
+ if($set{'post_flag'}){ $header .= 'PostKey<br><INPUT TYPE=password SIZE="10" NAME="postkey" maxlength="10">'; }\r
+ $header .= '</FORM>';\r
+\r
+ my $allsize = 0;\r
+ my @files = globfile("$set{'src_dir'}",".*");\r
+ my @dir = globdir("$set{'src_dir'}",".*");\r
+ foreach my $dir (@dir){ push(@files,globfile($dir."/",".*")); }\r
+ foreach my $value (@files){ $allsize += (-s "$value"); }\r
+\r
+ $allsize = dispsize($allsize);\r
+\r
+ my $footer = "</table><HR size=1>Used ${allsize}\n<br>";\r
+ if($set{'up_all'} && !$set{'ext_org'}){ $footer .= $set{'up_ext'}.' +'; }\r
+ elsif(!$set{'up_all'}){ $footer .= $set{'up_ext'}; }\r
+ $footer .= "\n<table summary=\"footer\" width=\"100%\"><tr><td><div align=left><FORM METHOD=POST ACTION=\"$set{'base_cgi'}\" name=\"Del\"><span style='font-size:9pt'><input type=hidden name=mode value=delete>No.<input type=text size=4 name=delno> key<input type=password size=4 name=delpass> <input type=submit value=\"del\" name=del></span></form></div>\n";\r
+ $footer .= "</td><td><div align=right><!-- $set{'ver'} --><a href=\"http://sugachan.dip.jp/download/\" target=\"_blank\"><small>Sn Uploader</small></a></div></td></tr></table>\n</body>\n</html>";\r
+\r
+ my $info_title = "<table summary=\"upinfo\" width=\"100%\">\n<tr><td></td><td>NAME</td>";\r
+ if($set{'disp_comment'}){ $info_title .= "<td>COMMENT</td>"; } if($set{'disp_size'}){ $info_title .= "<td>SIZE</td>"; } if($set{'disp_date'}){ $info_title .= "<td>DATE</td>"; }\r
+ if($set{'disp_mime'}){ $info_title .= "<td>MIME</td>"; } if($set{'disp_orgname'}){ $info_title .= "<td>ORIG</td>"; }\r
+ $info_title .= "</tr>\n";\r
+\r
+ my $home_url_link;\r
+ if($set{'home_url'}){ $home_url_link = qq|<a href="$set{'home_url'}">[HOME]</a> |;}\r
+ if($set{'html_all'}){\r
+ my $buff; my $no = 1; my $time = time; my $subheader;\r
+ foreach my $value (@log){\r
+ my ($no,$ext,$date,$comment,$mime,$orgname,$addr,$host,$pass,$dummy) = split(/<>/,$value);\r
+ if(!$dummy){ next; }\r
+ $buff .= makeitem($value);\r
+ }\r
+ $subheader .= "[ALL] ";\r
+ while($no <= $lastpage){\r
+ if($no == $page) { $subheader .= "\[$no\] ";}\r
+ else{ if($no == 1){ $subheader .= "<a href=\"$set{'http_html_path'}$set{'base_html'}?$time\">\[$no\]</a> "}\r
+ else{$subheader .= "<a href=\"$set{'http_html_path'}$no.html?$time\">\[$no\]</a> ";} }\r
+ $no++;\r
+ }\r
+ $subheader .= $info_title;\r
+ open(OUT,">$set{'html_dir'}all.html")||&error(306,"$set{'html_dir'}all.html");\r
+ print OUT $header."<hr size=1>".$home_url_link.$subheader."<hr size=1>".$buff.$footer;\r
+ close(OUT);\r
+ chmod($set{'per_upfile'},"$set{'html_dir'}all.html");\r
+ }else{ unlink("$set{'html_dir'}all.html"); }\r
+ \r
+ while($log > $i){\r
+ $buff .= makeitem($log[$i]) unless($init);\r
+ if(($i % $set{'pagelog'}) == 0||$i == $log -1){\r
+ $page++; my $subheader; my $no = 1; my $time = time;\r
+ if($set{'html_all'}){ $subheader .= "<a href=\"./all.html?$time\">[ALL]</a> "; }\r
+ while($no <= $lastpage){\r
+ if($no == $page) { $subheader .= "\[$no\] ";}\r
+ else{ if($no == 1){ $subheader .= "<a href=\"$set{'http_html_path'}$set{'base_html'}?$time\">\[$no\]</a> "}\r
+ else{$subheader .= "<a href=\"$set{'http_html_path'}$no.html?$time\">\[$no\]</a> ";}\r
+ }\r
+ $no++;\r
+ }\r
+ $subheader .= $info_title;\r
+ my $loghtml;\r
+ if($page == 1){ $loghtml = "$set{'html_dir'}$set{'base_html'}"; }\r
+ else{ $loghtml = "$set{'html_dir'}$page.html"; }\r
+\r
+ open(OUT,">$loghtml") || &error(306,"$loghtml");\r
+ print OUT $header."<hr size=1>".$home_url_link.$subheader."<hr size=1>".$buff.$footer;\r
+ close(OUT);\r
+ chmod($set{'per_upfile'},$loghtml);\r
+ undef $buff;\r
+ }\r
+ $i++;\r
+ }\r
+\r
+ while($page < 1000){\r
+ $page ++;\r
+ if(-e "$set{'html_dir'}$page.html"){ unlink("$set{'html_dir'}$page.html"); }else{ last; }\r
+ }\r
+}\r
+\r
+sub delete{\r
+ my $mode = $_[0];\r
+ my @delno = split(/,/,$_[1]);\r
+ my $delno; my $flag = 0; my $tmpaddr;\r
+ my $delnote;\r
+\r
+ if($in{'delno'} =~ /(\d+)/){ $delno = $1; }\r
+ if($mode ne 'admin' && !$in{'delno'}){ return; }\r
+ elsif($mode ne 'admin' && !$delno){ &error(401,$in{'delno'}); }\r
+\r
+ open(IN,$set{'log_file'})|| &error(303);\r
+ my @log = <IN>;\r
+ close(IN);\r
+\r
+ if($in{'addr'} =~ /(\d+).(\d+).(\d+).(\d+)/){ $tmpaddr = "$1.$2.$3."; }\r
+ my $findflag = 0;\r
+ foreach my $value (@log){\r
+ my ($no,$ext,$date,$comment,$mime,$orgname,$addr,$host,$pass,$filepre,$note,$dummy) = split(/<>/,$value);\r
+ $delnote = $note;\r
+ my $delflag = 0;\r
+ if(!$addr){ next; }\r
+ if($mode eq 'admin'){\r
+ foreach my $delno (@delno){ if($no == $delno){ $delflag = 1; last; } }\r
+ }elsif($no == $delno){\r
+ $findflag = 1;\r
+ unless ($addr =~ /^$tmpaddr/){\r
+ my ($pass,$id) = split(/,/,$pass);\r
+ my $delpass = $in{'delpass'} || $in{'addr'}.time();\r
+ my $salt = substr($pass, 0, 2); $delpass = crypt($delpass,$salt);\r
+ my $usersalt = substr($in{'user'},0,2); my $userid = crypt($in{'user'},$usersalt);\r
+ if ($in{'delpass'} ne $set{'admin_pass'} && $delpass ne $pass && $userid ne $id){ \r
+ if($mode ne 'admin'){ if(!$dummy){ $filepre = $set{'file_pre'};} $no = sprintf("%04d",$no); &error(404,"$filepre$no.$ext");}\r
+ }\r
+ }\r
+ $delflag = 1;\r
+ }\r
+ if($delflag){\r
+# open(OUT,">>./del.cgi"); print OUT $value; close(OUT);\r
+ $flag = 1;\r
+ if(!$dummy){ $filepre = $set{'file_pre'};}\r
+ $no = sprintf("%04d",$no);\r
+ my $filename;\r
+ my ($dlpath,$filedir);\r
+ if($delnote =~ /DLpath:(.+)\s/){\r
+ $dlpath = $1;\r
+ $filename = "$set{'src_dir'}$filepre$no.${ext}_$dlpath/$filepre$no.$ext";\r
+ $filedir = "$set{'src_dir'}$filepre$no.${ext}_$dlpath/";\r
+ }else{\r
+ $filename = "$set{'src_dir'}$filepre$no.$ext";\r
+ }\r
+ \r
+ if(unlink($filename)){\r
+ unlink("$set{'src_dir'}$filepre$no.$ext.html"); if($filedir){ foreach(globfile($filedir,".*")){ unlink; } rmdir($filedir);} undef $value;\r
+ }elsif(unlink($filename)){\r
+ unlink("$set{'src_dir'}$filepre$no.$ext.html"); if($filedir){ foreach(globfile($filedir,".*")){ unlink; } rmdir($filedir);} undef $value;\r
+ }elsif(!(-e $filename)){\r
+ unlink("$set{'src_dir'}$filepre$no.$ext.html"); if($filedir){ foreach(globfile($filedir,".*")){ unlink; } rmdir($filedir);} undef $value;\r
+ }else{\r
+ if($mode ne 'admin'){ &error(403,"$filepre$no.$ext");}\r
+ }\r
+ }\r
+ }\r
+ if($mode ne 'admin' && !$findflag){ &error(402,$delno); }\r
+ if($flag){\r
+ logwrite(@log);\r
+ &makehtml();\r
+ }\r
+}\r
+\r
+\r
+sub quit{\r
+ my ($cookiename,$buff);\r
+ my $flag = 0;\r
+ my @tmpfiles = globfile("$set{'src_dir'}","\.temporary");\r
+ foreach my $value (@tmpfiles){ if((stat($value))[10] < time - 60*60){ unlink("$value"); $flag++; } }\r
+ &makehtml() if($flag);\r
+ $buff =<<"EOM";\r
+$set{'html_head'}<META HTTP-EQUIV="Refresh" CONTENT="1;URL=$set{'http_html_path'}$set{'base_html'}">\r
+EOM\r
+ if($in{'jcode'} || $in{'mode'} eq 'delete'){\r
+ $buff .=<<"EOM";\r
+<META HTTP-EQUIV="Set-Cookie" content="SN_USER=$in{'user'}<>1; path=/; expires=Tue, 31-Dec-2030 23:59:59 GMT">\r
+<META HTTP-EQUIV="CONTENT-SCRIPT-TYPE" CONTENT="text/javascript">\r
+<script type="text/javascript">\r
+<!--\r
+setCookie();\r
+function setCookie() {\r
+ var key1,key2;\r
+ var tmp = "path=/; expires=Tue, 31-Dec-2030 23:59:59; ";\r
+EOM\r
+ if($in{'jcode'}){\r
+ my %ck; foreach(split(/;/,$ENV{'HTTP_COOKIE'})){ my($key,$val) = split(/=/); $key =~ s/\s//g; $ck{$key} = $val;}\r
+ my @ck = split(/<>/,$ck{'SN_DEL'});\r
+ if(!$ck[0] && $in{'org_pass'}){ $buff .= qq|\tdocument.cookie = "SN_DEL="+escape('$in{'org_pass'}')+"<>;"+ tmp;\n|;}\r
+ $cookiename = 'SN_UPLOAD'; $buff .= "\tkey1 = escape('$in{'org_pass'}'); key2 = escape('$in{'postkey'}');\n";}\r
+ else{ $cookiename = 'SN_DEL'; $buff .= "\tkey1 = escape('$in{'delpass'}'); key2 = '';\n"; }\r
+ $buff .= qq|\tdocument.cookie = "$cookiename="+key1+"<>"+key2+"; "+ tmp;\n}\n//-->\n</script>\n|;\r
+ }\r
+ $buff .=<<"EOM";\r
+<body>\r
+<br><br><div align=center><font size="+1"><br><br>\r
+<a href="$set{'http_html_path'}$set{'base_html'}?$in{'time'}">click here!</a></font><br>\r
+</div>\r
+</body></html>\r
+EOM\r
+ print "Content-type: text/html\n\n";\r
+ print $buff;\r
+ exit;\r
+}\r
+\r
+sub admin_mode{\r
+ &errorclear() if($in{'mode'} eq 'errorclear');\r
+ &delete('admin',$in{'admin_delno'}) if($in{'mode'} eq 'delete');\r
+\r
+ open(IN,$set{'log_file'})||error(303);\r
+ my @log = <IN>;\r
+ close(IN);\r
+\r
+ my ($header,$buff,$footer,$value);\r
+ $buff =<<"EOM";\r
+$set{'html_head'}$set{'html_css'}</HEAD>\r
+<body bgcolor="#ffffff" text="#000000" LINK="#6060FF" VLINK="#6060FF" ALINK="#6060FF">\r
+EOM\r
+\r
+ $buff .= leaddisp(0,1,1).'<a name="up"></a><table summary="title" width="100%"><tr><td bgcolor="#caccff"><strong><font size="4" color="#3366cc">Upload Info</font></strong></td></tr></table>';\r
+ $buff .= qq|<table summary="check"><tr><td><form action="$set{'base_cgi'}" method="POST"><input type=hidden name="checkmode" value="allcheck"><input type=hidden name=delno value="$in{'delno'}"><input type=hidden name=delpass value="$in{'delpass'}"><input type=submit value="\82·\82×\82Ä\83`\83F\83b\83N"></form></td><td><form action="$set{'base_cgi'}" method="POST"><input type=hidden name="checkmode" value="nocheck"><input type=hidden name=delno value="$in{'delno'}"><input type=hidden name=delpass value="$in{'delpass'}"><input type=submit value="\82·\82×\82Ä\8aO\82·"></form></td><td><form action="$set{'base_cgi'}" method="POST"><input type=hidden name=delpass value="$set{'admin_pass'}"><input type=submit value="HTML\82ð\8dX\90V\82·\82é/\83\8d\83O\83A\83E\83g"></form></td></tr></table>\n<form action="$set{'base_cgi'}" method="POST"><input type=hidden name="mode" value="delete"><input type=hidden name=delno value="$in{'delno'}"><input type=hidden name=delpass value="$in{'delpass'}"><input type=submit value="\83`\83F\83b\83N\82µ\82½\82à\82Ì\82ð\8dí\8f\9c"><br>\n|."<table summary=\"upinfo\" width=\"100%\">\n<tr><td>DEL</td><td>NAME</td><td>COMMENT</td><td>SIZE</td><td>ADDR</td><td>HOST</td><td>DATE</td><td>NOTE</td><td>MIME</td><td>ORIG</td></tr>\n";\r
+ shift(@log);\r
+ foreach (@log){ $buff .= makeitem($_,'admin'); }\r
+ $buff .= '</table></form><br><br>';\r
+\r
+ if($set{'error_level'}){\r
+ $buff .= leaddisp(-1,0,1).'<a name="error"></a><table summary="errortitle" width="100%"><tr><td bgcolor="#caccff"><strong><font size="4" color="#3366cc">Error Info</font></strong></td></tr></table>';\r
+ $buff .= qq|<form action="$set{'base_cgi'}" method="POST"><input type=hidden name=mode value="errorclear"><input type=hidden name=delno value="$in{'delno'}"><input type=hidden name=delpass value="$in{'delpass'}"><input type=submit value="\83G\83\89\81[\83\8d\83O\83N\83\8a\83A"></form>|;\r
+ $buff .= "<table summary=\"errorinfo\" width=\"100%\">\n<tr><td>DATE</td><td>ADDR</td><td>HOST</td><td>NOTE</td></tr>\n";\r
+ if(open(IN,$set{'error_log'})){ @log = reverse(<IN>); close(IN); foreach (@log){ my ($date,$no,$note,$addr,$host) = split(/<>/); $buff .= "<tr><td>$date</td><td>$addr</td><td>$host</td><td>$note</td></tr>\n"; }}\r
+ $buff .= "</table><br><br>\n";\r
+ }\r
+\r
+ $buff .= leaddisp(-1,-1,0);\r
+ $buff .= '<a name="set"></a><table summary="settitle" width="100%"><tr><td bgcolor="#caccff"><strong><font size="4" color="#3366cc">Setting Info</font></strong></td></tr></table>'."\n<table summary=\"setting\">\n";\r
+ $buff .= tablestr('\83X\83N\83\8a\83v\83gVer',$set{'ver'});\r
+ $buff .= tablestr('\83\81\83C\83\93\83\8d\83O\83t\83@\83C\83\8b',$set{'log_file'});\r
+ if($set{'error_level'}){\r
+ $buff .= tablestr('\83G\83\89\81[\83\8d\83O\83t\83@\83C\83\8b',$set{'error_log'});\r
+ if($set{'error_size'}){ $buff .= tablestr('\83G\83\89\81[\83\8d\83O\8dÅ\91å\97e\97Ê',dispsize($set{'error_size'}*1024).' '.($set{'error_size'}*1024).'Bytes'); }\r
+ else{ $buff .= tablestr('\83G\83\89\81[\83\8d\83O\8dÅ\91å\97e\97Ê\90§\8cÀ','\96³'); }\r
+ }else{ $buff .= tablestr('\83G\83\89\81[\83\8d\83O\8bL\98^','\96³'); }\r
+ $buff .= tablestr('\95Û\8e\9d\8c\8f\90\94',$set{'max_log'});\r
+ $buff .= tablestr('\8dÅ\91å\93\8a\8de\97e\97Ê',dispsize($set{'max_size'}*1024).' '.($set{'max_size'}*1024).'Bytes');\r
+\r
+ if($set{'min_flag'}){ $buff .= tablestr('\8dÅ\8f¬\90§\8cÀ\97e\97Ê',dispsize($set{'min_size'}*1024).' '.($set{'min_size'}*1024).'Bytes'); }\r
+ else{ $buff .= tablestr('\8dÅ\8f¬\90§\8cÀ\97e\97Ê',"\96³"); }\r
+ if($set{'max_all_flag'}){ $buff .= tablestr('\91\8d\97e\97Ê\90§\8cÀ',dispsize($set{'max_all_size'}*1024).' '.($set{'max_all_size'}*1024).'Bytes'); }\r
+ else{ $buff .= tablestr('\91\8d\97e\97Ê\90§\8cÀ',"\96³"); }\r
+\r
+ $buff .= tablestr("\83t\83@\83C\83\8b\90Ú\93ª\8e«",$set{'file_pre'});\r
+ $buff .= tablestr("HTML\95Û\91¶\83f\83B\83\8c\83N\83g\83\8a",$set{'html_dir'});\r
+ $buff .= tablestr("\83t\83@\83C\83\8b\95Û\91¶\83f\83B\83\8c\83N\83g\83\8a",$set{'src_dir'});\r
+ if($set{'http_html_path'} && $set{'html_dir'} ne $set{'http_html_path'}){ $buff .= "<tr><td>HTTP_HTML_PATH</td><td>$set{'http_html_path'}</td></tr>\n";}\r
+ if($set{'http_src_path'} && $set{'src_dir'} ne $set{'http_src_path'}){ $buff .= "<tr><td>HTTP_SRC_PATH</td><td>$set{'http_src_path'}</td></tr>\n";}\r
+ $buff .= tablestr('1\83y\81[\83W\82É\95\\8e¦\82·\82é\83t\83@\83C\83\8b\90\94',$set{'pagelog'});\r
+ if($set{'interval'} > 0){ $value = $set{'interval'}.'\95b'; }else{ $value = '\96³'; }\r
+ $buff .= tablestr('\93¯\88êIP\93\8a\8de\8aÔ\8au\95b\90\94\90§\8cÀ',$value);\r
+ if($set{'up_ext'}){ $set{'up_ext'} =~ s/,/ /g; $buff .= tablestr('\93\8a\8de\89Â\94\\8aî\96{\8ag\92£\8eq',$set{'up_ext'}); }\r
+ if($set{'deny_ext'}){ $set{'deny_ext'} =~ s/,/ /g; $buff .= tablestr('\93\8a\8de\8bÖ\8e~\8ag\92£\8eq',$set{'deny_ext'}); }\r
+ if($set{'change_ext'}){ $set{'change_ext'} =~ s/,/ /g; $set{'change_ext'} =~ s/>/>/g; $buff .= tablestr('\8ag\92£\8eq\95Ï\8a·',$set{'change_ext'}); }\r
+\r
+ if($set{'up_all'}){ $buff .= tablestr('\8ew\92è\8aO\8ag\92£\8eq\83A\83b\83v\83\8d\81[\83h\8b\96\89Â','\97L'); if($set{'ext_org'}){ $buff .= tablestr('\8ew\92è\8aO\83t\83@\83C\83\8b\8ag\92£\8eq','\83I\83\8a\83W\83i\83\8b'); }else{ $buff .= tablestr('\8ew\92è\8aO\83t\83@\83C\83\8b\8ag\92£\8eq','bin'); }}\r
+ else{$buff .= tablestr('\8ew\92è\8aO\8ag\92£\8eq\83A\83b\83v\83\8d\81[\83h\8b\96\89Â','\96³');}\r
+\r
+ if($set{'find_crypt'}){ $value = '\97L'; }else{ $value = '\96³';}\r
+ $buff .= tablestr('\88Ã\8d\86\89»\83A\81[\83J\83C\83u\8c\9f\8fo(ZIP)',$value);\r
+ if($set{'binary_compare'}){ $value = '\97L'; }else{ $value = '\96³';}\r
+ $buff .= tablestr('\83o\83C\83i\83\8a\94ä\8ar',$value);\r
+ if($set{'post_flag'}){ $value = '\97L'; }else{ $value = '\96³';}\r
+ $buff .= tablestr('PostKey\93\8a\8de\90§\8cÀ',$value);\r
+ if($set{'dlkey'}){ if($set{'dlkey'} == 2){$value = '\95K\90{'}else{$value = '\94C\88Ó';}}else{ $value = '\96³';}\r
+ $buff .= tablestr('DLkey',$value);\r
+ if($set{'dummy_html'}){ if($set{'dummy_html'} == 3){$value = 'ALL'}elsif($set{'dummy_html'} == 2){$value = 'DLKey\82Ì\82Ý';}else{$value = '\92Ê\8fí\83t\83@\83C\83\8b\82Ì\82Ý';}}else{ $value = '\96³';}\r
+ $buff .= tablestr('\8cÂ\95ÊHTML\83L\83\83\83b\83V\83\85',$value);\r
+ if($set{'disp_error'}){ $value = '\97L'; }else{ $value = '\96³';}\r
+ $buff .= tablestr('\83\86\81[\83U\83G\83\89\81[\95\\8e¦',$value);\r
+ if($set{'zero_clear'}){ $value = '\97L'; }else{ $value = '\96³';}\r
+ $buff .= tablestr('\8dí\8f\9c\8dÏ\83t\83@\83C\83\8b\83\8a\83X\83g\8e©\93®\8fÁ\8b\8e',$value);\r
+ if($set{'home_url'}){ $buff .= "<tr><td>HOMEURL</td><td>$set{'home_url'}</td></tr>\n";}\r
+\r
+ $buff .= '</table></body></html>';\r
+\r
+ print "Content-type: text/html\n\n";\r
+ print $buff;\r
+ exit;\r
+}\r
+\r
+sub extfind{\r
+ my $orgname = @_[0];\r
+ my @filename = split(/\./,$orgname);\r
+ my $ext = $filename[$#filename];\r
+ $ext =~ tr/[A-Z]/[a-z]/;\r
+ foreach my $value (split(/,/,$set{'change_ext'})){ my ($src,$dst) = split(/->/,$value); if($ext eq $src){ $ext = $dst; last; }}\r
+ foreach my $value (split(/,/,$set{'deny_ext'})){ if($ext eq $value){ &error(206,$ext); }}\r
+ foreach my $value (split(/,/,$set{'up_ext'})){ if ($ext eq $value) { return $value; } }\r
+ if(length($ext) >= 5 || length($ext) == 0){ $ext = 'bin'; }\r
+ unless ($ext =~ /^[A-Za-z0-9]+$/){ $ext = 'bin'; }\r
+ if($set{'up_all'} && $set{'ext_org'}){ return $ext;}\r
+ elsif($set{'up_all'}){ return 'bin'; }\r
+ return 0;\r
+}\r
+\r
+\r
+sub conv_date{\r
+ my @date = gmtime($_[0] + 9*60*60);\r
+ $date[5] -= 100; $date[4]++;\r
+ if ($date[5] < 10) { $date[5] = "0$date[5]" ; } if ($date[4] < 10) { $date[4] = "0$date[4]" ; }\r
+ if ($date[3] < 10) { $date[3] = "0$date[3]" ; } if ($date[2] < 10) { $date[2] = "0$date[2]" ; }\r
+ if ($date[1] < 10) { $date[1] = "0$date[1]" ; } if ($date[0] < 10) { $date[0] = "0$date[0]" ; }\r
+ my @w = ('Sun','Mon','Tue','Wed','Thu','Fri','Sat');\r
+ return ("$date[5]/$date[4]/$date[3]($w[$date[6]]),$date[2]:$date[1]:$date[0]");\r
+}\r
+\r
+sub dispsize{\r
+ my $size = $_[0];\r
+ if($size >= 1024*1024*1024*100){ $size = int($size/1024/1024/1024).'GB';}\r
+ elsif($size >= 1024*1024*1024*10){ $size = sprintf("%.1fGB",$size/1024/1024/1024);}\r
+ elsif($size > 1024*1024*1024){ $size = sprintf("%.2fGB",$size/1024/1024/1024);}\r
+ elsif($size >= 1024*1024*100){ $size = int($size/1024/1024).'MB'; }\r
+ elsif($size > 1024*1024){ $size = sprintf("%.1fMB",$size/1024/1024); }\r
+ elsif($size > 1024){ $size = int($size/1024).'KB'; }\r
+ else{ $size = int($size).'B';}\r
+ return $size;\r
+}\r
+\r
+sub makeitem{\r
+ my ($src,$mode) = @_; my ($buff,$check,$target);\r
+ my ($no,$ext,$date,$comment,$mime,$orgname,$addr,$host,$pass,$filepre,$note,$dummy) = split(/<>/,$src);\r
+ if(!$dummy){ $filepre = $set{'file_pre'}; }\r
+ my $orgno = $no;\r
+ $no = sprintf("%04d",$no);\r
+ my $size = 0;\r
+ my $dlpath = 0;\r
+\r
+ if($note =~ /DLpath:(.+)\s/){\r
+ $dlpath = $1;\r
+ $size = dispsize(-s "$set{'src_dir'}$filepre$no.${ext}_$dlpath/$filepre$no.$ext");\r
+ }else{\r
+ $size = dispsize(-s "$set{'src_dir'}$filepre$no.$ext");\r
+ }\r
+\r
+ my $path = $set{'http_src_path'} || $set{'src_dir'};\r
+ if($set{'link_target'}){ $target = qq| target="$set{'link_target'}"|; }\r
+ if($mode eq 'admin'){\r
+ if($dlpath){ $path .= "$filepre$no.${ext}_$dlpath/"; }\r
+ if($addr eq $host){ undef $host; }\r
+ if($in{'checkmode'} eq 'allcheck'){$check = ' checked';}\r
+ $buff = "<tr><td><INPUT TYPE=checkbox NAME=\"admin_delno\" VALUE=\"$no\"$check></td><td><a href=\"$path$filepre$no.$ext\"$target>$filepre$no.$ext</a></td><td>$comment</td><td>$size</td><td>$addr</td><td>$host</td><td>$date</td><td>$note</td><td>$mime</td><td>$orgname</td></tr>\n";\r
+ }else{\r
+ my($d_com,$d_date,$d_size,$d_mime,$d_org);\r
+ if($set{'disp_comment'}){ $d_com = "<td>$comment</td>"; } if($set{'disp_size'}){ $d_size = "<td>$size</td>"; } if($set{'disp_date'}){ $d_date= "<td>$date</td>"; }\r
+ if($set{'disp_mime'}){ $d_mime = "<td>$mime</td>"; } if($set{'disp_orgname'}){ $d_org = "<td>$orgname</td>"; }\r
+ if(-e "$set{'src_dir'}$filepre$no.$ext.html"){$buff = "<tr><td><SCRIPT type=\"text/javascript\" Language=\"JavaScript\"><!--\ndocument.write(\"<a href=\\\"javascript:delnoin($orgno)\\\">$set{'char_delname'}<\\/a>\");\n// --></SCRIPT></td><td><a href=\"$path$filepre$no.$ext.html\"$target>$filepre$no.$ext</a></td>$d_com$d_size$d_date$d_mime$d_org</tr>\n";}\r
+ elsif($dlpath){$buff = "<tr><td><SCRIPT type=\"text/javascript\" Language=\"JavaScript\"><!--\ndocument.write(\"<a href=\\\"javascript:delnoin($orgno)\\\">$set{'char_delname'}<\\/a>\");\n// --></SCRIPT></td><td><a href=\"$set{'base_cgi'}?mode=dl&file=$orgno\">$filepre$no.$ext</a></td>$d_com$d_size$d_date$d_mime$d_org</tr>\n";}\r
+ else{ $buff = "<tr><td><SCRIPT type=\"text/javascript\" Language=\"JavaScript\"><!--\ndocument.write(\"<a href=\\\"javascript:delnoin($orgno)\\\">$set{'char_delname'}<\\/a>\");\n// --></SCRIPT></td><td><a href=\"$path$filepre$no.$ext\"$target>$filepre$no.$ext</a></td>$d_com$d_size$d_date$d_mime$d_org</tr>\n";}\r
+ }\r
+ return $buff;\r
+}\r
+\r
+sub makedummyhtml{\r
+ my ($filename,$com,$file,$orgdlpath,$date,$mime,$orgname,$no) = @_;\r
+ my $buff;\r
+\r
+ if(!$no){\r
+ $buff = "<html><head><title>$filename</title></head><body>";\r
+ $buff .= qq|Download <a href="./$filename">$filename</a>|;\r
+ $buff .= '</body></html>';\r
+ }else{\r
+ $buff = cryptfiledl($com,$file,$orgdlpath,$date,$mime,$orgname,$no);\r
+ }\r
+\r
+ open(OUT,">$set{'src_dir'}$filename.html")||&error(307,"$set{'src_dir'}$filename.html");\r
+ print OUT $buff;\r
+ close(OUT);\r
+ chmod($set{'per_upfile'},"$set{'src_dir'}$filename.html");\r
+ return 1;\r
+}\r
+\r
+\r
+sub logwrite{\r
+ my @log = @_;\r
+ open(OUT,"+>$set{'log_file'}")||&error(304);\r
+ eval{ flock(OUT, 2);};\r
+ eval{ truncate(OUT, 0);};\r
+ seek(OUT, 0, 0);\r
+ print OUT @log;\r
+ eval{ flock(OUT, 8);};\r
+ close(OUT);\r
+ chmod($set{'per_upfile'},$set{'log_file'});\r
+ return 1;\r
+}\r
+\r
+sub binarycmp{\r
+ my ($src,$dst) = @_;\r
+ return 0 if (-s $src != -s $dst);\r
+ open(SRC,$src)||return 0; open(DST,$dst)||return 0;\r
+ my ($buff,$buff2);\r
+ binmode(SRC); binmode(DST); seek(SRC,0,0); seek(DST,0,0); \r
+ while(read(SRC,$buff,8192)){ read(DST,$buff2,8192); if($buff ne $buff2){ close(SRC); close(DST); return 0; } }\r
+ close(SRC); close(DST);\r
+ return 1;\r
+}\r
+\r
+sub init{\r
+ my $buff;\r
+ if(open(OUT,">$set{'log_file'}")){\r
+ print OUT "0<>0<>0<>1\n";\r
+ close(OUT);\r
+ chmod($set{'per_logfile'},$set{'log_file'});\r
+ }else{\r
+ $buff = "<tr><td>\83\81\83C\83\93\83\8d\83O\82Ì\8dì\90¬\82É\8e¸\94s\82µ\82Ü\82µ\82½</td></tr>";\r
+ }\r
+ \r
+ unless (-d "$set{'src_dir'}"){\r
+ if(mkdir("$set{'src_dir'}",$set{'per_dir'})){\r
+ chmod($set{'per_dir'},"$set{'src_dir'}");\r
+ open(OUT,">$set{'src_dir'}index.html");\r
+ close(OUT);\r
+ chmod($set{'per_upfile'},"$set{'src_dir'}index.html");\r
+ }else{\r
+ $buff .= "<tr><td>Source\95Û\91¶\83f\83B\83\8c\83N\83g\83\8a\82Ì\8dì\90¬\82É\8e¸\94s\82µ\82Ü\82µ\82½</td></tr>";\r
+ }\r
+ }\r
+\r
+ unless (-d "$set{'html_dir'}"){\r
+ if(mkdir("$set{'html_dir'}",$set{'per_dir'})){\r
+ chmod($set{'per_dir'},"$set{'html_dir'}");\r
+ }else{\r
+ $buff .= "<tr><td>HTML\95Û\91¶\83f\83B\83\8c\83N\83g\83\8a\82Ì\8dì\90¬\82É\8e¸\94s\82µ\82Ü\82µ\82½</td></tr>";\r
+ }\r
+ }\r
+\r
+ if($buff){\r
+ $buff .= "<tr><td>\83f\83B\83\8c\83N\83g\83\8a\82É\8f\91\82«\8d\9e\82Ý\8c \8cÀ\82ª\82 \82é\82©\8am\94F\82µ\82Ä\82\82¾\82³\82¢</td></tr>";\r
+ &error_disp($buff,'init');\r
+ }\r
+}\r
+\r
+sub check_postkey{\r
+ my $inputkey = @_[0];\r
+ my @key = split(/,/,$set{'post_key'});\r
+ foreach my $key (@key){ if($inputkey eq $key){ return 1; } }\r
+ return 0;\r
+}\r
+\r
+sub leaddisp{\r
+ my @src = @_;\r
+ my ($str,$count);\r
+ foreach my $value (@src){\r
+ my ($mark,$name,$link); $count++;\r
+ if($count == 1){ $name = 'Upload Info'; $link = 'up'; }\r
+ elsif($count == 2){ $name = 'Error Info'; $link = 'error'; next if(!$set{'error_level'}); }\r
+ elsif($count == 3){ $name = 'Setting Info'; $link = 'set'; }\r
+ if($value){ if($value > 0){ $mark = '\81¥'; }else{ $mark = '\81£'; } $str .= qq|<a href="#$link">${mark}${name}</a> |; }\r
+ else{ $str .= qq|[$name] |; }\r
+ }\r
+ return $str;\r
+}\r
+\r
+sub errorclear{\r
+ open(OUT,">$set{'error_log'}")||return 0;\r
+ eval{ flock(OUT, 2);}; eval{ truncate(OUT, 0);}; seek(OUT, 0, 0); eval{ flock(OUT, 8);}; close(OUT);\r
+ chmod($set{'per_upfile'},$set{'log_file'});\r
+ return 1;\r
+}\r
+\r
+sub tablestr{\r
+ my ($value1,$value2) = @_;\r
+ return ("<tr><td>$value1</td><td>$value2</td></tr>\n");\r
+}\r
+\r
+sub globfile{\r
+ my ($src_dir,$filename) = @_;\r
+ opendir(DIR,$src_dir)||return 0; my @dir = readdir(DIR); closedir(DIR);\r
+ my @new = (); foreach my $value (@dir){ push(@new,"$src_dir$value") if($value =~ /$filename/ && !(-d "$src_dir$value")); }\r
+ return @new;\r
+}\r
+\r
+sub globdir{\r
+ my ($src_dir,$dir) = @_;\r
+ opendir(DIR,$src_dir)||return 0; my @dir = readdir(DIR); closedir(DIR);\r
+ my @new = (); foreach my $value (@dir){ if($value eq '.' ||$value eq '..' ){ next; } push(@new,"$src_dir$value") if($value =~ /$dir/ && (-d "$src_dir$value")); }\r
+ return @new;\r
+}\r
+\r
+sub error_disp{\r
+ my ($message,$mode) = @_;\r
+ my $url;\r
+ if($mode eq 'init'){ $url = qq|<a href="$set{'base_cgi'}">[\83\8a\83\8d\81[\83h]</a>|; }else{ $url = qq|<a href="$set{'http_html_path'}$set{'base_html'}">[\96ß\82é]</a>|; }\r
+ my $buff =<<"EOM";\r
+$set{'html_head'}$set{'html_css'}</HEAD>\r
+<body bgcolor="#ffffff" text="#000000" LINK="#6060FF" VLINK="#6060FF" ALINK="#6060FF">\r
+<div align="center">\r
+<table summary="error">\r
+$message\r
+<tr><td></td></tr>\r
+<tr><td><div align="center">$url</div></td></tr>\r
+</table>\r
+<br><br>\r
+<table summary="info">\r
+<tr>\r
+<td>DATE</td><td>$in{'date'}</td></tr>\r
+<tr><td>ADDR</td><td>$in{'addr'}</td></tr>\r
+<tr><td>HOST</td><td>$in{'host'}</td></tr>\r
+</table>\r
+</div>\r
+</body></html>\r
+EOM\r
+ print "Content-type: text/html\n\n";\r
+ print $buff;\r
+ exit;\r
+}\r
+\r
+sub error{\r
+ my ($no,$note) = @_;\r
+ if (length($note) > 64) { $note = substr($note,0,64).'...'; }\r
+ $note =~ s/&/&/g; $note =~ s/\"/"/g; $note =~ s/</</g; $note =~ s/>/>/g; $note =~ s/\r//g; $note =~ s/\n//g; $note =~ s/\t//g; $note =~ s/\0//g;\r
+ my ($message,$dispmsg,$flag);\r
+ \r
+ if($no == 98){ $message = ""; }\r
+ elsif($no == 99){ $message = "UpFile\82È\82µ"; }\r
+ elsif($no == 101){ $message = "\93\8a\8de\8bÖ\8e~HOST"; }\r
+ elsif($no == 106){ $flag = 1; $message = "POST\83T\83C\83Y\92´\89ß"; $note = dispsize($note); $dispmsg= '<tr><td>\83t\83@\83C\83\8b\82ð\83A\83b\83v\83\8d\81[\83h\82Å\82«\82Ü\82¹\82ñ\82Å\82µ\82½</td></tr><tr><td>\83A\83b\83v\83\8d\81[\83h\83t\83@\83C\83\8b('.$note.')\82Í \8dÅ\91å\97e\97Ê\90Ý\92è('.dispsize($set{'max_size'}*1024).')\82ð\89z\82¦\82Ä\82¢\82Ü\82·</td></tr>';}\r
+ elsif($no == 107){ $flag = 1; $message = "POST\83T\83C\83Y\89ß\8f¬"; $note = dispsize($note); $dispmsg= '<tr><td>\83t\83@\83C\83\8b\82ð\83A\83b\83v\83\8d\81[\83h\82Å\82«\82Ü\82¹\82ñ\82Å\82µ\82½</td></tr><tr><td>\83A\83b\83v\83\8d\81[\83h\83t\83@\83C\83\8b('.$note.')\82Í \8dÅ\8f¬\97e\97Ê\90Ý\92è('.dispsize($set{'min_size'}*1024).')\96¢\96\9e\82Å\82·</td></tr>';}\r
+ elsif($no == 108){ $flag = 1; $message = "POST\83f\81[\83^\95s\8a®\91S"; $dispmsg = '<tr><td>\83t\83@\83C\83\8b\82ð\83A\83b\83v\83\8d\81[\83h\82Å\82«\82Ü\82¹\82ñ\82Å\82µ\82½</td></tr><tr><td>POST\83f\81[\83^\82ª\95s\8a®\91S\82Å\82·</td></tr>';}\r
+ elsif($no == 109){ $flag = 1; $message = "POSTKey\95s\88ê\92v"; $dispmsg = '<tr><td>\83t\83@\83C\83\8b\82ð\83A\83b\83v\83\8d\81[\83h\82Å\82«\82Ü\82¹\82ñ\82Å\82µ\82½</td></tr><tr><td>POSTKey\82ª\88ê\92v\82µ\82Ü\82¹\82ñ</td></tr>';}\r
+ elsif($no == 202){ $flag = 1; $message = "\8ag\92£\8eq\8d\87\82í\82¸"; $dispmsg = '<tr><td>\83t\83@\83C\83\8b\82ð\83A\83b\83v\83\8d\81[\83h\82Å\82«\82Ü\82¹\82ñ\82Å\82µ\82½</td></tr><tr><td>\93\8a\8de\82Å\82«\82é\8ag\92£\8eq\82Í'.$set{'up_ext'}.'\82Å\82·</td></tr>';}\r
+ elsif($no == 203){ $flag = 1; $message = "\93\8a\8de\91\81\82·\82¬"; $dispmsg = '<tr><td>\83t\83@\83C\83\8b\82ð\83A\83b\83v\83\8d\81[\83h\82Å\82«\82Ü\82¹\82ñ\82Å\82µ\82½</td></tr><tr><td>\93¯\88êIP\83A\83h\83\8c\83X\82©\82ç'.$set{'interval'}.'\95b\88È\93à\82É\8dÄ\93\8a\8de\82Å\82«\82Ü\82¹\82ñ</td></tr>';}\r
+ elsif($no == 204){ $flag = 1; $message = "\88ê\8e\9e\83t\83@\83C\83\8b\8f\91\82«\8d\9e\82ß\82¸"; $dispmsg = '<tr><td>\83t\83@\83C\83\8b\82ð\83A\83b\83v\83\8d\81[\83h\82Å\82«\82Ü\82¹\82ñ\82Å\82µ\82½</td></tr><tr><td>\88ê\8e\9e\83t\83@\83C\83\8b\82Ì\8dì\90¬\82É\8e¸\94s\82µ\82Ü\82µ\82½</td></tr>';}\r
+ elsif($no == 205){ $flag = 1; $message = "\93¯\88ê\83t\83@\83C\83\8b\91¶\8dÝ"; $note =~ /([^\/]+)$/; my $filename = $1; $dispmsg = '<tr><td>\83t\83@\83C\83\8b\82ð\83A\83b\83v\83\8d\81[\83h\82Å\82«\82Ü\82¹\82ñ\82Å\82µ\82½</td></tr><tr><td>\93¯\88ê\83t\83@\83C\83\8b\82ª '.$filename.' \82É\91¶\8dÝ\82µ\82Ü\82·</td></tr>';}\r
+ elsif($no == 206){ $flag = 1; $message = "\8bÖ\8e~\8ag\92£\8eq"; $dispmsg = '<tr><td>\83t\83@\83C\83\8b\82ð\83A\83b\83v\83\8d\81[\83h\82Å\82«\82Ü\82¹\82ñ\82Å\82µ\82½</td></tr><tr><td>\8ag\92£\8eq '.$note.' \82Í\83A\83b\83v\83\8d\81[\83h\82Å\82«\82Ü\82¹\82ñ</td></tr>';}\r
+ elsif($no == 303){ $flag = 1; $message = "\83\8d\83O\83t\83@\83C\83\8b\82É\93Ç\82Ý\8d\9e\82ß\82¸"; $dispmsg = '<tr><td>\83\81\83C\83\93\83\8d\83O\82Ì\93Ç\82Ý\8d\9e\82Ý\82É\8e¸\94s\82µ\82Ü\82µ\82½</td></tr>';}\r
+ elsif($no == 304){ $flag = 1; $message = "\83\8d\83O\83t\83@\83C\83\8b\82É\8f\91\82«\8d\9e\82ß\82¸"; $dispmsg = '<tr><td>\83\81\83C\83\93\83\8d\83O\82Ì\8f\91\82«\8d\9e\82Ý\82É\8e¸\94s\82µ\82Ü\82µ\82½</td></tr>';}\r
+ elsif($no == 306){ $message = "\83t\83@\83C\83\8b\83\8a\83X\83gHTML\8f\91\82«\8d\9e\82ß\82¸";}\r
+ elsif($no == 307){ $message = "\83t\83@\83C\83\8bHTML\83t\83@\83C\83\8b\8f\91\82«\8d\9e\82ß\82¸";}\r
+ elsif($no == 401){ $flag = 1; $message = "\8dí\8f\9cNo.\8c\9f\8fo\82Å\82«\82¸"; $dispmsg = '<tr><td>\83t\83@\83C\83\8b\82ð\8dí\8f\9c\82Å\82«\82Ü\82¹\82ñ\82Å\82µ\82½</td></tr><tr><td>'.$note.' \82©\82ç\8dí\8f\9cNo.\82ð\8c\9f\8fo\82Å\82«\82Ü\82¹\82ñ\82Å\82µ\82½</td></tr><tr><td>'.$set{'file_pre'}.'0774.zip\82Ì\8fê\8d\87 No.\82É\82Í 774 \82ð\93ü\97Í\82µ\82Ü\82·</td></tr>';}\r
+ elsif($no == 402){ $flag = 1; $note = sprintf("%04d",int($note)); $message = "\8dí\8f\9cNo.\91¶\8dÝ\82¹\82¸"; $dispmsg = '<tr><td>\83t\83@\83C\83\8b\82ð\8dí\8f\9c\82Å\82«\82Ü\82¹\82ñ\82Å\82µ\82½</td></tr><tr><td>'.$set{'file_pre'}.$note.'.*** \82Í\83\81\83C\83\93\83\8d\83O\82É\91¶\8dÝ\82µ\82Ü\82¹\82ñ</td></tr>';}\r
+ elsif($no == 403){ $flag = 1; $message = "\8dí\8f\9c\83A\83N\83Z\83X\8b\91\94Û"; $dispmsg = '<tr><td>\83t\83@\83C\83\8b\82ð\8dí\8f\9c\82Å\82«\82Ü\82¹\82ñ\82Å\82µ\82½</td></tr><tr><td>\83t\83@\83C\83\8b\8dí\8f\9c\8fð\8c\8f\82Í\96\9e\82½\82µ\82Ä\82¢\82Ü\82·\82ª '.$note.' \82Ì\83t\83@\83C\83\8b\82Ì\8dí\8f\9c\82ª\8b\91\94Û\82³\82ê\82Ü\82µ\82½</td></tr><tr><td>\83A\83N\83Z\83X\82ª\89ß\8fè\82È\8fê\8d\87\93\99\82Í\8e\9e\8aÔ\82ð\92u\82¢\82Ä\8dÄ\91\80\8dì\82·\82é\82Æ\8dí\8f\9c\82Å\82«\82é\82±\82Æ\82ª\82 \82è\82Ü\82·</td></tr>';}\r
+ elsif($no == 404){ $flag = 1; $message = "\8dí\8f\9cKey\95s\88ê\92v"; $dispmsg = '<tr><td>\83t\83@\83C\83\8b\82ð\8dí\8f\9c\82Å\82«\82Ü\82¹\82ñ\82Å\82µ\82½</td></tr><tr><td>'.$note.' \8dí\8f\9cKey\82ª\88ê\92v\82µ\82Ü\82¹\82ñ\82Å\82µ\82½</td></tr>';}\r
+\r
+ elsif($no == 51){ $flag = 1; $message = "[DLMode] No.\8c©\82Â\82©\82ç\82¸"; $dispmsg = '<tr><td>[DLMode] \83t\83@\83C\83\8b\82ª\8c©\82Â\82©\82è\82Ü\82¹\82ñ\82Å\82µ\82½</td></tr><tr><td>'.$note.' \82©\82ç\83t\83@\83C\83\8bNo.\82ð\8c\9f\8fo\82Å\82«\82Ü\82¹\82ñ\82Å\82µ\82½</td></tr>'; }\r
+ elsif($no == 52){ $flag = 1; $message = "[DLMode] File\8c©\82Â\82©\82ç\82¸"; $dispmsg = '<tr><td>[DLMode] \83t\83@\83C\83\8b\82ª\8c©\82Â\82©\82è\82Ü\82¹\82ñ\82Å\82µ\82½</td></tr><tr><td>'.$set{'file_pre'}.$note.'.*** \82Í\83\81\83C\83\93\83\8d\83O\82É\91¶\8dÝ\82µ\82Ü\82¹\82ñ</td></tr>'; }\r
+ elsif($no == 53){ $flag = 1; $message = "[DLMode] DLkey\96¢\90Ý\92è"; $dispmsg = '<tr><td>[DLMode] orgDLkeyError</td></tr><tr><td>'.$note.' DLKey\82ª\96¢\90Ý\92è\82Å\82·</td></tr>'; }\r
+ elsif($no == 54){ $flag = 1; $message = "[DLMode] DLkey\95s\88ê\92v"; $dispmsg = '<tr><td>[DLMode] orgDLkeyError</td></tr><tr><td>'.$note.' DLKey\82ª\88ê\92v\82µ\82Ü\82¹\82ñ\82Å\82µ\82½</td></tr>'; }\r
+ elsif($no == 55){ $flag = 1; $message = "[DLMode] File Oepn Error"; $dispmsg = '<tr><td>[DLMode] Open Error</td></tr><tr><td>'.$note.' \83t\83@\83C\83\8b\82Ì\93Ç\82Ý\8d\9e\82Ý\82É\8e¸\94s\82µ\82Ü\82µ\82½</td></tr>'; }\r
+ elsif($no == 56){ $flag = 1; $message = "[DLMode] File Not Found"; $dispmsg = '<tr><td>[DLMode] Not Found</td></tr><tr><td>'.$note.' \83t\83@\83C\83\8b\82ª\91¶\8dÝ\82µ\82Ü\82¹\82ñ</td></tr>'; }\r
+\r
+ elsif($no == 61){ $flag = 1; $message = "DLkey\96¢\90Ý\92è"; $dispmsg = '<tr><td>DLKey\82ª\96¢\90Ý\92è\82Å\82·</td></tr>'; }\r
+\r
+ unlink($in{'tmpfile'});\r
+ if($note){$message .= ' ';}\r
+ if($set{'error_level'} && $no > 100){\r
+ unless(-e $set{'error_log'}){\r
+ open(OUT,">$set{'error_log'}");\r
+ close(OUT);\r
+ chmod($set{'per_logfile'},$set{'error_log'});\r
+ }\r
+ if($set{'error_size'} && ((-s $set{'error_log'}) > $set{'error_size'} * 1024)){\r
+ my $err_bkup = "$set{'error_log'}.bak.cgi";\r
+ unlink($err_bkup);\r
+ rename($set{'error_log'},$err_bkup);\r
+ open(OUT,">$set{'error_log'}");\r
+ close(OUT);\r
+ chmod($set{'per_logfile'},$set{'error_log'});\r
+ }\r
+ open(OUT,">>$set{'error_log'}");\r
+ print OUT "$in{'date'}<>$no<>$message$note<>$in{'addr'}<>$in{'host'}<>1\n";\r
+ close(OUT);\r
+ }\r
+ &error_disp($dispmsg) if($flag && $set{'disp_error'});\r
+ &quit();\r
+}\r
+\r
+sub dlfile{\r
+ my $msg;\r
+ my ($orgdlkey,$orgdlpath);\r
+ my ($dlext,$dlfilepre);\r
+ my ($dl_date,$dl_comment,$dl_size,$dl_mime,,$dl_orgname);\r
+ my $dlno = 0;\r
+ my $findflag;\r
+\r
+ open(IN,$set{'log_file'})||&error(303);\r
+ my @log = <IN>;\r
+ close(IN);\r
+ shift(@log);\r
+\r
+ if($in{'file'} =~ /(\d+)/){ $dlno = $1; }\r
+ if($dlno == 0) { &error(51,$in{'file'}); }\r
+\r
+ foreach my $value (@log){\r
+ my ($no,$ext,$date,$comment,$mime,$orgname,$addr,$host,$pass,$filepre,$note,$dummy) = split(/<>/,$value);\r
+ my @note = split(/,/,$note);\r
+ if(int($dlno) == $no){\r
+ $dl_comment = $comment;\r
+ $dl_mime = $mime;\r
+ $dl_date = $date;\r
+ $dl_orgname = $orgname;\r
+ $dlext = $ext;\r
+ $dlfilepre = $filepre;\r
+ foreach my $tmpnote (@note){\r
+ if($tmpnote =~ /\!--\sDLKey:(.+)\s--.*\!--\sDLpath:(.+)\s--/){\r
+ $orgdlkey = $1;\r
+ $orgdlpath = $2;\r
+ last;\r
+ }\r
+ }\r
+ $findflag = 1;\r
+ last;\r
+ }\r
+ }\r
+\r
+ my $dlfile = $dlfilepre.sprintf("%04d",int($dlno)).'.'.$dlext;\r
+ if(!(-e "$set{'src_dir'}${dlfile}_$orgdlpath/$dlfile")){ &error(56,"$dlfile----$set{'src_dir'}${dlfile}_$orgdlpath/$dlfile"); }\r
+\r
+ if($in{'dlkey'}){\r
+ my $dlsalt = substr($orgdlkey,0,2);\r
+ my $dlkey = crypt($in{'dlkey'},$dlsalt);\r
+\r
+ if($findflag == 0){ &error(52,$dlfile); }\r
+ elsif(!$orgdlkey){ &error(53,$dlfile); }\r
+ elsif($orgdlkey ne $dlkey && $set{'admin_pass'} ne $in{'dlkey'}){ &error(54,$dlfile); }\r
+ #print "Location: $set{'http_src_path'}${dlfile}_$orgdlpath/$dlfile\n\n";\r
+ my $buff =<<"EOM";\r
+$set{'html_head'}$set{'html_css'}\r
+<META HTTP-EQUIV="Refresh" CONTENT="1;URL=$set{'http_src_path'}${dlfile}_$orgdlpath/$dlfile">\r
+</HEAD>\r
+<body bgcolor="#ffffff" text="#000000" LINK="#6060FF" VLINK="#6060FF" ALINK="#6060FF">\r
+<div align="center">\r
+<br>\r
+<table summary="dlfrom">\r
+<tr><td>\94ò\82Î\82È\82¢\8fê\8d\87\82Í <a href="$set{'http_src_path'}${dlfile}_$orgdlpath/$dlfile">\82±\82¿\82ç</a> \82©\82ç</td></tr>\r
+</table>\r
+</div>\r
+</body></html>\r
+EOM\r
+ print "Content-type: text/html\n\n";\r
+ print $buff;\r
+ }else{\r
+ my $buff = cryptfiledl($dl_comment,$dlfile,$orgdlpath,$dl_date,$dl_mime,$dl_orgname,$dlno);\r
+ print "Content-type: text/html\n\n";\r
+ print $buff;\r
+ }\r
+ exit;\r
+}\r
+\r
+sub cryptfiledl{\r
+ my($com,$file,$orgdlpath,$date,$mime,$orgname,$no) = @_;\r
+ my($d_com,$d_date,$d_size,$d_mime,$d_org);\r
+\r
+ if($set{'disp_comment'}){ $d_com = "<tr><td>COMMENT</td><td>$com</td></td>"; } if($set{'disp_size'}){ $d_size = "<tr><td>SIZE</td><td>".dispsize(-s "$set{'src_dir'}${file}_$orgdlpath/$file")." (".(-s "$set{'src_dir'}${file}_$orgdlpath/$file")."bytes)"."</td></tr>"; } if($set{'disp_date'}){ $d_date= "<tr><td>DATE</td><td>$date</td></tr>"; }\r
+ if($set{'disp_mime'}){ $d_mime = "<tr><td>ORGMIME</td><td>$mime</td></tr>"; } if($set{'disp_orgname'}){ $d_org = "<tr><td>ORGNAME</td><td>$orgname</td></tr>"; }\r
+\r
+ my $buff =<<"EOM";\r
+$set{'html_head'}$set{'html_css'}</HEAD>\r
+<body bgcolor="#ffffff" text="#000000" LINK="#6060FF" VLINK="#6060FF" ALINK="#6060FF">\r
+<div align="center">\r
+<br>\r
+$file \82É\82ÍDLKey\82ª\90Ý\92è\82³\82ê\82Ä\82¢\82Ü\82·\r
+<table summary="dlform">\r
+<tr><td></td></tr>\r
+<FORM METHOD=POST ACTION="$set{'base_cgi'}" name="DL">\r
+<tr><td>\r
+<input type=hidden name=file value=$no>\r
+<input type=hidden name=jcode value="\8a¿\8e\9a">\r
+<input type=hidden name=mode value=dl></td></tr>\r
+$d_com$d_date$d_size$d_mime$d_org\r
+<tr><td>DLKey:<input type=text size=8 name="dlkey"></td></tr>\r
+<tr><td><input type=submit value="DownLoad"></td></tr>\r
+</FORM>\r
+</table>\r
+</div>\r
+</body></html>\r
+EOM\r
+\r
+ return $buff;\r
+}
\ No newline at end of file