📄 manage.asp
字号:
<!--#include file="config.asp"-->
<!--#include file="chkuser.asp"-->
<!--#include file="inc/user.asp"-->
<!--#include file="include.asp"-->
<%
'更新ftp信息
If not connftp.Execute("Select * From [User accounts] where User='"&Request.Cookies("9cool_username")&"'").eof Then
foldersize=fso.getfolder(userdir&Request.Cookies("9cool_username")).size
connftp.Execute("UpDate [User accounts] set QuotaCurrent="&foldersize&" where user='"&Request.Cookies("9cool_username")&"'")
end if
kj=rsuser("space")*1048576
set kjs= fso.getfolder(userdir&Request.Cookies("9cool_username"))
allsize=kj/1024
usesize=kjs.size/1024
Response.Cookies("canuse")=kj-kjs.size
if right(gPath,1)<>"/" then gPath=gPath&"/"
sTemp=procCheckDir(gPath,1)
if sTemp<>"ok" then
htmend sTemp,1,""
end if
select case gAct
case "renf"
procRename()
case "rend"
procRenameDir()
case "md"
procMakeDir()
case "copy"
procDoIt()
case "cut"
procDoIt()
case "paste"
procPaste()
case "del"
procDel()
case "delit"
procDelIt()
case "delitd"
procDelItD()
end select
set gFolder=fso.GetFolder(userdir&gPath)
function procDelIt()
dim sFile,act
sFile=getVar("file","str","")
if sFile="" then htmEnd "文件不存在",1,""
act=procCheckFile(gPath&sFile,1)
if act<>"ok" then htmEnd act,1,""
fso.DeleteFile userdir&gPath&sFile
end function
function procDelItD()
dim sFile,act
sFile=getVar("file","str","")
if sFile="" then htmEnd "目录不存在",1,""
act=procCheckDir(gPath&sFile,1)
if act<>"ok" then htmEnd act,1,""
fso.DeleteFolder userdir&gPath&sFile
end function
function procDel()
dim sStr,maxdir,maxfile,i,ret
maxdir=cint(Request.Form("maxdir"))
maxfile=cint(Request.Form("maxfile"))
for i=1 to maxdir
if Request.Form("chidd"&i)<>"" then
sStr=Request.Form("chidd"&i)
ret=procCheckDir(gPath&sStr,1)
if ret<>"ok" then htmEnd ret,1,""
fso.DeleteFolder (userdir&gPath&sStr),true
end if
next
sStr=gAct&"|"&gPath
for i=1 to maxfile
if Request.Form("chidf"&i)<>"" then
sStr=Request.Form("chidf"&i)
ret=procCheckfile(gPath&sStr,1)
if ret<>"ok" then htmEnd ret,1,""
fso.DeleteFile (userdir&gPath&sStr),true
end if
next
Session("bufferdir")=""
Session("bufferfile")=""
end Function
function procpaste()
dim sStr,sStr1,i,ret,sArr
if Session("bufferdir")="" and Session("bufferfile")="" then exit function
sArr=split(Session("bufferdir"),"|")
if sArr(1)=gPath then htmend "不能自己覆盖自己!",1,""
for i=2 to ubound(sArr)
sStr=sArr(1)&sArr(i)
sStr1=gPath&sArr(i)
if fso.FolderExists(userdir&sStr1) then htmEnd "目录:"&sStr1&" 已经存在!",1,""
if procCheckDir(sStr,1)="ok" then
if sArr(0)="cut" then
fso.MoveFolder userdir&sStr,userdir&sStr1
else
fso.CopyFolder userdir&sStr,userdir&sStr1
end if
end if
next
sArr=split(Session("bufferfile"),"|")
for i=2 to ubound(sArr)
sStr=sArr(1)&sArr(i)
sStr1=gPath&sArr(i)
if procCheckFile(sStr,1)="ok" then
if sArr(0)="cut" then
if fso.FileExists(Server.MapPath(sStr1)) then htmEnd "文件 "&sStr1&" 已经存在!",1,""
fso.MoveFile userdir&sStr,userdir&sStr1
else
fso.CopyFile userdir&sStr,userdir&sStr1,true
end if
end if
next
Session("bufferdir")=""
Session("bufferfile")=""
end Function
function procRename()
dim sFrom,sTo,sStr,sObj
sFrom=getVar("from","str","")
sTo=getVar("to","str","")
types=lcase(mid(sTo,InStrRev(sTo, ".")+1))
filetype=rshost("filetype")
filetype=split(filetype,"|")
for i = 0 to ubound(filetype)
if LCase(types)=filetype(i) then
htmend "对不起,不允许使用"&types&"类型文件!",1,""
exit for
end if
next
if sFrom="" or sTo="" then exit function
sStr=procCheckFile(gPath&sFrom,1)
if sStr<>"ok" then htmEnd sStr,1,""
sStr=procCheckFile(sTo,0)
if sStr<>"ok" then htmEnd sStr,1,""
if fso.FileExists(userdir&gPath&sTo) then htmend "目标文件已存在!",1,""
set sObj=fso.GetFile(userdir&gPath&sFrom)
sObj.Move userdir&gPath&sTo
set sObj=nothing
end function
function procDoIt()
dim sStr,maxdir,maxfile,i
sStr=gAct&"|"&gPath
maxdir=cint(Request.Form("maxdir"))
maxfile=cint(Request.Form("maxfile"))
for i=1 to maxdir
if Request.Form("chidd"&i)<>"" then sStr=sStr&"|"&Request.Form("chidd"&i)
next
Session("bufferdir")=sStr
sStr=gAct&"|"&gPath
for i=1 to maxfile
if Request.Form("chidf"&i)<>"" then sStr=sStr&"|"&Request.Form("chidf"&i)
next
Session("bufferfile")=sStr
end Function
function procMakeDir()
dim sTo,sStr
sTo=getVar("to","str","")
sStr=left(sStr,inStrRev(sStr,"/"))
sStr=procCheckDir(gPath,1)
if sStr<>"ok" then htmEnd sStr,1,""
sStr=procCheckDir(gPath&sTo,0)
if sStr<>"ok" then htmEnd sStr,1,""
if fso.FolderExists(userdir&gPath&sTo) then htmEnd "目录已经存在!",1,""
fso.CreateFolder(userdir&gPath&sTo)
end function
function procRenameDir()
dim sFrom,sTo,sStr,sObj
sFrom=getVar("from","str","")
sTo=getVar("to","str","")
if sFrom="" or sTo="" then exit function
sStr=procCheckDir(gPath&sFrom,1)
if sStr<>"ok" then htmEnd sStr,1,""
sStr=procCheckdir(gPath&sTo,0)
if sStr<>"ok" then htmEnd sStr,1,""
if fso.FolderExists(userdir&gPath&sTo) then htmend "目标目录已存在!",1,""
fso.MoveFolder userdir&gPath&sFrom,userdir&gPath&sTo
set sObj=nothing
end function
%>
<!--#include file="mytop.asp"-->
<head>
<link rel="stylesheet" href="css/webedit.css" type="text/css">
<script language=javascript>
var baseurl;
baseurl='<%=gBaseUrl%>';
function openit(str)
{
window.open('<%=rshost("userurl")%><%=gPath%>'+str,'view','');
}
function chdir(dir,mode)
{
var obj;
obj=document.webedit;
if(!dir)
{alert('请输入要浏览的目录');return;}
if(mode)
{
if(obj.filter.value)
obj.action='<%=gFileName%>?filter='+obj.filter.value+'&path=<%=gPath%>'+dir;
else
obj.action='<%=gFileName%>?path=<%=gPath%>'+dir;
}
else
{
if(obj.filter.value)
obj.action='<%=gFileName%>?filter='+obj.filter.value+'&path='+dir;
else
obj.action='<%=gFileName%>?path='+dir;
}
obj.submit();
}
function edit(name)
{
window.open('editfile.asp?act=read&path=<%=gPath%>'+name);
}
function rename(oldName)
{
str=prompt('将文件 '+oldName+' 改名为:',oldName);
if(!str)return;
obj=document.webedit;
obj.action=baseurl+'&act=renf&from='+oldName+'&to='+str;
obj.submit();
}
function renamed(oldName)
{
str=prompt('将目录 '+oldName+' 改名为:',oldName);
if(!str)return;
obj=document.webedit;
obj.action=baseurl+'&act=rend&from='+oldName+'&to='+str;
obj.submit();
}
function paste()
{
<%if Session("bufferfile")="" or Session("bufferdir")="" then
response.write("alert('剪贴板中没有数据!');"&vbcrlf)
response.write "return;"
end if%>
if(!confirm('确定要将文件粘贴到此目录吗?'))
return;
obj=document.webedit;
obj.action=baseurl+'&act=paste';
obj.submit();
}
function del()
{
obj=document.webedit;
if(!confirm('确定要删除选中的目录与文件吗?'))
return;
obj.action=baseurl+'&act=del';
obj.submit();
}
function mkdir()
{
str=prompt('请输入新建目录名称:','');
if(!str)return;
obj=document.webedit;
obj.action=baseurl+'&act=md&to='+str;
obj.submit();
}
function selfileall(act)
{
i=1;
obj=document.webedit;
while(eval('obj.chidf'+i))
{
obj1=eval('obj.chidf'+i);
obj1.checked=act;
i++;
}
}
function seldirall(act)
{
i=1;
obj=document.webedit;
while(eval('obj.chidd'+i))
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -