how to get login and logout time of User..?
just a small query...
how to get User's login time and logout time...???
as well as how to know whether particular user in Logged in out..??
Thnx
nish123
Junior Poster in Training
83 posts since Apr 2009
Reputation Points: 10
Solved Threads: 0
You can get the current timestamp from the time function and parse it to a date through the use of the date function. If you do this when the user logs in or out and store it in your database, you can then retrieve this information quite easily. Have a try and post an attempt, then we might be able to give you some more pointers.
darkagn
Veteran Poster
1,197 posts since Aug 2007
Reputation Points: 404
Solved Threads: 200
okay...
.
.
but how to get logout time..??
.
.
what to do when user closes the broswer instead of logout...
.
.
i uses insert query on login to get login time with help of now function of mysql...!!
.
.
but i dont understand what to do on logout..!! though i uses update query on logout... but i m confused what to do when user closes the browser..?? :(
nish123
Junior Poster in Training
83 posts since Apr 2009
Reputation Points: 10
Solved Threads: 0
nish123, you need to do research before posting here all the time!!!
For a timestamp like suggested by "darkagn" you would use the date() function supplied by php.
Go to www.php.net to learn more.
You then would follow this logic
- You would store that value
-- Storing it in a database or a session (which you should have researched in your previous thread)
- Then retrieve it as required
Let me know how you go once you do some research.
OmniX
Practically a Master Poster
656 posts since Dec 2007
Reputation Points: 31
Solved Threads: 10
when time is echoed what format is used?
I usually use date as I can specify the format I wish to use?
OmniX
Practically a Master Poster
656 posts since Dec 2007
Reputation Points: 31
Solved Threads: 10
when time is echoed what format is used?
I usually use date as I can specify the format I wish to use?
time() returns the unix timestamp, you have to use strftime to convert it to a human readable date
ShawnCplus
Code Monkey
1,583 posts since Apr 2005
Reputation Points: 526
Solved Threads: 268
I love how you guys have just taken over the poor man's thread... haha
I think his disappeared anyways... lol
Best way imo, sessions and then if required outside of user login/logout database, but I doubt there would be very many scenarios that would 'require' it maybe just a little feature but session the way to go, agreed?
OmniX
Practically a Master Poster
656 posts since Dec 2007
Reputation Points: 31
Solved Threads: 10