messing with session vars

View: New views
3 Messages — Rating Filter:   Alert me  

messing with session vars

by Kevin Huff-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hey guys and gals. I have a question. I'm working on some user management stuff and I'm tracking all the users using session vars. I would like to log a user out should they log in again before thier session expires or they logOut. I need this because I have people logging in from many different computers and ip's all day. So what I want to know is there some where I can delete a session var that isn't the current user's? I hope this makes sense. Thanks for the help.

Kevin.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists
Archive: http://www.houseoffusion.com/groups/cf-newbie/message.cfm/messageid:4829
Subscription: http://www.houseoffusion.com/groups/cf-newbie/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.15

RE: messing with session vars

by Mike Chytracek :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Well, if you are using session variables and a user logs in again, the
original session vars will be over written by your new ones.  If you want to
kill them on log out, you can kill the session struct like this:

Assuming your session variable is "session.username".

<cflock timeout=20 scope="Session" type="Exclusive">
   <cfset StructDelete(Session, "username")>
</cflock>

If you want to clear ALL session vars use "structClear(session)".

As far removing abandoned session vars the only thing you can do is set the
lifespan as low as you can without annoying users.



-----Original Message-----
From: Kevin Huff [mailto:khuff@...]
Sent: Friday, October 02, 2009 2:45 PM
To: cf-newbie
Subject: messing with session vars


Hey guys and gals. I have a question. I'm working on some user management
stuff and I'm tracking all the users using session vars. I would like to log
a user out should they log in again before thier session expires or they
logOut. I need this because I have people logging in from many different
computers and ip's all day. So what I want to know is there some where I can
delete a session var that isn't the current user's? I hope this makes sense.
Thanks for the help.

Kevin.



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists
Archive: http://www.houseoffusion.com/groups/cf-newbie/message.cfm/messageid:4830
Subscription: http://www.houseoffusion.com/groups/cf-newbie/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.15

Re: messing with session vars

by Kevin Huff-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


That is what I kinda figured. My problem is the same person will not logout on one computer go log in on another and their session will still be active until it expires. In the meantime if someone goes to the computer they were on, that user will be logged into that person's account. Looks like I can't really avoid this.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists
Archive: http://www.houseoffusion.com/groups/cf-newbie/message.cfm/messageid:4831
Subscription: http://www.houseoffusion.com/groups/cf-newbie/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.15