%
'' This code is absolute freeware. you can do with it as you please.
'' There are no restrictions what so ever, but the code is AS IS, no warrenty or liabilty
'' Please leave these commentlines intact
'' Netherlands, February 2004
'' M.Blokdijk
'' maarten@blokdijk.com
'' V 1.0
Sub EditDb
On error resume next
If fs.FileExists(server.mappath(dbfile)) Then
Response.Redirect dbfile & "?db=" & sFile
Else
Response.Write "Banco de dados não encontrado" &vbCrLf
End If
End Sub
Sub CreateNewFolder
On error resume next
%>
Nova Pasta
Pasta atual: <%=spath%>
<%
End Sub
Sub EditFile
On error resume next
Session("lastpage") = Request.ServerVariables("HTTP_REFERER")
Set ReadStream = fs.OpenTextFile(server.mappath(sFile))
filename=request.querystring("file")
response.write (" ")
Response.write "Alterando: "
response.write ""&filename&""
response.write " "
Response.Write "" &vbCrLf
End Sub
Sub UploadFiles
On error resume next
%>
Pasta atual: <%=spath%>
<%
End Sub
Sub CreateFile
On error resume next
response.write " Criar novo arquivo "
Session("lastpage") = Request.ServerVariables("HTTP_REFERER")
Response.Write "
<%
Else
NewFolderName=request.form("NewFolderName")
sFolder=request.form("folder")
if spath="/" then slashvalue="" else slashvalue="/" end if
Set fso = CreateObject("Scripting.FileSystemObject")
Set folderObject = fso.GetFolder(Server.MapPath(spath&slashvalue&sFolder))
FolderObject.Name=NewFolderName
Set folderObject = Nothing
Set fso = Nothing
Response.Redirect("" & Session("lastpage") & "")
End If
End Sub
Sub RenameFile
On error resume next
response.write" "
Response.write "Renomear arquivo "
If Request("commit") <> "yes" Then
Session("lastpage") = Request.ServerVariables("HTTP_REFERER")
Response.Write "
Tem certeza que deseja trocar o nome do arquivo: " & request.querystring("file") & ""
%>
<%
Else
NewFileName=request.form("NewFileName")
Sfile=request.form("filename")
if spath="/" then slashvalue="" else slashvalue="/"
Set fso = CreateObject("Scripting.FileSystemObject")
Set FileObject = fso.GetFile(Server.MapPath(spath&slashvalue&sfile))
FileObject.Name = NewFileName
Set FilObject = Nothing
Set fso = Nothing
Response.Redirect("" & Session("lastpage") & "")
End If
End Sub
Sub FileTypeUnsupported
On error resume next
Session("lastpage") = Request.ServerVariables("HTTP_REFERER")
filename=request.querystring("file")
response.write (" ")
Response.write "Exibindo: "
response.write ""&filename&""
response.write " "
If sFileType = "jpg" OR sFileType = "gif" OR sFileType = "GIF" OR sFileType = "JPG" Then
Response.Write "
"
else
Response.Write " O arquivo selecionado não foi reconhecido.
"
End If
Response.Write "Voltar"
End Sub
Sub Size(itemsize)
Response.Write "
" &vbCrLf
Select case Len(itemsize)
Case "1", "2", "3"
Response.Write itemsize & " bytes"
Case "4", "5", "6"
Response.Write Round(itemsize/1000) & " Kb"
Case "7", "8", "9"
Response.Write Round(itemsize/1000000) & " Mb"
End Select
Response.Write "
" &vbCrLf
End Sub
Sub ShowList
' Start building the table to display the information we retrieve about the files and folders in the current directory.
Response.Write "
" &vbCrLf
%>
Nome
Tipo
Tamanho
Acessado em
Ação
<%
' Use the GetFolder method of the filesystemobject to get the contents of the directory specified in sPath
Set fileobject = fs.GetFolder(server.mappath(sPath))
' Use the SubFolders property to get the folders contained in the directory specified in sPath
Set foldercollection = fileobject.SubFolders
' Start the code to alternate line colors - just to make the display a little less visually confusing.
lineid=0
bgcolor = ""
bgcolor_off = "#FFFFFF"
bgcolor_on = "#f0f0f0"
' Loop through the folders contained in the foldercollection and display their information on the page
For Each folder in foldercollection
' Apply our alternating line coloring
If lineid = 0 Then
bgcolor = bgcolor_off
lineid = 1
Else
bgcolor = bgcolor_on
lineid = 0
End if
Response.Write "
" &vbCrLf
If Right(sPath,1)="/" Then
Response.Write "
" &vbCrLf
Next
Set foldercollection=nothing
' Use the Files property to get the files contained in the directory specified in sPath
Set filecollection = fileobject.Files
' Loop through the files contained in the filescollection and dislay their information on the page
For Each file in filecollection
' Apply our alternating line coloring
If lineid = 0 Then
bgcolor = bgcolor_off
lineid = 1
Else
bgcolor = bgcolor_on
lineid = 0
End if
Response.Write "
" &vbCrLf
%>
<%
if fs.GetExtensionName(file.name)="gif" then image=""
if fs.GetExtensionName(file.name)="pdf" then image=""
if fs.GetExtensionName(file.name)="css" then image=""
if fs.GetExtensionName(file.name)="doc" then image=""
if fs.GetExtensionName(file.name)="xls" then image=""
if fs.GetExtensionName(file.name)="exe" then image=""
if fs.GetExtensionName(file.name)="zip" then image=""
if fs.GetExtensionName(file.name)="jpg" then image=""
if fs.GetExtensionName(file.name)="jpeg" then image=""
if fs.GetExtensionName(file.name)="htm" then image=""
if fs.GetExtensionName(file.name)="html" then image=""
if fs.GetExtensionName(file.name)="swf" then image=""
if fs.GetExtensionName(file.name)="asp" then image=""
if fs.GetExtensionName(file.name)="txt" then image=""
if fs.GetExtensionName(file.name)="inc" then image=""
if fs.GetExtensionName(file.name)="js" then image=""
if fs.GetExtensionName(file.name)="mdb" then image=""
if image="" then image= ""
Response.Write "