<!--#include file="../include/Conn.jsp"-->
<!--#include file="../include/Char.jsp"-->
<!--#include file="Admin_IsLogin.jsp" -->
<html>
<head>
<title></title>
<meta http-equiv=Content-Type content="text/html; charset=gb2312">
<link href="Images/Style.css" rel="stylesheet" type="text/css">
</head>
<body leftmargin=0 topmargin=0 marginheight="0" marginwidth="0">
<%
	admin_flag=",1|4|0,"
	if instr(session("flag"),admin_flag)=0 or isnull(session("flag"))=true then
	Response.write "<br><br><br><br><b><font color=red>对不起，您没有管理本页面的权限!</font></B>"
	Response.end
	end if


pagesize=12
dim fso,uploadpath,filename
dim folder
dim num,pagecount,filenum,page
if request("path")<>"" then
uploadpath=request("path")
else 
uploadpath="../UploadFile"
end if
dim sFor(100,100)
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"
%>
<br>
<table class=tableBorder width="95%" border=0 align="center" cellpadding=2 cellspacing=1 >
    <tr> 
      
    <th height=22 colspan="5" align="center" sytle="line-height:150%">查看文件夹</th>
    </tr>
          <form name="form1" method="get" action="?path=">
            <tr> 
              <td class=forumRow height="20" sytle="line-height:150%">要查看的文件夹： 
                <input name="path" type="text" class="editbox4" id="path"> <input name="Submit" type="submit" class="button" value="提交"> 
                <font color="#FF0000">请填写正确的文件夹名或路径</font> </td>
            </tr>
            <tr> 
              <td class=forumRow height="20" sytle="line-height:150%">当前浏览　<font color=red><%=uploadpath%></font>　目录的所有文件列表如下</td>
            </tr>
          </form>
        </table>
        <br>
        
<table class=tableBorder cellpadding="2" cellspacing="1" border="0" width="95%" align=center >
      <tr> 
      
    <th height=22 colspan="5" align="center" sytle="line-height:150%">上传文件列表</th>
    </tr>
  <tr> 
    <td class=forumHeaderBackgroundAlternate align="center"><strong>文件地址</strong></td>
    <td class=forumHeaderBackgroundAlternate align="center"><strong>大小</strong></td>
    <td class=forumHeaderBackgroundAlternate align="center"><strong>上传日期</strong></td>
    <td class=forumHeaderBackgroundAlternate align="center"><strong>管理</strong></td>
  </tr>
  <%
set fso=server.createobject("scripting.filesystemobject")
if request("filename")<>"" then
   if fso.fileExists(Server.MapPath(""&uploadpath&"\"&request("filename"))) then
      fso.DeleteFile(Server.MapPath(""&uploadpath&"\"&request("filename")))
   else
      response.write "未找到：<u><font color=red>"&uploadpath&"/"&request("filename")&"</font></u>"
   end if
end if
on error resume next
set folder=fso.getfolder(server.mappath(uploadpath))
if err.number<>0 then
response.write "<tr><td colspan=5 class=tablebody1>"&Err.Description&"</td></tr>"
response.end
end if
set num=folder.files

filenum=num.count
pagecount=int(filenum/pagesize)

page=request.querystring("page")
if page="" or not isnumeric(page) then
	page=1
else
	page=int(page)
end if

if filenum mod pagesize>0 then
	pagecount=pagecount+1
end if
if page> pagecount then
	page=1
end if

i=0
for each filename in folder.files
	i=i+1
	if i>(page-1)*pagesize and i<=page*pagesize then
%>
  <tr> 
    <td class=forumRow height=25><%="<a href="&uploadpath&"/"&filename.name&" target=_blank>"&filename.name&"</a>"%></td>
    <td class=forumRow height=25 align=center><%=filename.size%> 字节</td>
    <td class=forumRow height=25 align=center><%=filename.datecreated%></td>
    <td class=forumRow height=25 align=center><a href=?filename=<%=filename.name%>&path=<%=request("path")%>>删除</a></td>
  </tr>
  <%
	elseif i>page*pagesize then
		exit for
	end if
next
%>
  <tr> 
    <td class=forumRow height=25 colspan="5"> <%
response.write "&nbsp;&nbsp;共计：<b><font color=#FF0000>"&folder.size&"</font> k</b> &nbsp;"

%> </td>
  </tr>
</table>
        <%
if filenum<>0 then
  response.write "<table width=95% height=35 valign=middle cellspacing=0 cellpadding=0 border=0 align=center><tr><td>"
  response.write "共有文件<b><font color=#FF0000>"&filenum&"</font></b>个 "&_
  "页次：<b><font color=#FF0000>"&page&"</font>/"&pagecount&"</b>页 <b>"&pagesize&"</b>个文件/页"
   response.write "</td><td align=right>"
  if page<2 then
  response.write "<font color=#999999>首页 上一页</font> "
  else
  response.write "<a href=?path="&uploadpath&">首页</a> <a href=?page="&page-1&"&path="&uploadpath&">上一页</a> "
  end if

  if pagecount-page<1 then
  response.write "<font color=#999999>下一页 尾页</font> "
  else
  response.write "<a href=?page="&page+1&"&path="&uploadpath&">下一页</a> <a href=?page="&pagecount&"&path="&uploadpath&">尾页</a> "
  end if

  response.write "跳转：<select name=page onchange=""if(this.options[this.selectedIndex].value!=''){location=this.options[this.selectedIndex].value;}"">"
  for i=1 to pagecount
  if i=cint(page) then
  response.write "<option value=?page="&i&"&path="&uploadpath&" selected>"&i&"</option>"
  else
  response.write "<option value=?page="&i&"&path="&uploadpath&">"&i&"</option>"
  end if
next
response.write "</select></td>"&_
"</td></tr></table>"
end if

set fso=nothing
set folder=nothing


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
%>

</body></html>
