rkiss
Posts: 14
|
| Posted: 09/10/2004, 5:33 AM |
|
Hi,
I was wondering if someone has created a script that will keep history of logins/logouts. (php/mysql, linux/apache).
Here is the idea I am thinking of:
LOGIN_STATE table attributes
- user_id INT(11) - "foreign key" to user_id in USER table
- login_dte (timestamp)
--------------------------------------------------------
LOGIN_OUT_HIST table attributes
- user_id INT(11) - "foreign key" to user_id in USER table
- last_login_dte (timestamp)
- last_logout_dte (timestamp)
When a user will login to the user area , a new entry should be inserted into LOGIN_STATE table.
When user logs out or session is killed in some other possible way, do the following:
- Update or Insert (if user_id does not exist in the LOGIN_OUT_HIST table) last_login_dte with the value from the LOGIN_STATE.login_dte and update/insert last_logout_dte with value of logout or session kill (timestamp)
- Delete user record from the LOGIN_STATE table.
This application should do the following:
- when user logs in into the user area it should display the last time user logged in and duration of last time stay in the user_area (data will come from LOGIN_OUT_HIST table) . If user never logged in bofore, it should display "Welcome to User Area for the first time."
Any help or suggestions with this task is appreciated.
Thank you
Roman
|
 |
 |
fsibaja
Posts: 10
|
| Posted: 09/11/2004, 11:47 PM |
|
Well, you could modify, the login and logout functions to achive this.
But I ask you something: What if the user doesn't logout properly, and his session just expires? This happens quite often, believe me.
You should use the session_set_save_handler() function, in order to have a real control.
_________________
Fernando Sibaja |
 |
 |
rkiss
Posts: 14
|
| Posted: 09/24/2004, 7:49 AM |
|
thanks for the tip.
Does anyone already have a working example?
thanks
Roman
|
 |
 |
|