Changeset 0b408ff in lab.git


Ignore:
Timestamp:
Feb 6, 2010 4:55:25 PM (15 years ago)
Author:
leonora <leonora@…>
Children:
68470f9
Parents:
5106533
Message:
  • add a new textbox for input the username who uploaded

git-svn-id: https://lab.mitty.jp/svn/lab/trunk/snuploader@36 7d2118f6-f56c-43e7-95a2-4bb3031d96e7

File:
1 edited

Legend:

Unmodified
Added
Removed
  • upload.cgi

    r5106533 r0b408ff  
    169169        if($upflag || $valueflag){ unlink("$set{'src_dir'}$random.temporary"); &error(108);} 
    170170 
     171        $in{'postname'} = $FORM{'postname'}; 
    171172        $in{'org_pass'} = $in{'pass'} = $FORM{'pass'}; 
    172173        $in{'dlkey'} = $FORM{'dlkey'}; 
     
    214215    } 
    215216 
    216     my @form = ($in{'comment'},$in{'orgname'},$in{'type'},$in{'dlkey'}); 
     217    my @form = ($in{'postname'},$in{'comment'},$in{'orgname'},$in{'type'},$in{'dlkey'}); 
    217218    foreach my $value (@form) { 
    218219        if (length($value) > 128) { $value = substr($value,0,128).'...'; } 
     
    226227        $value =~ s/\0//g; 
    227228    } 
    228     ($in{'comment'},$in{'orgname'},$in{'type'},$in{'dlkey'}) = @form; 
     229    ($in{'postname'},$in{'comment'},$in{'orgname'},$in{'type'},$in{'dlkey'}) = @form; 
    229230} 
    230231 
     
    323324    my @new; 
    324325    $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"; 
    326327    $new[1] = $addlog; 
    327328 
     
    331332 
    332333    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); 
    334335        if(!$dummy){ $filepre = $set{'file_pre'};} 
    335336        $no = sprintf("%04d",$no); 
     
    380381    if($log == 1){ $log++; $init++;} 
    381382    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'}); 
    383384    my $header =<<"EOM"; 
    384385$set{'html_head'}<META http-equiv="Content-Script-Type" content="text/javascript"> 
     
    386387<!-- 
    387388function 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(";"); 
    389390    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.pass.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]);} 
    392393    return true; 
    393394} 
     
    409410    if($set{'min_flag'}){ $minsize = 'Min '.dispsize($set{'min_size'}*1024).' - '; } 
    410411    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>|; 
    412413    $header .='<INPUT TYPE=file  SIZE="40" NAME="upfile">'; 
    413414    $header .= ' DLKey: <INPUT TYPE=text SIZE="8" NAME="dlkey" maxlength="8">' if($set{'dlkey'}); 
     
    436437    $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>"; 
    437438 
    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>"; 
    439440    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>"; } 
    440441    if($set{'disp_mime'}){ $info_title .= "<td>MIME</td>"; } if($set{'disp_orgname'}){ $info_title .= "<td>ORIG</td>"; } 
     
    446447        my $buff; my $no = 1; my $time = time; my $subheader; 
    447448        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); 
    449450            if(!$dummy){ next; } 
    450451            $buff .= makeitem($value); 
     
    513514    my $findflag = 0; 
    514515    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); 
    516517        $delnote = $note; 
    517518        my $delflag = 0; 
     
    583584setCookie(); 
    584585function setCookie() { 
    585     var key1,key2; 
     586    var key0,key1,key2; 
    586587    var tmp = "path=/; expires=Tue, 31-Dec-2030 23:59:59; "; 
    587588EOM 
     
    590591            my @ck = split(/<>/,$ck{'SN_DEL'}); 
    591592            if(!$ck[0] && $in{'org_pass'}){ $buff .= qq|\tdocument.cookie = "SN_DEL="+escape('$in{'org_pass'}')+"<>;"+ tmp;\n|;} 
    592             $cookiename = 'SN_UPLOAD'; $buff .= "\tkey1 = escape('$in{'org_pass'}'); key2 = escape('$in{'postkey'}');\n";} 
    593         else{ $cookiename = 'SN_DEL'; $buff .= "\tkey1 = escape('$in{'delpass'}'); key2 = '';\n"; } 
    594         $buff .= qq|\tdocument.cookie = "$cookiename="+key1+"<>"+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|; 
    595596    } 
    596597    $buff .=<<"EOM"; 
     
    621622 
    622623    $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="‚·‚ׂă`ƒFƒbƒN"></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‚ðXV‚·‚é/ƒƒOƒAƒEƒg"></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="ƒ`ƒFƒbƒN‚µ‚½‚à‚Ì‚ðíœ"><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="‚·‚ׂă`ƒFƒbƒN"></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‚ðXV‚·‚é/ƒƒOƒAƒEƒg"></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="ƒ`ƒFƒbƒN‚µ‚½‚à‚Ì‚ðíœ"><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"; 
    624625    shift(@log); 
    625626    foreach (@log){ $buff .= makeitem($_,'admin'); } 
     
    730731sub makeitem{ 
    731732    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); 
    733734    if(!$dummy){ $filepre = $set{'file_pre'}; } 
    734735    my $orgno = $no; 
     
    750751        if($addr eq $host){ undef $host; } 
    751752        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"; 
    753754    }else{ 
    754755        my($d_com,$d_date,$d_size,$d_mime,$d_org); 
    755756        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>"; } 
    756757        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";} 
    760761    } 
    761762    return $buff; 
     
    993994 
    994995    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); 
    996997            my @note = split(/,/,$note); 
    997998            if(int($dlno) == $no){ 
Note: See TracChangeset for help on using the changeset viewer.