<%@ Language=VBScript %>
<!--#include virtual="/inc-freehost-function/FreeHostFunctionMain.asp"-->
<%
gotodir=Request.QueryString ("gotodir")
If session("agentusername")="" Then
	ef=True
	ec="授权非法，有可能是超时造成的。"
elseif not Application("canagnimg")=true then
	ef=True
	ec="管理员设置不允许上传图片。"
elseIf RegExpTest("[^A-Za-z0-9]",replace(gotodir,"\","")) Then
	ef=True
	ec="目录有非法字符！"
end if
if not ef then

memuser=session("agentusername")
root=Application("agnimgpath")&"\"&memuser

    Set fsoroot = CreateObject("Scripting.FileSystemObject")
    if not fsoroot.FolderExists(root) then
	fsoroot.CreateFolder(root)
	end if
	Set fsoroot =nothing

curdir=root&gotodir
arrdir=Split(gotodir, "\")
if UBound(arrdir)>0 then
for i=0 to UBound(arrdir)-1
if arrdir(i)<>"" then updir=updir&"\"&arrdir(i)
next
end if

httpcur="http://"&Request.ServerVariables("SERVER_NAME")&"/agphoto/"&memuser&replace(gotodir,"\","/")

    Set fso = CreateObject("Scripting.FileSystemObject")
    if not fso.FolderExists(curdir) then Response.Redirect "e.asp?e=此目录不存在或被删除了！"
    Set fxx = fso.GetFolder(curdir)

%>
<html>
<head>
<title>文件管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
td {  font-size: 9pt; text-decoration: none}
body {  font-size: 9pt}
a:link {  color: #000000; text-decoration: none}
a:hover {  color: #009900; text-decoration: underline}
a:visited {  color: #000000; text-decoration: none}
.e {  font-size: 20pt; font-weight: bold; color: #1376F8; text-decoration: none}
.h {  line-height: 16pt}
-->
</style>
</head>

<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="778" height="80" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td colspan="6" align="center" bgcolor="#0000A0"><p><b><font color="#FFFFFF" size="4">在线文件管理系统</font></b> <font color="#FFFFFF"><br>
        </font></p>
    </td>
  </tr>
</table>
<table width="778" border="0" cellspacing="0" cellpadding="0" height="21" bgcolor="#FAFAFA" align="center">
  <form name="form1" method="post" action="csub.asp"><tr> 
      <td height="35"> 　现在的位置：<a href="<%=httpcur%>" target=_blank><font color="blue"><%=httpcur%></font></a>　　<a href="default.asp?gotodir=<%=updir%>"><img src="img/updir.gif" width="15" height="13" border="0">返回上一层目录</a>　　<img src="img/csub.gif" width="17" height="16" border="0">新建文件夹
<input type="text" name="subname" size="8">
        <input type="submit" name="Submit" value="执行">
		<input type=hidden name=gotodir value="<%=replace(curdir,root,"")%>">
		　　<img src="img/refer.gif" width="18" height="17" border="0"><a href='javascript:location.reload()'><font color="#0000A0">刷新目录列表</font></a>
      
    </td>
  </tr></form>
</table>
<table width="778" border="0" cellspacing="0" cellpadding="0" height="21" bgcolor="#CCCCFF" align="center">
  <tr> 
    <td width="26%"> 　　　本目录文件夹</td>
    <td width="19%">最后修改日期：</td>
    <td width="20%">大小：</td>
    <td width="35%">操作：</td>
  </tr>
</table>
<%
    Set fsub = fxx.SubFolders
    For Each f1 in fsub
%>
<table border="0" cellspacing="2" cellpadding="0" width="778" bgcolor="#f4f4f4" align="center" >
  <tr> 
    <td width="36"></td>
    <td align="left" width="162"><a href="default.asp?gotodir=<%=gotodir&"\"&f1.name%>"><img src="img/sub.gif" width="15" height="13" border="0"> 
      <%=f1.name%></a></td>
    <td align="left" width="298"><%=f1.DateLastModified%> </td>
      <td align="left" width="272"><a href="default.asp?gotodir=<%=gotodir&"\"&f1.name%>">进入此目录</a>
	　<a href="deletefolder.asp?gotodir=<%=gotodir&"\"&f1.name%>">删除</a></td>
  </tr>
</table>
<%Next%>
<table width="778" border="0" cellspacing="0" cellpadding="0" height="21" bgcolor="#FAFAFA" align="center">
  <form action=fileupload.asp enctype=multipart/form-data method=post><tr> 
    <td width="19%" align="right"> 上传新文件到本目录下：</td>
    
      <td width="52%"><input type=hidden name=gotodir value="<%=replace(curdir,root,"")%>"><br>
        <input name=Filedata1 size=44 type=file>
        <input name=Filedata2 size=44 type=file>
        <input name=Filedata3 size=44 type=file>
        <input name=Filedata4 size=44 type=file>
        <input name=Filedata5 size=44 type=file>
      </td>
      <td width="29%" align="center"> 
        <input name=Submit39 type=submit value=上传吧>
        <br><br>
	单个文件大小不可超过２Ｍ
        <br>
        由于网络速度的原因，可能需要几分钟。</td>  
  </tr></form>
</table>
<table width="778" border="0" cellspacing="0" cellpadding="0" height="21" bgcolor="#FAFAFA" align="center">

<tr>
	<td  height="35" valign="center">	　 当前目录：<a href="<%=httpcur%>" target=_blank><font color="blue"><%=httpcur%></font></a>			　　<img src="img/refer.gif" width="18" height="17" border="0"><a href='javascript:location.reload()'><font color="#0000A0">刷新文件列表</font></a>
	</td>
  </tr>

</table>
<table width="778" border="0" cellspacing="0" cellpadding="0" height="21" bgcolor="#CCCCFF" align="center">
  <tr> 
    <td width="26%"> 　　　本目录文件夹</td>
    <td width="19%">最后修改日期：</td>
    <td width="20%">大小：</td>
    <td width="35%"> 　　操作：</td>
  </tr>
</table>
<%
    Set fc = fxx.Files
    For Each f2 in fc
    size=int(f2.size/1024)
    if size=0 then
    filesize="1K"
    elseif size>2048 then
    filesize=size&"K (超出上限)"
    else
    filesize=size&"K"
    end if
%>

<table border="0" cellspacing="2" cellpadding="0" width="778" bgcolor="#f4f4f4" align="center" >
  <tr> 
    <td width="36"></td>
    <td align="left" width="161"><a href="<%=httpcur&"/"&f2.name%>" target=_blank><img src="img/<%if Instr(1,f2.name,".htm", 1)>0 then%>html<%elseif Instr(1,f2.name,".jpg", 1)>0 then%>jpg<%elseif Instr(1,f2.name,".bmp", 1)>0 then%>bmp<%elseif Instr(1,f2.name,".gif", 1)>0 then%>gif<%elseif Instr(1,f2.name,".zip", 1)>0 or Instr(1,f2.name,".gz", 1)>0 or Instr(1,f2.name,".tar", 1)>0 then%>zip<%elseif Instr(1,f2.name,".rar", 1)>0 or Instr(1,f2.name,".r0", 1)>0 then%>rar<%elseif Instr(1,f2.name,".txt", 1)>0 then%>txt<%elseif Instr(1,f2.name,".doc", 1)>0 then%>doc<%elseif Instr(1,f2.name,".wav", 1)>0 then%>wav<%elseif Instr(1,f2.name,".mid", 1)>0 then%>wav<%elseif Instr(1,f2.name,".exe", 1)>0 then%>exe<%else%>unknow<%end if%>.gif" border="0"> 
      <%=f2.name%></a></td>
    <td align="left" width="148"><%=f2.DateLastModified%> </td>
    <td align="left" width="151"><%=filesize%> </td>
    <td align="left" width="270">
	<%
'	if Instr(1,f2.name,".htm", 1)>0 or Instr(1,f2.name,".html", 1)>0 or Instr(1,f2.name,".js", 1)>0 or Instr(1,f2.name,".txt", 1)>0 or Instr(1,f2.name,".rtf", 1)>0 or Instr(1,f2.name,".css", 1)>0 or Instr(1,f2.name,".asp", 1)>0 or Instr(1,f2.name,".asa", 1)>0 or Instr(1,f2.name,".log", 1)>0 or Instr(1,f2.name,".bat", 1)>0 or Instr(1,f2.name,".inc", 1)>0 then
'	    response.write "<a href='editfile.asp?gotodir="&gotodir&"\"&f2.name&"' target='_blank'>编辑</a>"
'	else
'	    response.write "<font color='#CCCCCC'>编辑</font>"
'	end if
'	response.write "　<a href='rename.asp?tag=file&gotodir="&gotodir&"&fname="&f2.name&"' target='_blank'>重命名</a>"
	%>

	　<a href="deletefile.asp?gotodir=<%=gotodir&"\"&f2.name%>">删除</a>
	</td>
  </tr>
</table>
<%Next
Set fso=nothing%>
<table width="778" border="0" cellspacing="0" cellpadding="0" align="center" bgcolor="#FF9933">
  <tr bgcolor="#7A88CB"> 
    <td height="60" align="center" valign="middle" bgcolor="#CCCCCC">文件管理</td>
  </tr>
</table>
</body>
</html>
<%end if
if ef then
Response.Redirect "../e.asp?e="&ec
end if%>