📄 admin_bbsftpupload.asp
字号:
<!--#include file="inc/ftp.asp"-->
<script language="JavaScript">
<!--
function CheckAll(form) {
for (var i=0;i<form.elements.length;i++) {
var e = form.elements[i];
if (e.name == 'fileid') e.checked = form.chkall.checked;
}
}
//-->
</script>
<%
Head()
dim path,i
dim upname
dim upfilename
dim filetype
dim sfor(32,2)
if not CheckAdmin() then
response.end
else
if request("action")="tofile" then
'call dopass()
call tofile()
'elseif request("action")="delete" then
' call dodel()
else
call main()
end if
if founderr then bbsftp_error(errmsg)
end if
BBSFTP_Footer()
%>
</body></html>
<%
sub main()
if request("filetype")="" or not isnumeric(request("filetype")) then
filetype=1
else
filetype=request("filetype")
end if
%>
<H1 align=center>Ftp<font color=red>上传</font>文件管理</H1>
<table cellpadding="2" cellspacing="1" border="0" width="95%" class="tableBorder" align=center>
<tr >
<td width="100%" valign=top colspan=2 class="forumrow"><p>
<b>注意</b>:<BR>①、本功能必须服务器支持FSO权限方能使用,FSO使用帮助请浏览微软网站。
</td>
</tr>
<form action="?action=userSearch" method=post>
<tr>
<td width=20% class=forumrow>快速搜索</td>
<td width=80% class=forumrow>
<select size=1 name="filetype" onchange="javascript:submit()">
<option value="0">请选择查询条件</option>
<option value="1" <%if filetype=1 then%>selected<%end if%>>等待检查的文件</option>
<option value="2" <%if filetype=2 then%>selected<%end if%>>检查未通过的文件</option>
<option value="3" <%if filetype=3 then%>selected<%end if%>>不完整的文件</option>
<option value="4" <%if filetype=4 then%>selected<%end if%>>无法播放的文件</option>
<option value="5" <%if filetype=5 then%>selected<%end if%>>缺相关文件的文件</option>
<option value="6" <%if filetype=6 then%>selected<%end if%>>删除的文件</option>
<option value="7" <%if filetype=7 then%>selected<%end if%>>通过检查的文件</option>
<option value="8" <%if filetype=8 then%>selected<%end if%>>所有未通过的文件</option>
<option value="9" <%if filetype=9 then%>selected<%end if%>>所有的文件</option>
</select>
</td>
</tr>
</form>
<tr>
<td colspan=2 height=25 class="forumRowHighlight">
<b>当前浏览的所有文件列表如下</b>
</td>
</tr>
</table><BR>
<%
sFor(0,0)="txt":sFor(0,1)="txt"
sFor(1,0)="chm":sFor(1,1)="chm"
sFor(2,0)="hlp":sFor(2,1)="chm"
sFor(3,0)="doc":sFor(3,1)="doc"
sFor(4,0)="pdf":sFor(4,1)="pdf"
sFor(5,0)="gif":sFor(5,1)="gif"
sFor(6,0)="jpg":sFor(6,1)="jpg"
sFor(7,0)="png":sFor(7,1)="png"
sFor(8,0)="bmp":sFor(8,1)="bmp"
sFor(9,0)="asp":sFor(9,1)="asp"
sFor(10,0)="jsp":sFor(10,1)="asp"
sFor(11,0)="js" :sFor(11,1)="asp"
sFor(12,0)="htm":sFor(12,1)="html"
sFor(13,0)="html":sFor(13,1)="html"
sFor(14,0)="shtml":sFor(14,1)="html"
sFor(15,0)="zip":sFor(15,1)="zip"
sFor(16,0)="rar":sFor(16,1)="rar"
sFor(17,0)="exe":sFor(17,1)="exe"
sFor(18,0)="avi":sFor(18,1)="avi"
sFor(19,0)="mpg":sFor(19,1)="mpg"
sFor(20,0)="ra" :sFor(20,1)="ra"
sFor(21,0)="ram":sFor(21,1)="ra"
sFor(22,0)="mid":sFor(22,1)="mid"
sFor(23,0)="wav":sFor(23,1)="wav"
sFor(24,0)="mp3":sFor(24,1)="mp3"
sFor(25,0)="asf":sFor(25,1)="asf"
sFor(26,0)="php":sFor(26,1)="aspx"
sFor(27,0)="php3":sFor(27,1)="aspx"
sFor(28,0)="aspx":sFor(28,1)="aspx"
sFor(29,0)="xls":sFor(29,1)="xls"
sFor(30,0)="mdb":sFor(30,1)="mdb"
sFor(31,0)="rm":sFor(31,1)="rm"
sFor(32,0)="rmvb":sFor(32,1)="rm"
dim pagesize, page, filenum, pagenum, endpage
pagesize=40
page=request.querystring("page")
if page="" or not isnumeric(page) then
page=1
else
page=int(page)
end if
%>
<table cellpadding="2" cellspacing="1" border="0" width="95%" class="tableBorder" align=center style="table-layout:fixed;word-break:break-all">
<FORM METHOD=POST ACTION="?action=tofile" name="filelst">
<tr align=center>
<th width="30" height=25>操作</th>
<th width="30" height=25>类型</th>
<th width="*">文件地址</th>
<th width="80">记录大小</th>
<th width="80">上传用户</th>
<th width="120">上传日期</th>
<th width="100">上传IP地址</th>
<th width=100>状态</th>
</tr>
<%
select case filetype
case 1
sql="SELECT * FROM FtpLog_UpLoadFiles where flag =0 ORDER BY Flag,TIME"
case 2
sql="SELECT * FROM FtpLog_UpLoadFiles where flag >1 ORDER BY Flag,TIME"
case 3
sql="SELECT * FROM FtpLog_UpLoadFiles where flag =2 ORDER BY Flag,TIME"
case 4
sql="SELECT * FROM FtpLog_UpLoadFiles where flag =3 ORDER BY Flag,TIME"
case 5
sql="SELECT * FROM FtpLog_UpLoadFiles where flag =4 ORDER BY Flag,TIME"
case 6
sql="SELECT * FROM FtpLog_UpLoadFiles where flag =5 ORDER BY Flag,TIME"
case 7
sql="SELECT * FROM FtpLog_UpLoadFiles where flag =1 ORDER BY Flag,TIME"
case 8
sql="SELECT * FROM FtpLog_UpLoadFiles where flag<>1 ORDER BY Flag,TIME"
case else
sql="SELECT * FROM FtpLog_UpLoadFiles ORDER BY Flag,TIME"
end select
set rs=server.createobject("adodb.recordset")
rs.open sql,logconn,1,1
if not(rs.bof and rs.eof) then
filenum = GetRecordCount(rs)
pagenum=int(filenum/pagesize)
if filenum mod pagesize>0 then
pagenum=pagenum+1
end if
if page> pagenum then
page=1
end if
rs.movefirst
rs.move (page-1)*pagesize
i=0
while (not rs.eof) and i<pagesize
upfilename=rs("filename")
upname = GetFileTitle(upfilename)
response.write "<tr><td align=center height=24 class=forumrow><input type=""checkbox"" name=fileid value="&rs("id")&"></td>"
response.write "<td align=center height=24 class=forumrow><img src=""Skins/Default/filetype/"& procGetFormat(upname) &".gif"" border=0></td>"
response.write "<td class=forumrow><a href="""&upfilename&""" target=_blank>"&upname&"</a></td>"
response.write "<td align=center class=forumrow>"& FileSizeStr(rs("filesize")) &"</td>"
response.write "<td align=center class=forumrow>"& rs("username") &"</td>"
response.write "<td align=center class=forumrow>"& rs("time") &"</td>"
response.write "<td align=center class=forumrow>"& rs("IPAddress") &"</td>"
response.write "<td align=center class=forumrow>"
if(rs("flag")=1) then
response.write"<font color=green>通过检查</font></td>"
else
response.write"<font color=red>"&typestring(rs("flag"))&"</font></td>"
end if
response.write"</tr>"
i = i +1
rs.movenext
wend
else
response.write"<tr><td colspan=8 class=forumrow align=center>没有文件</td></tr>"
end if
rs.close
set rs=nothing
%>
<tr><td class=forumrow align=center>
<input type=checkbox name=chkall onclick="CheckAll(filelst)">
</td>
<td class=forumrow align=left>全选</td>
<td colspan=6 align=center height=25 width=* class="forumRowHighlight">
<B>请选择您需要进行的操作</B>:
<select size=1 name="fileaction">
<option value=1>通过检查</option><option value=2>文件不完整</option>
<option value=3>文件无法播放</option><option value=4>缺相关文件</option>
<option value=5>删除文件</option><option value=6>删除记录</option>
</select>
</td>
</tr><tr>
<td colspan=8 align=center height=25 class="forumRowHighlight">
删除文件时同时扣除用户的上载流量
<input type=radio name=delfile value=1 >是
<input type=radio name=delfile value=2 checked>否
<input type=submit name=submit value="执行选定的操作">
</td>
</tr>
</FORM>
</table>
<table border=0 cellpadding=0 cellspacing=3 width=100% align=center>
<tr><td valign=middle nowrap>
页次:<b><%=page%></b>/<b><%=pagenum%></b>页
每页<b><%=pagesize%></b> 总数<b><%=filenum%></b></td>
<td valign=middle nowrap><font color=red><div align=right><p>分页:
<%
if page > 4 then
response.write "<a href=""?page=1&filetype="&filetype&""">[1]</a> ..."
end if
if pagenum > page+3 then
endpage=page+3
else
endpage=pagenum
end if
for i=page-3 to endpage
if not i<1 then
if i = clng(page) then
response.write " <font color=blue>["&i&"]</font>"
else
response.write " <a href=""?page="&i&"&filetype="&filetype&""">["&i&"]</a>"
end if
end if
next
if page+3 < pagenum then
response.write "... <a href=""?page="&pagenum&"&filetype="&filetype&""">["&pagenum&"]</a>"
end if
%>
</p></div></font></td></tr></table>
<%
end sub
sub dodel()
dim i,n,ftsize,fttime,fup
n = clng(request("delfile"))
i = request("fileid")
if i="" then
founderr = true
errmsg = errmsg +"<br>请选择文件."
end if
if 1=n then
sql ="select * from FtpLog_UpLoadFiles where ID in (" & i & ")"
set rs=logconn.execute(sql)
while not rs.eof
ftsize = rs("FileSize")/1024
fttime = rs("UsedTime")
fup = 1
sql = "update FtpLog_UserStatistic set UpTime=UpTime-" & fttime & ", KBUp=KBUp-" & ftsize & ",FUp=Fup-" & fup &" where UserName='"&rs("UserName")&"' and FTP='"&rs("FTP")&"'"
logconn.execute sql
rs.movenext
wend
set rs=nothing
end if
sql ="update FtpLog_UpLoadFiles set Flag=5 where ID in (" & i & ")"
logconn.execute sql
response.write "<br>操作成功!"
end sub
sub dodellog()
dim i
i = request("fileid")
if i="" then
founderr = true
errmsg = errmsg +"<br>请选择文件."
end if
sql ="delete from FtpLog_UpLoadFiles where ID in (" & i & ")"
logconn.execute sql
response.write "<br>操作成功!"
end sub
sub dopass()
dim i
i = request("fileid")
if i="" then
founderr = true
errmsg = errmsg +"<br>请选择文件."
end if
dim fsize
dim sftp
dim suname
dim fname
sql="select FileName,UserName,FTP,id,filesize from FtpLog_UpLoadFiles where flag<>1 and id in ("&i&")"
set rs=logconn.execute( sql)
if rs.eof and rs.bof then
founderr = true
errmsg = errmsg +"<br>文件没找到,请选择文件."
end if
while not rs.eof
fname=rs("FileName")
suname=rs("UserName")
sftp=rs("FTP")
'把下面三行注释 去掉 就能 按 上传 1 : 下载 3 奖励用户。
'fsize = rs("filesize") * 3
'sql="update FtpUserDown set MaxDownSize=MaxDownSize +" & fsize & " where FTP='" & sftp & "' and UserName='" & suname & "'"
'bbsconn.execute sql
sql="update FtpLog_UpLoadFiles set Flag=1 where id=" & rs("id")
logconn.execute sql
response.write "<br>通过"&rs(1)&"上传的文件"&rs(0)&",大小为:"&filesizestr(fsize) & " [无动作]"
rs.movenext
wend
set rs=nothing
response.write "<br>操作成功!"
end sub
sub tofile()
if request("fileaction")=1 then
call dopass()
elseif request("fileaction")=5 then
call dodel()
elseif request("fileaction")=6 then
call dodellog()
else
call doother(request("fileaction"))
end if
end sub
sub doother(idx)
dim i
i = request("fileid")
response.write "i =" & i
if i="" then
founderr = true
errmsg = errmsg +"<br>请选择文件."
end if
sql ="update FtpLog_UpLoadFiles set Flag="&idx&" where ID in (" & i & ")"
rs=logconn.execute(sql)
bbsftp_suc "<br>操作成功!"
end sub
function procGetFormat(sName)
dim i,str
procGetFormat=0
if instrRev(sName,".")=0 then exit function
str=lcase(mid(sName,instrRev(sName,".")+1))
for i=0 to uBound(sFor,1)
if str=sFor(i,0) then
procGetFormat=sFor(i,1)
exit for
end if
next
end function
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -