473,404 Members | 2,137 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

Note Time when logout is not done properly

160 100+
Hi,

I want to note time when user is logout. I can note time when user login and when logout properly(use button of logout). But if user is not used button and he closed his browser or suddenly light become off then i am unable to note logout time.

Please give me some idea about that

thanks in advance
Dec 24 '08 #1
3 1617
Atli
5,058 Expert 4TB
Hi.

This is a common problem, without a very good solution.
The problem here is that there is no reliable way of tracking whether the user has actually closed the browser or not.

The best solution I have seen is a timeout based logout system.
That is, whenever the client opens a page, log the time into a database.
If the client remains inactive, not requesting new pages, for a given amount of time, he will be considered offline.

You could even expand this to include AJAX, which would periodically update the database time-stamp while the page is open, thus keeping the user online if for some reason he spends more time than the timeout period on a single page.
Dec 24 '08 #2
xNephilimx
213 Expert 100+
Hi, waqasahmed996

Another way of doing it is to change the session save handler to a custom class, so you can store your sessions in your database (making the destoy function to delete the record) and also save the session_id in your user's table, make a file that'll be always included that checks that db to see if the session for the given user still exists in the table if it doesn't then you can consider the user offline. If your site recieves lot's of visits, then you may want to put that script in a cron, so it doesn't get executed thousands of times, reducing the load to your db.
Dec 24 '08 #3
waqasahmed996
160 100+
Thanks for giving me solution and solve my problem.Thanks again
Dec 26 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Joey Lee | last post by:
Hi, Does anyone knows how to control user login that only a single userid can login at a time? Thanks Joey
2
by: ad | last post by:
I use Login control's Authenticate event to authenticate use. I find that different users can use the same ID to login in the same time. How can I restrict that the some ID can only login once in...
25
by: crescent_au | last post by:
Hi all, I've written a login/logout code. It does what it's supposed to do but the problem is when I logout and press browser's back button (in Firefox), I get to the last login page. In IE,...
2
by: Dan | last post by:
Hi, I use the logon control for logging into the application. When logging and checking the option "remember me next time" and then closing the browser without to press any logout button which...
2
by: André | last post by:
Hi, When clicking on "remember me" when logging, the user asks for not to have to log in next time he visits the site. Now, on one side, i read it is recommended to logout properly (clicking...
0
by: onlymukti4u | last post by:
Hi All, Can anyone help me out to get the code for knowing the login and logout time difference between some pages. What exactly I want is...."I have a small project having 5 pages,once the...
4
by: SilentThunderer | last post by:
Hey folks, Let me start out by letting you know what I'm working with. I'm building an application in VB 2005 that is basically a userform that employees can use to "Clock in". The form...
3
by: Ron J | last post by:
How can I trap the user just closing the browser (upper right ) so I can shutdown the Asp.net session properly. Don't really want to wait for the default timeout to occur. I'm using a Master page...
6
by: Thiago Macedo | last post by:
I could not find on the web a complete solution for this task. This is not the perfect solution, because it's doesn't have the ability to log the logout if browser crash or user leave it open while...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.