I have a web platform created with php in backend and javascript in frontend, there is a file called configs.php, where only administrators can access (controlled by php sessions), the problem is that when two administrators access at the same time , catastrophic errors can occur. The idea is that only one administrator access configs.php at a time.
Then I need to detect when two users (administrators) have accessed that same section (configs.php), or even when the same user has opened two windows of that same section. In case this is detected, launch an alert that prevents configs.php from being used in more than one window at a time.
An example of what I need to achieve can be seen at web.whatsapp.com, where if they duplicate the window they are in, in the first window they had open, the following appears:
Then I need to achieve that with the technologies that I am using, maybe it can be done with javascript, or maybe it can only be done with php and the database (MySQL).
I accept solutions with Firebase Realtime Database, since I also use it on this platform and could implement it.
EDIT
I have not put code because the main thing I'm looking for with this question is to know if the technologies I'm using will allow me to achieve it, as well as being open to other possibilities, as some users have already answered.
Thank you.