/    Sign up×
Community /Pin to ProfileBookmark

PHP clear session of admin team

According to I build a chat support by PHP and use ajax for update chatting message.
on the system, there are 2 parts. first is admin team(different user), second is guest.
on PHP I create different SESSION name for them.
so every day at 5:00PM, the office will be close and all admin user will be logout
I can do this by crontab but my question is
How can I make all admin team logout? If answer is delete their SESSION.
So How can I delete their SESSION?

to post a comment
PHP

4 Comments(s)

Copy linkTweet thisAlerts:
@NogDogJul 15.2021 — Well...my first thought is to ask: why do you think you need to log out the admins right at 5PM? What if they want/need to work a little bit late one night? What is the problem/danger with letting their sessions time-out normally?
Copy linkTweet thisAlerts:
@NitiphoneauthorJul 15.2021 — @NogDog#1634161 It's goverment system ^____^

guest can chat only when admin team is login, I set a parameter on DB for check status of admin team.

so normally only when admin logout, the parameter will be change to offline.

this system is working on Mobile App also. for Mobile part, I control admin part by Token that generate when admin login and store on DB, every activity Mobile will send the token to check and if match with the token on DB, system will be allow the admin work.

so I will create a script to change status to offline and clear the token on DB to make all admin offline but about admin Web part. it work on SESSION. I also want to clear the SESSION also and let they relogin again if really want to work.

if not do this, if any admin not click logout, they will be online all day
Copy linkTweet thisAlerts:
@NogDogJul 15.2021 — Still seems a bit odd, but assuming you have a good reason to do it, maybe you could use session_save_path() to specify a separate directory for the admins' session data. You would need to call it before any call to session_start(), and make sure that directory is writable by the web server user that actually executes you PHP scripts. Then with a cron job you could just delete all files in that directory at 5pm, I guess?
Copy linkTweet thisAlerts:
@NitiphoneauthorJul 15.2021 — @NogDog#1634163 Wow it's nice step, I just know about the setting path of SESSION. Thank you
×

Success!

Help @Nitiphone spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...