logout all users at a certian time??Is it possible???

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

Post Reply
maldar
Forum Commoner
Posts: 49
Joined: Mon Aug 18, 2003 4:39 pm

logout all users at a certian time??Is it possible???

Post by maldar »

I want to terminate site service to all users at a certain time every day.I associate session to every user and now I want to get all session (or session id) that associated yet and destroy all them.do you think it is possible? please help me? :oops:
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

wouldn't that require a cron job where a script is run at a specific time and destroys all session data (probably stored in a DB) and disables future logins.

Mark
maldar
Forum Commoner
Posts: 49
Joined: Mon Aug 18, 2003 4:39 pm

Post by maldar »

Thanks,but how save different associated session in DB?session variables is same but associated session ID may be a lot
NoReason
Forum Commoner
Posts: 51
Joined: Tue Sep 10, 2002 6:19 pm

Post by NoReason »

Well.. I suppose what you could do is to delete the session files ( where ever they may be). And have your application to see if the user HAS a sessionID anymore... once the session file for that user is gone I would imagine the appliction when prompted to do an action, would check and see that there is no sessionid, throw him to a error page that indicates their session has been teminated.

Having the sessionid in a database would be a good way to know WHO is currently on, and has an active session... And i suppose you could parse that returned data and filter out all the session files that relate to those users and delete them.. Seems easier to just nuke the seesion files.

But that is all speculation, i have never done anything like that.. However i have had errors if php could not find the session file directory, so it stands to reason that if you were able to remove the session files or even rename the directory for the down time, all would stop to work..

May wanna have the login page check for the directory if you do it that way, if it cant find it then it could default to an down for maintainance page..... Or have it just not allow logins after a certain time ... although time is reltiive from where peeps login, but if you are using your local time.. I guess tuff beans to the other folk.. :P
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Post by JAM »

Perhaps I didn't understand it, but...

11-14, the session should be not allowed.

So, if time is between 11:00 and 14:00, and anyone updates, refreshes, loades the page, session_destroy. (also, do not allow logins or whatever you have). If not, well, it's not between 11-14.

Can't see any use of a db here...
maldar
Forum Commoner
Posts: 49
Joined: Mon Aug 18, 2003 4:39 pm

Post by maldar »

i want save some data about current user in db becuase of use them later for easily recognize users that has arrived now
Post Reply