Changeset 0b408ff in lab.git for upload.cgi
- Timestamp:
- Feb 6, 2010 4:55:25 PM (15 years ago)
- Children:
- 68470f9
- Parents:
- 5106533
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
upload.cgi
r5106533 r0b408ff 169 169 if($upflag || $valueflag){ unlink("$set{'src_dir'}$random.temporary"); &error(108);} 170 170 171 $in{'postname'} = $FORM{'postname'}; 171 172 $in{'org_pass'} = $in{'pass'} = $FORM{'pass'}; 172 173 $in{'dlkey'} = $FORM{'dlkey'}; … … 214 215 } 215 216 216 my @form = ($in{' comment'},$in{'orgname'},$in{'type'},$in{'dlkey'});217 my @form = ($in{'postname'},$in{'comment'},$in{'orgname'},$in{'type'},$in{'dlkey'}); 217 218 foreach my $value (@form) { 218 219 if (length($value) > 128) { $value = substr($value,0,128).'...'; } … … 226 227 $value =~ s/\0//g; 227 228 } 228 ($in{' comment'},$in{'orgname'},$in{'type'},$in{'dlkey'}) = @form;229 ($in{'postname'},$in{'comment'},$in{'orgname'},$in{'type'},$in{'dlkey'}) = @form; 229 230 } 230 231 … … 323 324 my @new; 324 325 $new[0] = "$no<>$in{'addr'}<>$in{'time'}<>1\n"; 325 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";326 my $addlog = "$no<>$in{'postname'}<>$in{'ext'}<>$in{'date'}<>$in{'comment'}<>$in{'type'}<>$orgname<>$in{'addr'}<>$in{'host'}<>$in{'pass'},$userid<>$set{'file_pre'}<>$note<>1\n"; 326 327 $new[1] = $addlog; 327 328 … … 331 332 332 333 foreach my $value (@log){ 333 my ($no,$ ext,$date,$comment,$mime,$orgname,$addr,$host,$pass,$filepre,$note,$dummy) = split(/<>/,$value);334 my ($no,$postname,$ext,$date,$comment,$mime,$orgname,$addr,$host,$pass,$filepre,$note,$dummy) = split(/<>/,$value); 334 335 if(!$dummy){ $filepre = $set{'file_pre'};} 335 336 $no = sprintf("%04d",$no); … … 380 381 if($log == 1){ $log++; $init++;} 381 382 my $lastpage = int(($log - 2)/$set{'pagelog'}) + 1; 382 $postval = ' obj.postkey.value = unescape(p[ 1]);' if($set{'post_flag'});383 $postval = ' obj.postkey.value = unescape(p[2]);' if($set{'post_flag'}); 383 384 my $header =<<"EOM"; 384 385 $set{'html_head'}<META http-equiv="Content-Script-Type" content="text/javascript"> … … 386 387 <!-- 387 388 function getCookie(obj,cookiename){ 388 var i,str; c = new Array(); p = new Array("","" ); str = document.cookie;c = str.split(";");389 var i,str; c = new Array(); p = new Array("","",""); str = document.cookie;c = str.split(";"); 389 390 for (i = 0; i < c.length; i++) { if (c[i].indexOf(cookiename+"=") >= 0) { p = (c[i].substr(c[i].indexOf("=")+1)).split("<>"); break; }} 390 if(cookiename == "SN_UPLOAD"){ obj.p ass.value = unescape(p[0]);$postval }391 else if(cookiename == "SN_DEL"){ obj.delpass.value = unescape(p[ 0]);}391 if(cookiename == "SN_UPLOAD"){ obj.postname.value = unescape(p[0]); obj.pass.value = unescape(p[1]);$postval } 392 else if(cookiename == "SN_DEL"){ obj.delpass.value = unescape(p[1]);} 392 393 return true; 393 394 } … … 409 410 if($set{'min_flag'}){ $minsize = 'Min '.dispsize($set{'min_size'}*1024).' - '; } 410 411 if($set{'max_all_flag'}){ $total .= ' Total '.dispsize($set{'max_all_size'}*1024);} 411 $header .= qq|<FORM METHOD="POST" ENCTYPE="multipart/form-data" ACTION="$set{'base_cgi'}" name="Form"> FILE $minsize$maxsize (*$set{'max_log'}Files$total)<br>|;412 $header .= qq|<FORM METHOD="POST" ENCTYPE="multipart/form-data" ACTION="$set{'base_cgi'}" name="Form">NAME (ȪÂ)<br><INPUT TYPE=text SIZE="20" NAME="postname"><br> FILE $minsize$maxsize (*$set{'max_log'}Files$total)<br>|; 412 413 $header .='<INPUT TYPE=file SIZE="40" NAME="upfile">'; 413 414 $header .= ' DLKey: <INPUT TYPE=text SIZE="8" NAME="dlkey" maxlength="8">' if($set{'dlkey'}); … … 436 437 $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>"; 437 438 438 my $info_title = "<table summary=\"upinfo\" width=\"100%\">\n<tr><td></td><td>NAME</td> ";439 my $info_title = "<table summary=\"upinfo\" width=\"100%\">\n<tr><td></td><td>NAME</td><td>FILE</td>"; 439 440 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>"; } 440 441 if($set{'disp_mime'}){ $info_title .= "<td>MIME</td>"; } if($set{'disp_orgname'}){ $info_title .= "<td>ORIG</td>"; } … … 446 447 my $buff; my $no = 1; my $time = time; my $subheader; 447 448 foreach my $value (@log){ 448 my ($no,$ ext,$date,$comment,$mime,$orgname,$addr,$host,$pass,$dummy) = split(/<>/,$value);449 my ($no,$postname,$ext,$date,$comment,$mime,$orgname,$addr,$host,$pass,$dummy) = split(/<>/,$value); 449 450 if(!$dummy){ next; } 450 451 $buff .= makeitem($value); … … 513 514 my $findflag = 0; 514 515 foreach my $value (@log){ 515 my ($no,$ ext,$date,$comment,$mime,$orgname,$addr,$host,$pass,$filepre,$note,$dummy) = split(/<>/,$value);516 my ($no,$postname,$ext,$date,$comment,$mime,$orgname,$addr,$host,$pass,$filepre,$note,$dummy) = split(/<>/,$value); 516 517 $delnote = $note; 517 518 my $delflag = 0; … … 583 584 setCookie(); 584 585 function setCookie() { 585 var key 1,key2;586 var key0,key1,key2; 586 587 var tmp = "path=/; expires=Tue, 31-Dec-2030 23:59:59; "; 587 588 EOM … … 590 591 my @ck = split(/<>/,$ck{'SN_DEL'}); 591 592 if(!$ck[0] && $in{'org_pass'}){ $buff .= qq|\tdocument.cookie = "SN_DEL="+escape('$in{'org_pass'}')+"<>;"+ tmp;\n|;} 592 $cookiename = 'SN_UPLOAD'; $buff .= "\tkey 1 = escape('$in{'org_pass'}'); key2 = escape('$in{'postkey'}');\n";}593 else{ $cookiename = 'SN_DEL'; $buff .= "\tkey 1 = escape('$in{'delpass'}'); key2 = '';\n"; }594 $buff .= qq|\tdocument.cookie = "$cookiename="+key 1+"<>"+key2+"; "+ tmp;\n}\n//-->\n</script>\n|;593 $cookiename = 'SN_UPLOAD'; $buff .= "\tkey0 = escape('$in{'postname'}'); key1 = escape('$in{'org_pass'}'); key2 = escape('$in{'postkey'}');\n";} 594 else{ $cookiename = 'SN_DEL'; $buff .= "\tkey0 = ''; key1 = escape('$in{'delpass'}'); key2 = '';\n"; } 595 $buff .= qq|\tdocument.cookie = "$cookiename="+key0+"<>"+key1+"<>"+key2+"; "+ tmp;\n}\n//-->\n</script>\n|; 595 596 } 596 597 $buff .=<<"EOM"; … … 621 622 622 623 $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>'; 623 $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="·×Ä`FbN"></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="·×ÄO·"></form></td><td><form action="$set{'base_cgi'}" method="POST"><input type=hidden name=delpass value="$set{'admin_pass'}"><input type=submit value="HTMLðXV·é/OAEg"></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="`FbNµ½àÌðí"><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";624 $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="·×Ä`FbN"></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="·×ÄO·"></form></td><td><form action="$set{'base_cgi'}" method="POST"><input type=hidden name=delpass value="$set{'admin_pass'}"><input type=submit value="HTMLðXV·é/OAEg"></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="`FbNµ½àÌðí"><br>\n|."<table summary=\"upinfo\" width=\"100%\">\n<tr><td>DEL</td><td>NAME</td><td>FILE</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"; 624 625 shift(@log); 625 626 foreach (@log){ $buff .= makeitem($_,'admin'); } … … 730 731 sub makeitem{ 731 732 my ($src,$mode) = @_; my ($buff,$check,$target); 732 my ($no,$ ext,$date,$comment,$mime,$orgname,$addr,$host,$pass,$filepre,$note,$dummy) = split(/<>/,$src);733 my ($no,$postname,$ext,$date,$comment,$mime,$orgname,$addr,$host,$pass,$filepre,$note,$dummy) = split(/<>/,$src); 733 734 if(!$dummy){ $filepre = $set{'file_pre'}; } 734 735 my $orgno = $no; … … 750 751 if($addr eq $host){ undef $host; } 751 752 if($in{'checkmode'} eq 'allcheck'){$check = ' checked';} 752 $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";753 $buff = "<tr><td><INPUT TYPE=checkbox NAME=\"admin_delno\" VALUE=\"$no\"$check></td><td>$postname</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"; 753 754 }else{ 754 755 my($d_com,$d_date,$d_size,$d_mime,$d_org); 755 756 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>"; } 756 757 if($set{'disp_mime'}){ $d_mime = "<td>$mime</td>"; } if($set{'disp_orgname'}){ $d_org = "<td>$orgname</td>"; } 757 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";}758 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";}759 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";}758 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>$postname</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";} 759 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>$postname</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";} 760 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>$postname</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";} 760 761 } 761 762 return $buff; … … 993 994 994 995 foreach my $value (@log){ 995 my ($no,$ ext,$date,$comment,$mime,$orgname,$addr,$host,$pass,$filepre,$note,$dummy) = split(/<>/,$value);996 my ($no,$postname,$ext,$date,$comment,$mime,$orgname,$addr,$host,$pass,$filepre,$note,$dummy) = split(/<>/,$value); 996 997 my @note = split(/,/,$note); 997 998 if(int($dlno) == $no){
Note: See TracChangeset
for help on using the changeset viewer.