Ask a Question related to Macromedia ColdFusion, Design and Development.
-
lingo_user #1
logout button
I have a login page that displays a name/pw submit button.
Currently a user submits these values and, if validated a sessio variable is
creaetd with user data and a welcome message is shown. Now I want to add a
logout button that shows as long as the user is logged in.
Here is my code:
<!--- show the logout button --->
<cfinclude template="../includes/logout.cfm">
<cfif isDefined("SESSION.userData")>
<cfoutput>Welcome #SESSION.userData.name#!<br><br>Last login:
<br>#SESSION.userData.lastLogin#<br>
</cfoutput>
<br><br><br><br><br><br>
<cfinclude template="../includes/projectListing.cfm">
<cfabort>
</cfif>
The actual code for logout button is in <cfinclude
template="../includes/logout.cfm">:
<cfif isDefined("FORM.logout")>
<cfapplication name="timeSheet" sessionmanagement="yes"
sessiontimeout="#createTimeSpan(0,0,0,0)#">
<cfelse>
<!--- logout button vertonen bij aanroep --->
<form action="<cfoutput>http://#CGI.SERVER_NAME#</cfoutput>"
name="logout"
method="post">
<br><br><br>
<table align="center">
<tr>
<td>
<input type="submit" name="logout" value="Logout" class="button">
</td>
</tr>
</table>
</form>
</cfif>
What happens is that if the user is logged in succesfully, the logout button
is shown. But when clicked, the same greeting message appears along with the
logout button as if the session variables are not deleted at all...
What do I do wrong here?
lingo_user Guest
-
logout
Howdy, I have a question regarding logout page. Scenario: A user use login fine, bookmarks a page and then use logout successfully. When user... -
Can't logout administrator
I can't logoff the administrator. everytime I launch the administrator it automatically logs in. The log off button doesnot work. How can I log it... -
inactivity logout
I have a Flex application that I would like it to logout (essentially call a function) when there is no activity for a given time. (No mouse... -
logout(without getting page using back button)
hi i would like to implement a logout page which is very secure so that after logging out a user cannot use the back button for accessing the... -
after logout, how to retrieve an expired page if user click 'back' button?
hi everyone, i've made a login and logout page, after user have logout, i want to retrieve an expired page if user click the 'back' button to... -
dempster #2
Re: logout button
One way to log out of a session is to clear the session variables with this
command: <CFSET STRUCTCLEAR(SESSION)>
Another thing to look at is your application.cfm file. Every cfm file in your
folder will run application.cfm first. Make sure you logout page does not
conflict with the application page in terms of checking session status.
-Paul
dempster Guest
-
lingo_user #3
Re: logout button
I think I'm still making a wrong assumption - here's what happens
chronologically:
a self submitting form with 'logout' submit button;>user logs succesfully in;
>session var is set;
>logout button is included: the code <CFSET STRUCTCLEAR(SESSION.userData)> andIf I put>user is logged in, clicks 'Logout' button;
>template calls itself, executes the included logout button code
session = #isDefined("SESSION.userData")#
right below this line it says
session = YES.
It should say session = NO since the structClear is executed.
Btw, this also happens with
<cfapplication
sessionamagemanent="yes"
sessiontimeOut="createTimeSpan(0,0,0,0)">
Why does
<CFSET STRUCTCLEAR(SESSION.userData)>
session = #isDefined("SESSION.userData")#
give me session = YES????
lingo_user Guest
-
Kronin555 #4
Re: logout button
Because StructClear doesn't delete the structure you're passing it, it just
clears it. Therefore, SESSION.userdata is still defined, it's just empty.
Change your call to:
<cfset structdelete(SESSION,"userData")>
Kronin555 Guest



Reply With Quote

