Auto-logout of users after a certain time

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Drachlen
Forum Contributor
Posts: 153
Joined: Fri Apr 25, 2003 1:16 am

Post by Drachlen »

What is time consuming?
maldar
Forum Commoner
Posts: 49
Joined: Mon Aug 18, 2003 4:39 pm

Post by maldar »

iteration! and seek in table
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Post by JAM »

Nah, it wont be. SQL is extremely fast (there are benchmark testa at MySQL's site), trust us. ;)
maldar
Forum Commoner
Posts: 49
Joined: Mon Aug 18, 2003 4:39 pm

Post by maldar »

seek in table frequantly to find user session that has more than x minutes of lifetime to log out them. I want set a certian time to user session and when it expird, automatically log out her/him.but if i do this iteration in table,then there is no time to do other work
maldar
Forum Commoner
Posts: 49
Joined: Mon Aug 18, 2003 4:39 pm

Post by maldar »

also if i want it i must do it concurrently and i know that it is impossible...
maldar
Forum Commoner
Posts: 49
Joined: Mon Aug 18, 2003 4:39 pm

Post by maldar »

Removed
Last edited by maldar on Mon Sep 01, 2003 11:28 pm, edited 1 time in total.
m3rajk
DevNet Resident
Posts: 1191
Joined: Mon Jun 02, 2003 3:37 pm

Post by m3rajk »

hmm.. nope. it's simple.....

mysql_query("SELECT username FROM login_activity WHERE last_activity>(5 min ago)",$db);

umm.. (5 min ago) should be a calculated time
maldar
Forum Commoner
Posts: 49
Joined: Mon Aug 18, 2003 4:39 pm

Post by maldar »

I still have problem....
may i have a complete sample code of its implementation.Thanks
m3rajk
DevNet Resident
Posts: 1191
Joined: Mon Jun 02, 2003 3:37 pm

Post by m3rajk »

i don't use sessions and haven't implented who's online yet
maldar
Forum Commoner
Posts: 49
Joined: Mon Aug 18, 2003 4:39 pm

Post by maldar »

what do you suggest for do it?
m3rajk
DevNet Resident
Posts: 1191
Joined: Mon Jun 02, 2003 3:37 pm

Post by m3rajk »

show us what you have and we can try to help you debug
maldar
Forum Commoner
Posts: 49
Joined: Mon Aug 18, 2003 4:39 pm

Post by maldar »

Thanks to all
i suggest this way.Do you think it is correct??? and enough useful ?
1)save user entrance time to db
2)on every request from him/her update last activity for that user
3)on every new user login or old user logout check db for find users with no activities and logout them
Post Reply