and13345
Posts: 100 Joined: 10/7/2003 Status: offline
|
Logging out from the FP Database Editor - 11/11/2004 19:35:23
I used the FP Database Interface Wizard to create Submission and Database Editor pages. I told FP to password secure the Database Editor. When you try to access on of the pages that is protected it redirects me to a login page. Once logged in I can access any of the protected pages. I would like to create a link that logs you out so that if you try to access the protected pages again you are redirected to the login page. The login_validate.asp page sets the Session(SiteId) to true if you supply the correct ID and password. The protected pages have a check at the top for the Session(SiteId) to see if it is true, if so it loads the page if not it redirects you to the login page. What I would like is a link that takes you to a page that says you have been logged out and sets the Session(SiteId) to false so that the next time you try to access the protected page it redirects you to the login page. I have tried the following code for a logout.asp page, but it doesn't work. When trying to access the protected page it does not redirect to the login page. If I close the browser window it will redirect me to the login page, but I don't even need a logout page to do that. I just want an easy way to logout without having to close the browser window.
<table border="0" width="100%" id="table1">
<%
IF Session(SiteId) = true THEN
%>
<tr>
<td>
<b><font face="Verdana">You are being logged out of the Project Tracking Database. Please Wait......</font></b>
</td>
</tr>
<%
Session(SiteId) = false
END IF
%>
<%
IF Session(SiteId) <> true THEN
%>
<tr>
<td>
<b><font face="Verdana">You have been logged out of the Database Editor.</font></b>
</td>
</tr>
<%
'Session(SiteId) = false
END IF
%>
</table>
Code for Login_Validate.asp
<%
' if any of the variables do not match, create error message
if Request.Form("login") <> Username or Request.Form("password") <> Password then
MsgErr = "<h3><b><font face='Verdana'>Authorization Failed.</font></b></h3>" & "<br>" & "<a href=login.asp?requester=" & Request("requester") & "&dbsite=" & Request("dbsite") & "><font face='Verdana'>Please try again.</font></a>"
Response.Write MsgErr
' if correct, set the session variable and proceed
Else
Session(SiteId) = true
' redirect
If Len(Request("requester")) > 0 Then
Response.Redirect login_dbsite_str & (Request("requester"))
Else
Response.Redirect login_dbsite_str & "database_editor.asp"
End if
End if
%>
Code on protected pages that checks Session(SiteId)
<%
If Session(SiteID) <> true Then
Response.Redirect("Login.asp?requester=delete.asp")
End If
%>
|