Save the following code into an ASP file to facilitate management of files on the server
<title>http://bbs. Production: Xiaohui QQ: 103895</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
a:link {
font-size: 9pt;
}
a:visited {
font-size: 9pt;
}
a:hover {
font-size: 9pt;
}
a:active {
font-size: 9pt;
}
body {
font-size: 9pt;
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
line-height: 20px;
}
td {
font-size: 9pt;
line-height: 20px;
}
-->
</style>
<%
action=("action")
temp=split(("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=("foldername")
filename=("filename")
path=foldername
if path="" then path=("./")
ShowFolderList(path)
end select
Function ShowFolderList(folderspec)
temp=("HTTP_REFERER")
temp=left(temp,Instrrev(temp,"/"))
temp1=len(folderspec)-len(("./"))-1
if temp1>0 then
temp1=right(folderspec,cint(temp1))
elseif temp1=-1 then
temp1=""
end if
tempurl=temp+replace(temp1,"\","/")+"/"
Set fso = CreateObject("")
upfolderspec=(folderspec&"\")
%>
<a href="<%= url%>?action=newfolder&foldername=<%= folderspec%>">New folder</a> | <a href="<%= url%>?action=newfile&filename=<%= folderspec&"\"%>">New file</a> | <a href="<%= url%>?action=upload">Upload the file</a> | <a href="<%= url%>?foldername=<%= upfolderspec%>">Upload</a> | <a href="<%= url%>?action=logout">Exit</a>
<table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#6595D6">
<tr bgcolor="#E4E8EF">
<td width="64%"><div align="center">name</div></td>
<td width="7%"><div align="right">Size</div></td>
<td width="6%"><div align="center">type</div></td>
<td width="15%"><div align="left">Modification time</div></td>
<td width="8%"><div align="center">Operation</div></td>
</tr>
<%
'List the directory
Set f = (folderspec)
Set fc =
For Each f1 in fc
%>
<tr bgcolor="#E4E8EF" onMouseOut=='#E4E8EF'; onMouseOver=='#FFFFFF';>
<td><a href="<%= url%>?foldername=<%= folderspec%>\<%= %>"><%= %></a></td>
<td><div align="right"><%= %></div></td>
<td><div align="center">Folder</div></td>
<td><div align="left"><%= %></div></td>
<td><a href="<%= url%>?action=editfolder&foldername=<%= folderspec&"\"&%>">Modify</a> <a href="<%= url%>?action=delfolder&foldername=<%= folderspec&"\"&%>" onclick="{if(confirm('Delete folder<<%= %>>or?')){return true;}return false;}">Delete</a></td>
</tr>
<%
Next
'List the files
Set fc =
For Each f1 in fc
%>
<tr bgcolor="#E4E8EF" onMouseOut=='#E4E8EF'; onMouseOver=='#FFFFFF';>
<td><a href="<%= tempurl+%>" target="_blank"><%= %></a></td>
<td><div align="right"><%= %></div></td>
<td><div align="left"></div></td>
<td><div align="left"><%= %></div></td>
<td><a href="<%= url%>?action=editfile&filename=<%= folderspec&"\"&%>">Modify</a> <a href="<%= url%>?action=delfile&filename=<%= folderspec&"\"&%>" onclick="{if(confirm('Delete file<<%= %>>Is it?')){return true;}return false;}">Delete</a></td>
</tr>
<%
Next
set fso=nothing
%>
</table>
<%
End Function
'File Operation
function delfile()
filename=("filename")
set fso=("")
(filename)
tempurl=url&"?foldername="&(filename)
set fso=nothing
(tempurl)
end function
function savefile()
filename=("filename")
content=("content")
filename1=("filename1")
if ("PATH_TRANSLATED")<>filename then
set fso=("")
set f1=(filename,2,true)
(content)
if filename1<>"" and filename1<>filename then (filename1)
tempurl=url&"?foldername="&(filename)
set fso=nothing
end if
(tempurl)
end function
function filenew()
filename=("filename")
content=""
fileform filename,content,filename1
end function
function fileedit()
filename=("filename")
filename1=("filename")
set fso=("")
set f1=(filename,1,true)
content=()
set fso=nothing
fileform filename,content,filename1
end function
function fileform(filename,content,filename1)
%>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<form name="form1" method="post" action="<%= url%>?action=savefile">
<tr>
<td><input name="filename1" type="hidden" value="<%= filename1%>"><input name="filename" type="text" value="<%= filename%>" style="width:100%"></td>
</tr>
<tr>
<td><textarea name="content" wrap="VIRTUAL" style="width:100%;height:100%;font:Arial,Helvetica,sans-serif;" onKeyUp="=;"><%= content%></textarea></td>
</tr>
<tr>
<td><center><input type="submit" name="Submit" value="Save" style="width:200"><input type="reset" name="Submit2" value="reset" style="width:200"></center></td>
</tr>
</form>
</table>
<%
end function
'Folder operation function
function delfolder()
foldername=("foldername")
set fso=("")
tempurl=url&"?foldername="&(foldername)
(foldername)
set fso=nothing
(tempurl)
end function
function savefolder()
foldername=("foldername")
foldername1=("foldername1")
set fso=("")
if foldername1="" then
set f=(foldername)
else
foldername1,foldername
end if
tempurl=url&"?foldername="&f
set fso=nothing
(tempurl)
end function
function newfolder()
foldername=("foldername")&"\"
formfolder foldername,foldername1
end function
function editfolder()
foldername=("foldername")
foldername1=("foldername")
formfolder foldername,foldername1
end function
function formfolder(foldername,foldername1)
%>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<form name="form1" method="post" action="<%= url%>?action=savefolder">
<tr><td><input name="foldername1" type="hidden" value="<%= foldername1%>"><input name="foldername" type="text" value="<%= foldername%>" style="width:100%"></td></tr>
<tr><td><center><input type="submit" name="Submit" value="Save" style="width:200"><input type="reset" name="Submit2" value="reset" style="width:200"></center></td></tr>
</form>
</table>
<%
end function
function upload()
%>
<form action="?action=saveupload" method="post" enctype="multipart/form-data" name="form2">
<div align="center">To be completed
<input type="file" name="file" style="width:80%">
<input type="submit" name="Submit" value="Submit">
</div>
</form>
<%
end function
function saveupload()
'To be realized
end function
'Login
function chklogin()
password=("password")
if password="ok" then session("login")="login"
if session("login")<>"login" then login
end function
function login()
%>
<form name="form1" method="post" action="<%= url%>?action=chklogin">
<center>Please enter your password: <input name="password" type="password"><input type="submit" name="Submit" value="Login"></center>
</form>
<%
()
end function
function logout()
()
(url)
end function
%>
<title>http://bbs. Production: Xiaohui QQ: 103895</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
a:link {
font-size: 9pt;
}
a:visited {
font-size: 9pt;
}
a:hover {
font-size: 9pt;
}
a:active {
font-size: 9pt;
}
body {
font-size: 9pt;
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
line-height: 20px;
}
td {
font-size: 9pt;
line-height: 20px;
}
-->
</style>
<%
action=("action")
temp=split(("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=("foldername")
filename=("filename")
path=foldername
if path="" then path=("./")
ShowFolderList(path)
end select
Function ShowFolderList(folderspec)
temp=("HTTP_REFERER")
temp=left(temp,Instrrev(temp,"/"))
temp1=len(folderspec)-len(("./"))-1
if temp1>0 then
temp1=right(folderspec,cint(temp1))
elseif temp1=-1 then
temp1=""
end if
tempurl=temp+replace(temp1,"\","/")+"/"
Set fso = CreateObject("")
upfolderspec=(folderspec&"\")
%>
<a href="<%= url%>?action=newfolder&foldername=<%= folderspec%>">New folder</a> | <a href="<%= url%>?action=newfile&filename=<%= folderspec&"\"%>">New file</a> | <a href="<%= url%>?action=upload">Upload the file</a> | <a href="<%= url%>?foldername=<%= upfolderspec%>">Upload</a> | <a href="<%= url%>?action=logout">Exit</a>
<table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#6595D6">
<tr bgcolor="#E4E8EF">
<td width="64%"><div align="center">name</div></td>
<td width="7%"><div align="right">Size</div></td>
<td width="6%"><div align="center">type</div></td>
<td width="15%"><div align="left">Modification time</div></td>
<td width="8%"><div align="center">Operation</div></td>
</tr>
<%
'List the directory
Set f = (folderspec)
Set fc =
For Each f1 in fc
%>
<tr bgcolor="#E4E8EF" onMouseOut=='#E4E8EF'; onMouseOver=='#FFFFFF';>
<td><a href="<%= url%>?foldername=<%= folderspec%>\<%= %>"><%= %></a></td>
<td><div align="right"><%= %></div></td>
<td><div align="center">Folder</div></td>
<td><div align="left"><%= %></div></td>
<td><a href="<%= url%>?action=editfolder&foldername=<%= folderspec&"\"&%>">Modify</a> <a href="<%= url%>?action=delfolder&foldername=<%= folderspec&"\"&%>" onclick="{if(confirm('Delete folder<<%= %>>or?')){return true;}return false;}">Delete</a></td>
</tr>
<%
Next
'List the files
Set fc =
For Each f1 in fc
%>
<tr bgcolor="#E4E8EF" onMouseOut=='#E4E8EF'; onMouseOver=='#FFFFFF';>
<td><a href="<%= tempurl+%>" target="_blank"><%= %></a></td>
<td><div align="right"><%= %></div></td>
<td><div align="left"></div></td>
<td><div align="left"><%= %></div></td>
<td><a href="<%= url%>?action=editfile&filename=<%= folderspec&"\"&%>">Modify</a> <a href="<%= url%>?action=delfile&filename=<%= folderspec&"\"&%>" onclick="{if(confirm('Delete file<<%= %>>Is it?')){return true;}return false;}">Delete</a></td>
</tr>
<%
Next
set fso=nothing
%>
</table>
<%
End Function
'File Operation
function delfile()
filename=("filename")
set fso=("")
(filename)
tempurl=url&"?foldername="&(filename)
set fso=nothing
(tempurl)
end function
function savefile()
filename=("filename")
content=("content")
filename1=("filename1")
if ("PATH_TRANSLATED")<>filename then
set fso=("")
set f1=(filename,2,true)
(content)
if filename1<>"" and filename1<>filename then (filename1)
tempurl=url&"?foldername="&(filename)
set fso=nothing
end if
(tempurl)
end function
function filenew()
filename=("filename")
content=""
fileform filename,content,filename1
end function
function fileedit()
filename=("filename")
filename1=("filename")
set fso=("")
set f1=(filename,1,true)
content=()
set fso=nothing
fileform filename,content,filename1
end function
function fileform(filename,content,filename1)
%>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<form name="form1" method="post" action="<%= url%>?action=savefile">
<tr>
<td><input name="filename1" type="hidden" value="<%= filename1%>"><input name="filename" type="text" value="<%= filename%>" style="width:100%"></td>
</tr>
<tr>
<td><textarea name="content" wrap="VIRTUAL" style="width:100%;height:100%;font:Arial,Helvetica,sans-serif;" onKeyUp="=;"><%= content%></textarea></td>
</tr>
<tr>
<td><center><input type="submit" name="Submit" value="Save" style="width:200"><input type="reset" name="Submit2" value="reset" style="width:200"></center></td>
</tr>
</form>
</table>
<%
end function
'Folder operation function
function delfolder()
foldername=("foldername")
set fso=("")
tempurl=url&"?foldername="&(foldername)
(foldername)
set fso=nothing
(tempurl)
end function
function savefolder()
foldername=("foldername")
foldername1=("foldername1")
set fso=("")
if foldername1="" then
set f=(foldername)
else
foldername1,foldername
end if
tempurl=url&"?foldername="&f
set fso=nothing
(tempurl)
end function
function newfolder()
foldername=("foldername")&"\"
formfolder foldername,foldername1
end function
function editfolder()
foldername=("foldername")
foldername1=("foldername")
formfolder foldername,foldername1
end function
function formfolder(foldername,foldername1)
%>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<form name="form1" method="post" action="<%= url%>?action=savefolder">
<tr><td><input name="foldername1" type="hidden" value="<%= foldername1%>"><input name="foldername" type="text" value="<%= foldername%>" style="width:100%"></td></tr>
<tr><td><center><input type="submit" name="Submit" value="Save" style="width:200"><input type="reset" name="Submit2" value="reset" style="width:200"></center></td></tr>
</form>
</table>
<%
end function
function upload()
%>
<form action="?action=saveupload" method="post" enctype="multipart/form-data" name="form2">
<div align="center">To be completed
<input type="file" name="file" style="width:80%">
<input type="submit" name="Submit" value="Submit">
</div>
</form>
<%
end function
function saveupload()
'To be realized
end function
'Login
function chklogin()
password=("password")
if password="ok" then session("login")="login"
if session("login")<>"login" then login
end function
function login()
%>
<form name="form1" method="post" action="<%= url%>?action=chklogin">
<center>Please enter your password: <input name="password" type="password"><input type="submit" name="Submit" value="Login"></center>
</form>
<%
()
end function
function logout()
()
(url)
end function
%>