RE: log visit time?
Thanks for the tip. The second one was much easier for a guestimate, which is all this app needs since theres no pages that a person would spend more than a minute on. It only took 3 days for my client to realize no matter how many times they told their employees to log out that they never would. I'm checking out the first option now just out of curiosity. I'll post if I have any luck. Emmet _ From: Christian Cantrell [mailto:[EMAIL PROTECTED] Sent: Monday, January 26, 2004 11:50 AM To: CF-Talk Subject: Re: log visit time? On Monday, January 26, 2004, at 02:32 AM, Emmet McGovern wrote: > Anyone know of a simple way to keep track of the total amount of time a > user is logged into an application for? Two ideas. One is to explore javax.servlet.http.HttpSessionBindingListener. HttpSessionBindingListener is an interface with two functions: valueBound and valueUnbound. An implementation can be used to catch notifications of when a session is created or cleaned up. I've never tried this in ColdFusion, and in fact, I'm not even sure it's possible, but it's worth pursuing. In the J2EE world, this works great. My second idea is much easier and will certainly work. Rather than trying to measure the time between login and logout (since you never really know when someone has stopped using your app unless they explicitly log out, which you cannot count on them to do), measure the time between login and the users last request. Store the current time at login-time (inside your CFLOGIN tag, possibly), then record the time on every request after that (use the session scope to make the time user-specific). The total time logged in will (approximately) be timeOfLastRequest - loginTime. Christian _ [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
Re: log visit time?
On Monday, January 26, 2004, at 02:32 AM, Emmet McGovern wrote: > Anyone know of a simple way to keep track of the total amount of time a > user is logged into an application for? Two ideas. One is to explore javax.servlet.http.HttpSessionBindingListener. HttpSessionBindingListener is an interface with two functions: valueBound and valueUnbound. An implementation can be used to catch notifications of when a session is created or cleaned up. I've never tried this in ColdFusion, and in fact, I'm not even sure it's possible, but it's worth pursuing. In the J2EE world, this works great. My second idea is much easier and will certainly work. Rather than trying to measure the time between login and logout (since you never really know when someone has stopped using your app unless they explicitly log out, which you cannot count on them to do), measure the time between login and the users last request. Store the current time at login-time (inside your CFLOGIN tag, possibly), then record the time on every request after that (use the session scope to make the time user-specific). The total time logged in will (approximately) be timeOfLastRequest - loginTime. Christian [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
RE: log visit time?
Its difficult, because you really don't know when the user quits the session, unless they actually log out. Or work with some fancy _javascript_ that knows when the user closes the browser or navigates away form your site. I guess the simplest way would be to set a session var when they logged in, use dateDiff when the user logs out and insert in a database. If you need to get this info from a log file then I guess you'd have to start with the first entry, check if the second entry is within X timeframe (i.e. still counting as one session) and so on, then take the difference between the first entry and the last entry. But like I said it all depends on whether you only want to count the time they are really logged in, and whether they really log of or not. Taco Fleur Blog http://www.tacofleur.com/index/blog/ Methodology http://www.tacofleur.com/index/methodology/ 0421 851 786 Tell me and I will forget Show me and I will remember Teach me and I will learn -Original Message- From: Emmet McGovern [mailto:[EMAIL PROTECTED] Sent: Monday, 26 January 2004 5:33 PM To: CF-Talk Subject: log visit time? Anyone know of a simple way to keep track of the total amount of time a user is logged into an application for? I need to be able to keep track of total amount of time an application is in use and break it down by user. Thanks, Emmet _ [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]