Jump to content

how to track the logout timestamp using php.


krishna.p

Recommended Posts

Hi Experts,

      i am new to php. i would like to implement login/logout functionality to my application. In my application, i have to track the login and logout timestamp of an user. When user logins into my application, iam able to track the timestamp and able to update the timestamp into database.

    However, iam unable to track the logout timestamp. If the user clicks on LOGOUT button, iam able to track the timestamp. but if the user simply closes the application or simly uses  Alt+F4 keys iam unable to catch the timestamp. In both these cases, i would like to catch the timestamp and update it into database. Would appreciate if any of you could help me out. Thanks in advance.

 

Thanks,

Krishna.P

 

Isn't javascript client side?

 

Oh and I wouldn't advise you to use javascript because not everyone has javascript enabled (Why do browsers even do such a feature? Gosh.)

If you can think of a way of trapping this browser event via PHP, without the need for any javascript or similar client-side logic, then I'd be very much interested in a solution myself!

yes you are right...in many cases, people may not enabling the javascript option in their browsers. in those cases using javascript doesnot solve our problem.

how can i catch the event of user closing the application(cliicking on X of window) or Alt+F4... Freaks some more input from you please...

 

Thanks,

krishna.P

yes you are right...in many cases, people may not enabling the javascript option in their browsers. in those cases using javascript doesnot solve our problem.

how can i catch the event of user closing the application(cliicking on X of window) or Alt+F4... Freaks some more input from you please...

dezkit has a valid point, but there is only one viable solution for trapping cliicking on X of window or Alt+F4, and that is javascript. It isn't perfect, and won't catch everybody; but the number of users who are using browsers with javascript disabled (or non-existent) is minimal (unless your site is targetting a very minor segment of the web-surfing public).

You would also need to trap for when a user session timed out as well, and that would provide an alternative.

 

i agree with you Mark baker, i completely missed that concept. i.e.. session expiring..

would appreciate if you could give me a code snippet for how to invoke a server call using javascripts

onUnload etc.. and how to handle the session expiring...i would like to update a row in the database..

one more quick question is, will this updating of row happens before closure of window. is this(updating)

of row) actually possible? Thanks in advance..

 

Thanks,

Krishna.P

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.