<!--#include file="conn.asp"-->
<%if request.cookies("admin")("admin")="" then
response.Write "<script language='javascript'>alert('网络超时或您还没有登陆！');window.location.href='login.asp';</script>"
response.End
else
if request.cookies("admin")("flag")>1 then
response.Write "<p align=center><font color=red>您没有此项目管理权限！</font></p>"
response.End
end if
end if
dim path
dim objFSO
dim uploadfolder
dim uploadfiles
dim upname
dim UpFolder
dim upfilename
gNoFile=array("asp","aspx") '禁止访问的脚本
if request("path")<>"" then
path=request("path")
else 
path="../news"
end if
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
if request("filename")<>"" then
if objFSO.fileExists(Server.MapPath(""&path&"\"&request("filename"))) then
objFSO.DeleteFile(Server.MapPath(""&path&"\"&request("filename")))
else
response.write "未找到"&path&request("filename")
end if
end if%>

<title>管理页面</title>
<link href="../image/css.css" rel="stylesheet" type="text/css">
<meta name=GENERATOR content="Microsoft FrontPage 3.0" charset=GB2312>
<body leftmargin="0" topmargin="0" marginheight="0" marginwidth="0">
<table width="100%" border="0" align=center cellpadding="2" cellspacing="1">
<tr>
<td colspan=2 class="managetop" style="padding-left:20px" onClick="expandIt('elone')">选择管理的目录或者自行选择路径</td>
</tr></table>
<table width="100%" border="0" align=center cellpadding="2" cellspacing="1">

<tr>
<td class="tdcolor" style="padding-left:20px"><b>服务器上传管理</b></td>
<td class="tdcolor"><a href="?path=../editor/uploadfile">远程上传</a></td>
</tr>
<tr> 
<form method="POST" action="?action=pathname">
<td class="tdcolor" style="padding-left:20px">要查看的文件夹：</td>
<td class="tdcolor"> <input type="text" name="path" size="35"> 
&nbsp; <input type="submit" value="提交">（<font color=red>请填写正确的文件夹名或路径</font>）</td>
</form>
</tr>
<tr> 
<td height=25 class="tdcolor"></td>
<td height=25 class="tdcolor">当前浏览<%=path%>目录的所有文件列表如下</td>
</tr>
</table>
</DIV>
<%dim pagesize, page, filenum, pagenum
pagesize=18
page=request.querystring("page")'当前页数
if page="" or not isnumeric(page) then
page=1
else
page=int(page)
end if%>
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#FFFFFF" style="border-top:2px solid #ffffff">
<tr align=center>
<td width="50" height=25 class="managetop">类型</td>
<td class="managetop">缩略图</td>
<td class="managetop">所在文件夹</td>
<td class="managetop">大小</td>
<td class="managetop">上传</td>
<td class="managetop">访问</td>
<td class="managetop">&nbsp;</td>
</tr class="managetop">
<%on error resume next
Set uploadFolder=objFSO.GetFolder(Server.MapPath(""&path&"\"))
if err.number<>0 then
response.write "<tr><td colspan=6>"&Err.Description&"</td></tr>"
response.end
end if
Set uploadFiles=uploadFolder.Files
filenum=uploadfiles.count'总记录
pagenum=int(filenum/pagesize)'总页数
if filenum mod pagesize>0 then
pagenum=pagenum+1
end if
if page> pagenum then
page=1
end if
i=0
For Each Upname In uploadFiles
i=i+1
if i>(page-1)*pagesize and i<=page*pagesize then
upfilename=upname.name%>
<tr>
<td align=center nowrap class="tdcolor">
<%dim a
a=split(upname.name,".")%><img src="images/files/<%= a(1) %>.gif" border=0></td>
<td align=center class="tdcolor"><a href="<%=path %>/<%=upfilename %>" target=_blank title="大小:<%=upname.size %>B;上传:<%=formatdatetime(upname.datecreated,2)%>;访问:<%=formatdatetime(upname.datelastaccessed,2)%>"><img src="<%=path %>/<%=upfilename %>" height=20 width=20 border=0></a></td>	
<td align=center class="tdcolor"><%=path%></td>
<td align=center class="tdcolor"><%=upname.size %>B</td>
<td align=center class="tdcolor"><%=formatdatetime(upname.datecreated,2)%></td>
<td align=center class="tdcolor"><%=formatdatetime(upname.datelastaccessed,2)%></td>
<td align=center class="tdcolor"><a href='?filename=<%=upname.name%>&path=<%=request("path")%>'>删除</a></td>
</tr>
<%elseif i>page*pagesize then
exit for
end if
next
set uploadFolder=nothing
set uploadFiles=nothing%>
<tr>
<form method="POST" action="?path=<%=path%>">
<td height=25 colspan=7 align=center class="tdcolor">
<%if page>1 then
response.write"<a href='?page="&request("page")-10&"&path="&request("path")&"'>上10页</a>&nbsp;<a href='?page="&request("page")-20&"&path="&request("path")&"'>上20页</a>&nbsp;"
response.write "<a href=?page=1&path="&request("path")&">首页</a>&nbsp;&nbsp;<a href=?page="& page-1 &"&path="&request("path")&">上一页</a>&nbsp;"
else
response.write "首页&nbsp;上一页&nbsp;"
end if
if page<i/pagesize then
response.write "<a href=?page="& page+1 &"&path="&request("path")&">下一页</a>&nbsp;&nbsp;<a href=?page="& pagenum &"&path="&request("path")&">尾页</a>&nbsp;"
response.write"<a href='?page="&request("page")+10&"&path="&request("path")&"'>下10页</a>&nbsp;<a href='?page="&request("page")+20&"&path="&request("path")&"'>下20页</a>&nbsp;"
else
response.write "下一页&nbsp;尾页&nbsp;"
end if
response.write"第"&request("page")&"页/共"&pagenum&"页&nbsp;"
response.write " "&filenum_&"</td></tr>"
%>
</form>
</tr>
</table>
