I want to make a PHP web application in which on a single PC there can only be one authentication session at a time i.e. User A login using Firefox, but User B cannot login using IE on the same PC
Of what i googled session sharing between browsers can not be done if asked from server side
Theoretically, you could do this using session_id() and a database entry, although security will be tricky since a malicious user could try generating random session IDs to mimic a logged-on user's session.
Session information is stored in a cookie in the client's browser, with a specified ID. By storing that ID and a JSON string of the data, whenever it's updated, various users could conceivably share the same data. They'd all have to poll the server once in a while to see if the data has been changed.
But at that point, you don't need to use $_SESSION anymore, so it's pretty much defeated the purpose of your question. You can get the same behavior with regular variables, which would already be a security improvement.
Short answer: No, that's not the point of sessions.
You can make the login script such that as to it checks on login whether the user is already looged in or not. If logged in then it will reject any more further logins.
As said above PHP can store session ids in databases. Check the database for existance and then allow or disallow based on that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With