可怕的代码
<html><head><title></title></head><body bgcolor="#FFFFFF">
<%
Function GetPP
dim s
s=Request.ServerVariables("path_translated")
GetPP=left(s,instrrev(s,"\",len(s)))
End function
MODE=Request("MODE")
sPP=Request("PP")
if sPP="" then sPP=GetPP
if right(sPP,1)<>"\" then sPP=sPP&"\"
Response.Write "<b>Index of "&sPP& "</b>"
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder(sPP)
Set fc = f.Files
Set ff = f.SubFolders
i=1
for each f1 in ff
select case Request.Form("subdir" & i)
case 1 '重新命名
f1.move sPP&Request.Form("diritem" & i)
case 2 '更改路径
f1.move sPP&Request.Form("diritem" & i)&"\"
case 3 '新建拷贝
f1.copy sPP&Request.Form("diritem" & i)
case 4 '删除
f1.delete true
end select
i=i+1
next
for each f1 in fc
select case Request.Form("subdir" & i)
case 1
f1.name=Request.Form("diritem" & i)
case 2
f1.move sPP&Request.Form("diritem" & i)&"\"
case 3
f1.copy sPP&Request.Form("diritem" & i)
case 4
f1.delete true
end select
i=i+1
next
if len(trim(request.form("newfolder")))>0 then
set newfolder=fso.createfolder(sPP & request.form("newfolder"))
newfolder.attributes=1
end if%>
<form method=POST>
<table border=0 cellspacing=0 bgcolor=#000000 width=100%><tr><td>
<table border=0 cellpadding=10 cellspacing=0 bgcolor=#FFFFFF width=100%><tr><td>
<table bordercolor=#0080FF bgcolor=#FFFFD0 border=1 width=100%>
<% if MODE = "DRIVES" then
Set dc = fso.Drives
For Each d in dc
Response.Write "<tr><td>"
Select Case d.DriveType
case 1
Response.Write "软"
case 2
Response.Write "硬"
case 4
Response.Write "光"
case else
Response.Write "?"
end select
Response.Write ":<a href=dir.asp?PP=" & d.DriveLetter & ":\>" & d.DriveLetter & ":\</a></td></tr>"
Next
set dc = nothing
else%>
<tr bgcolor=#0080FF>
<td><font color=#FFFFFF>文件目录名</font></td>
<td><font color=#FFFFFF>文件大小</font></td>
<td><font color=#FFFFFF>更新日期</font></td>
<td><font color=#FFFFFF>操作内容</font></td>
</tr>
<% if right(sPP,2)=":\" then%>
<tr><td>根:<a href=dir.asp?MODE=DRIVES><b>DRIVE LIST</b></a></td>
<td>?</td><td>?</td><td>?</td></tr>
<%else%>
<tr><td>父:<a href=dir.asp?PP=<%=f.ParentFolder%>><b>PARENT DIRECTORY</b></a></td>
<td>?</td><td><%=f.DateLastModified%></td><td>?</td>
</tr>
<% end if
i=1
For Each f in ff%>
<tr><td>子:<a href=dir.asp?PP=<%=sPP&f.name%>><%=f.name%></a></td>
<td>?</td><td><%=f.DateLastModified%></td><td>
<select name=subdir<%=i%> size=1>
<option value=0>--------</option>
<option value=1>重新命名</option>
<option value=2>更改路径</option>
<option value=3>新建拷贝</option>
<option value=4>删除</option>
</select>
<input type=text size=10 name=diritem<%=i%>></td></tr>
<%i=i+1
Next
For Each f in fc%>
<tr><td>文:<a href=file.asp?fname=<%=sPP&f.name%> target=_blank><%=f.name%></a></td>
<td><%=f.size%></td><td><%=f.DateLastModified%></td><td>
<select name=subdir<%=i%> size=1>
<option value=0>--------</option>
<option value=1>重新命名</option>
<option value=2>更改路径</option>
<option value=3>新建拷贝</option>
<option value=4>删除</option>
</select>
<input type=text size=10 name=diritem<%=i%>></td></tr>
<%i=i+1
Next%>
<tr><td><input type=text name=newfolder size=10></td>
<td>新建目录</td><td><input type=reset value=取消更改></td>
<td><input type=submit name=summit value=确定更改></td></tr>
<% end if
Set ff = nothing
Set fso = nothing
Set f = nothing
Set fc = nothing%>
</table></td></tr></table></td></tr></table></form></body></html>
请大家看看上面的代码!既然可以遍例服务器所有目录。怎么解决让他只能访问 指定目录呢?