%
'==============================================================
' TableEditoR 0.81 Beta
' http://www.2enetworx.com/dev/projects/tableeditor.asp
'--------------------------------------------------------------
' File: index.asp
' Description: Default page for TableEditoR
' Initiated By Hakan Eskici on Nov 01, 2000
'--------------------------------------------------------------
' Copyright (c) 2002, 2eNetWorX/dev.
'
' TableEditoR is distributed with General Public License.
' Any derivatives of this software must remain OpenSource and
' must be distributed at no charge.
' (See license.txt for additional information)
'
' See Credits.txt for the list of contributors.
'
' Change Log:
'--------------------------------------------------------------
' # Nov 15, 2000 by Hakan Eskici
' Added permission assignment for Table and Field functions
' # May 05, 2002 by Rami Kattan
' Record in users table user's last access
' # May 14, 2002 by Rami Kattan
' Check if browser can execute javascripts
' # May 30, 2002 by Rami Kattan
' Remember Me option to remember the last user name
' High Security login method
'==============================================================
dim bOnPageLoad ' to tell header to add onload code to body tag or not.
bOnPageLoad = true
bOnPageLoadPage = "index"
%>
<%
'We may come here as a result of a session timeout
'or direct access without opening a session
'redirection will occur after login
if request("comebackto") <> "" then
sReferer = request("comebackto")
sGoBackTo = "?" & request.querystring
end if
if RequireSecurityID then session("teUserName") = ""
sub AskForLogin(sText)
%>
" & sMsg
LastUserName = Request.Cookies("TableEditor8")("UserName")
LastRemember = (Request.Cookies("TableEditor8")("RememberMe") = "true")
if LastRemember then RememberCheck = " checked"
%>
<%
if sText = "" then
else
%><%
end if
end sub
if request("cmdLogin") <> "" then
'User provided the user name and password
'Open the connections and create the recordset object
OpenRS arrConn(0)
sUserName = trim(request("txtUserName"))
sPassword = trim(request("txtPassword"))
sSecurityID = trim(request("SecurityID"))
GoodLogin = not RequireSecurityID
if ValidSecurityID("Login", sSecurityID) and RequireSecurityID then GoodLogin = true
session("JavaScriptEnabled") = trim(request.form("JavaScriptEnabled"))
sSQL = "SELECT * FROM Users WHERE UserName = " & SQLEncode(sUserName)
rs.Open sSQL, , , adCmdTable
if not (rs.bof or rs.eof) then
if rs("Password") = sPassword and GoodLogin then
'Login succeeded
'Store info into session
session("teUserName") = sUserName
session("teFullName") = rs("FullName")
session("rAdmin") = rs("rAdmin")
session("rRecAdd") = rs("rRecAdd")
session("rRecEdit") = rs("rRecEdit")
session("rRecDel") = rs("rRecDel")
session("rQueryExec") = rs("rQueryExec")
session("rSQLExec") = rs("rSQLExec")
session("rTableAdd") = rs("rTableAdd")
session("rTableEdit") = rs("rTableEdit")
session("rTableDel") = rs("rTableDel")
session("rFldAdd") = rs("rFieldAdd")
session("rFldEdit") = rs("rFieldEdit")
session("rFldDel") = rs("rFieldDel")
session("rAllowExport") = rs("rAllowExport")
session("rConnectionViews") = rs("rTablePrivileges")
session("teLastAccess") = rs("LastAccess")
' Added by Hakan on May 11, 2002
' If te install folder is not write enabled, ignore
on error resume next
rs("LastAccess") = Now
rs.update
on error goto 0
' rs.close
' conn.close
if bUserLogging then call LogUserLogin(sUserName)
chkRemember = (Request.form("chkRemember") = "on")
if chkRemember then
Response.Cookies("TableEditor8")("UserName") = sUserName
Response.Cookies("TableEditor8")("RememberMe") = "true"
Response.Cookies("TableEditor8").Expires = now + 30
else
Response.Cookies("TableEditor8")("UserName") = ""
Response.Cookies("TableEditor8")("RememberMe") = "false"
end if
if sReferer = "" then
response.redirect "te_admin.asp"
else
response.redirect sReferer
end if
else
if not GoodLogin then
'Security ID Failed, using a login method outsite the site
AskForLogin "Login Error: you must use the login form on this site.
If you were already, please try refreshing the login form page before logging in. Cached form will not work."
else
'Login failed - Wrong password
AskForLogin "Incorrect password."
end if
end if
else
'User not found
AskForLogin "Incorrect credentials."
end if
CloseRS
else
%>
<%
if bProtected then
'If protection is ON, ask for login
AskForLogin ""
else
'if protection is OFF, display a warning
%>
Any visitor who knows the exact location of the TableEditor files may view or change the information in your databases.
To enable protection, open te_config.asp file and set bProtected = True.
You may go to Admin Page now.
<%
end if
%><%
end if
%>