Im doing a website at the moment, basicly its like; bebo, myspace sort of style style (but franticly reduced in users).

I would like to know how to hold the time in which users have signed on so i can include a "last active" box for other users to see. However i dont understand how to do the las section.

This is basicly what i need:

- User logs in to db (storing that exact time and date).
- User does whatever and then logs out (storing that exact time(maybe if the session ends?)
- ?? then somehow another user can see the time in which they were last activly logged in the database.

9 Years
Discussion Span
Last Post by Designer_101

You would need to store their time in a database or something to allow other users to view it.

Store the time() variable in the database which will give a string of numbers - e.g 2131321.

To turn this in to a human readable time, pull it from the database and do this:

date('H:i', $logtime);

You'll then get something like 21:52. You can add whatever date variables you want so you could use:

date('d/m/Y - H:s', $logtime);

16/03/2008 - 21:52


Thanks for the quick reply

Thats absolutly what i needed

by the way do you think this looks ok?

if you keep refreshing the page the images change on the border :D
its a project for a frisbee team im doing :P

thanks again

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.