469,366 Members | 2,198 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,366 developers. It's quick & easy.

How to store login time and logout time for every user?

127 100+
i wnat to store the login time and logout time in the database....

plz help... also how to retrieve stored logiin.logout times from database....

when i use the simple time disply
Expand|Select|Wrap|Line Numbers
  1. $t=time();
  2. echo ($t);
  3.  
i get result as
Expand|Select|Wrap|Line Numbers
  1. time 1287032030 
i want to display the time in a correct format like 10:58 AM ... how to do it plz help
Oct 14 '10 #1
3 8019
you can use session variable to store timings
Oct 15 '10 #2
kovik
1,044 Expert 1GB
No idea what ~sathishauit is trying to say, but I'd ignore it if I were you. lol

Anyway, it seems like you already know how to store the time, so what you need to be able to do now is to display it. Use the date() function to display the date in the format that you want.
Oct 15 '10 #3
oranoos3000
107 100+
hello
you can create a table with column ip,time, type
ip is the user's ip
time is the time for login or logout time
type is 0 for login time and 1 for logout time

after login user , you can write a record in above table
user's ip is inside $_SERVER['REMOTE_ADDR'], current time is in time(), type depend on login or logout process

for logout you can a menu for logout or can use jquery and write a record in above table with type=1
current time an user's ip

be successful
Oct 16 '10 #4

Post your reply

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

Similar topics

3 posts views Thread by Joey Lee | last post: by
reply views Thread by G | last post: by
6 posts views Thread by Thiago Macedo | last post: by
5 posts views Thread by aajayaprakash | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.