% Dim page page="site_login" %>
|
<%
'Dim connect
'var=server.MapPath("/pthklaw/newsite/pthk.mdb")
'set connect = server.createobject("ADODB.Connection")
'connect.Open "dbq=" & var & ";driver={microsoft access driver (*.mdb)}; driverid=25; file=ms access;"
'if user not logged in then run login script
If Not Session("PTHKAdmin_LoggedIn")=true Then
set login = connect.execute("SELECT * FROM Users WHERE Username='" & Request.Form("Username") & "' AND Password='" & Request.Form("Password") & "'")
'check to see if username and password matched and retrieve client id if true
If login.eof=true Then
Session("PTHKAdmin_LoggedIn")=false
Else
Session("PTHKAdmin_LoggedIn")=true
Session("PTHKAdmin_LoggedInAs")=login("Username")
Session.Timeout = 60 '60-minute timeout
'Log time and date
Set UpdateLogin = server.CreateObject("adodb.recordset")
UpdateLogin.Open "SELECT * FROM Users WHERE UserID=" & login("UserID") & "", Connect, adOpenDynamic, adLockOptimistic
UpdateLogin("LastLogin") = Date & " " & Time
UpdateLogin.Update
End If
If login.eof=true AND Request.Form("success")="no" Then
Response.Write " Login Failed. Please Try Again: " End If Else If Request.QueryString("PTHKAdmin_LogOut")=true Then Session.Contents.RemoveAll Else End If End If %> <% If Not Session("PTHKAdmin_LoggedIn")=true Then %> <% Else Response.Redirect "/pthklaw/newsite/" End If %> |