logout all users at a certian time??Is it possible???
Moderator: General Moderators
logout all users at a certian time??Is it possible???
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? 
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..
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..
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...
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...