%@ Language=VBScript %>
<%Option Explicit%>
<%
Const appName = "WebFTP"
Const appVersion = ""
%>
<%
Dim FSO, re
Dim scriptName, wexId
Dim wexMessage, wexRootPath, targetPath
Dim encoding, codepage, charset
InitApp()
' Actions in the popup windows
Select Case Request.Form("command")
Case "Edit"
Editor()
Case "View"
Viewer()
Case "FileDetails", "FolderDetails"
Details()
Case "Upload"
Upload(false)
End Select
' Actions in the main window
Select Case Request.Form("command")
Case "NewFile", "NewFolder"
CreateItem()
Case "DeleteFile", "DeleteFolder"
DeleteItem()
Case "RenameFile", "RenameFolder"
RenameItem()
Case "OpenFolder"
targetPath = WexMapPath(Request.Form("folder") & Request.Form("parameter"))
Case "LevelUp"
targetPath = WexMapPath(FSO.GetParentFolderName(Request.Form("folder")))
Case "Logout"
Logout()
End Select
List()
DestroyApp()
' ------------------------------------------------------------
' - WebExplorer Free Functions -------------------------------
' Initializes some variables, creates instances of some objects and ensures security
Sub InitApp()
scriptName = Request.ServerVariables("SCRIPT_NAME")
wexId = appName & appVersion & "-"
Response.Buffer = true
If not Secure() Then
If Request.Form("popup")="true" or Request.QueryString("popup")="true" Then PopupRelogin() Else Login()
End If
Set FSO = server.CreateObject ("Scripting.FileSystemObject")
Set re = new regexp
wexRootPath = RealizePath("/"&session("pasta"))
encoding = -2 'System default encoding
' Commands with high priority
' These commands require to be performed before any Request.Form statement
Select Case Request.QueryString("precommand")
Case "ProcessUpload"
Upload(true)
Case "Download"
Download()
Case "Encoding"
If Request.QueryString("value")<>"" Then encoding = Int(Request.QueryString("value"))
If encoding=-1 Then 'Unicode encoding
codepage = Session.CodePage
Session.CodePage = 65001
Response.CharSet = "UTF-8"
End If
End Select
targetPath = WexMapPath(Request.Form("folder"))
End Sub
' Frees the objects and ends the application
Sub DestroyApp()
If encoding=-1 Then Session.CodePage = codepage
Set FSO = Nothing
Set re = Nothing
Response.End
End Sub
' Writes the html header
Sub HtmlHeader(title)
%>
<%
End Sub
' Writes the copyright message
Sub HtmlCopyright()
%>
<%
End Sub
' Writes the stylesheet
Sub HtmlStyle()
%>
<%
End Sub %>
<%
' Writes the javascript code
Sub HtmlJavaScript()
%>
<%
End Sub
Sub Login()
If session("command") = "Login" Then
Dim rsValida
Dim conexaodb
Dim strValida
Set conexaodb = Server.CreateObject("ADODB.Connection")
conexaodb.connectionstring = "provider=microsoft.jet.oledb.4.0;data source=s:\home\estacaodesigngrafico\dados\webftp.mdb"
conexaodb.Open
set rsValida = Server.CreateObject("ADODB.Recordset")
strValida = "SELECT * FROM usuarios "
strValida = strValida & "WHERE login = '" & session("login") & "' "
strValida = strValida & " And senha = '" & session("senha") & "' "
set rsValida = conexaodb.Execute(strValida)
if not rsValida.eof then
Session(wexId & "Login") = true
session("pasta") = rsValida("pasta")
session("permissao") = rsValida("permissao")
Exit Sub
Else
wexMessage = "Usu嫫io ou senha inv嫮ido!"
response.Redirect "../index.htm"
End If
End If
HtmlHeader appName
If(wexMessage<>"") Then Response.Write "_"
%>