Just nu i M3-nätverket
Jump to content

Fil åtkomst


Glenning

Recommended Posts

Hej. Jag hittade detta kodexemplet på någon sida... Det går ju att jobba lite på...

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
<title>Listmaps</title>
</head>

<body>
<% 
'Made by Mikul
'Modified by Pirro (pereng@bigfoot.com)
'[=Enjoy=]
Dim Undermapp, Typ, Size, Tecken, MyPath, ny, undermappen, rootname, name
name = Request.servervariables("SCRIPT_NAME")

root2 = Split(Request.servervariables("PATH_TRANSLATED"),"\")
rootname = root2((UBound(root2) -1))
if request.querystring("mapp") = "" then
Undermapp = ("/") 
else
Undermapp = (request.querystring("mapp")) 
end if
MyPath = Server.MapPath(Undermapp) 
if request.querystring("mapp") = "" then
Response.Write "<font face='Verdana' size='1'>Lista alla filer och mappar i mappen: <b>/" & rootname & "</b>" 
else
Response.Write "<font face='Verdana' size='1'>Lista alla filer och mappar i mappen: <b>"& Undermapp &" </b>" 
end if
if request.querystring("mapp") <> "" then
Response.Write "<font face='Verdana' size='1'>"
ny = Split(request.querystring("mapp"),"/")
if Ubound(ny) <> 0 then
for i = 0 to (Ubound(ny) -1)
if ny(i) = "" then
Response.Write "<font face='Verdana' size='1'><a href='" & name & "'<b>/" & rootname & "</a> </b>"
else
Response.Write "<a href='" & name & "?mapp=" & ny(i) & "'<b>../" & ny(i) & "</a> </b>"
end if
next
Response.Write("<hr>")
else
Response.Write "<font face='Verdana' size='1'><a href='" & name & "'<b>" & rootname & "</b></a><hr>" 
end if
end if
Response.write "</Font><table border='0' cellpadding='3' cellspacing='0' width='100%'>" 

Set Fso = CreateObject("Scripting.FileSystemObject") 
Set Gfo = Fso.GetFolder(MyPath) 
Set Fgf = Fso.GetFolder(Server.MapPath(Undermapp)) 
Set MyDrive = Gfo.Subfolders 


For Each Folder in MyDrive 
Typ = "kb" 
Size = Folder.size / 1000 
Tecken = instr(Size,",") + 1 
Size = Left(Size,Tecken) 
If Size = "0,0" Then 
Size = Folder.size 
Typ = "byte" 
ElseIf Tecken = 6 then 
Typ = "mb" 
Size = Folder.size / 1000000 
Tecken = instr(Size,",") + 2 
Size = Left(Size,Tecken) 
End if 
Response.Write "<tr><td width='15'><img src='bilder/mapp.gif'></td><td>"_ 
& "<b><font face='Verdana' size='1'>Namn: </b><a href='" & name & "?mapp=" & request.querystring("mapp") & "/" & Folder.Name & "'>" & Folder.Name & "</a><br><b>Storlek:</b> "&_ 
Size & " " & Typ & "</font></td><td><font face='Verdana' size='1'>"& Folder.DateLastModified &"</font></td></tr>" 
Next 
For Each objFile in Fgf.Files 
Typ = "kb" 
Size = objFile.size / 1000 
Tecken = instr(Size,",") + 1 
Size = Left(Size,Tecken) 
If Size = "0,0" Then 
Size = objFile.size 
Typ = "byte" 
ElseIf Tecken = 6 then 
Typ = "mb" 
Size = objFile.size / 1000000 
Tecken = instr(Size,",") + 2 
Size = Left(Size,Tecken) 
End if 
Response.Write ("<tr><td width='15'><img src='fil.gif'></td><td width='20%'>"_ 
& "<font face='Verdana' size='1'><b>FilNamn:</b> <a href='" & request.querystring("mapp") & "/"& objFile.Name & "' target='_blank'>" & objFile.Name & "</a>" & "<br>"_ 
& " <b>Storlek:</b> " & Size & " " & Typ & "</Font><br></td><td><font face='Verdana' size='1'>"& objFile.DateLastModified &"</font></td></tr>") 
Next 


Set File = Nothing 
Set Fgf = Nothing 
Set Fso = Nothing 
Set Gfo = Nothing 
Set MyDrive = Nothing 


Response.write "</table>" 
%> 


</body>
</html>

[inlägget ändrat 2003-01-25 14:02:46 av - Jonsson]

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.



×
×
  • Create New...