Jump to content

store last session


mpsn

Recommended Posts

Hi, I want to maintain users who log in a webpage and each time they leave, I want to record the current time, so this sounds silly but do I just set in my db table in a field that tracks a user's last log in with DEFAULT: CURRENT_TIMESTAMP?

 

db structure:

user_id  lastActivity  lastSession (stores TIMESTAMP of last time user logged in)

 

Any help much appreciated

Link to comment
Share on other sites

Your method of storage is good. But most people that track last visit normally just log the month, day, and year, because most people will just go to another web site and you have no way of finding out the time they did that. Leaving your site is the same as just turning off the browser. How would you know? If you have an inactivity function you might get close to the time, but it just sounds like a lot of work for no return.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.