📄 admin_bbsftpdownload.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()
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=blue>下载</font>文件管理</H1>
<table cellpadding="2" cellspacing="1" border="0" width="95%" class="tableBorder" align=center>
<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=3 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>
<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_DownLoadFiles where flag =0 ORDER BY Flag,TIME"
case 2
sql="SELECT * FROM FtpLog_DownLoadFiles where flag >1 ORDER BY Flag,TIME"
case 3
sql="SELECT * FROM FtpLog_DownLoadFiles where flag =2 ORDER BY Flag,TIME"
case 4
sql="SELECT * FROM FtpLog_DownLoadFiles where flag =3 ORDER BY Flag,TIME"
case 5
sql="SELECT * FROM FtpLog_DownLoadFiles where flag =4 ORDER BY Flag,TIME"
case 6
sql="SELECT * FROM FtpLog_DownLoadFiles where flag =5 ORDER BY Flag,TIME"
case 7
sql="SELECT * FROM FtpLog_DownLoadFiles where flag =1 ORDER BY Flag,TIME"
case 8
sql="SELECT * FROM FtpLog_DownLoadFiles where flag<>1 ORDER BY Flag,TIME"
case else
sql="SELECT * FROM FtpLog_DownLoadFiles 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=6>删除记录</option>
</select>
</td>
</tr><tr>
<td colspan=8 align=center height=25 class="forumRowHighlight">
<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(bmsg)
dim i
i = request("fileid")
response.write "i =" & i
if i="" then
founderr = true
errmsg = errmsg +"<br>请选择文件."
end if
'if bmsg then
'sql ="select UserName,FileName from FtpLog_DownLoadFiles where ID in (" & i & ")"
'set rs=logconn.execute(sql)
'while not rs.eof
'rs.movenext
'wend
'set rs=nothing
'end if
sql ="delete from FtpLog_DownLoadFiles where ID in (" & i & ")"
logconn.execute sql
bbsftp_suc( "<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 from FtpLog_DownLoadFiles 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(0)
suname=rs(1)
sftp=rs(2)
sql="update FtpLog_DownLoadFiles set Flag=1 where id=" & rs(3)
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(true)
elseif request("fileaction")=6 then
call dodel(false)
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_DownLoadFiles 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
sub delfile(filename)
dim objFSO
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
if filename<>"" and objFSO.FileExists(filename) then
call objFSO.DeleteFile(filename,true)
end if
set objFSO=nothing
end sub
function typestring(idx)
if idx=1 then
typestring="检查通过"
elseif idx=2 then
typestring="非法下载"
else
typestring="等待检查"
end if
end function
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -