When navigating to the Facebook social network, I see that I can open 2 accounts (1 in Firefox and the other in Internet Explorer), or maybe multiple accounts. This is not so good knowing that the Facebook policy allows only to open a session at the same time.
When starting a session, how to prevent the same session (considering the session name $_SESSION['user']
) from being re-opened in another browser (Internet Explorer/Safari/Opera...)?
Otherwise, how can I know (with PHP) that a certain session is open in all browsers to prevent the session to be open twice?
$token = hash('sha256', rand() . microtime() . $_SERVER['REMOTE_ADDR']) // rand as possible
$_SERVER['user'] = $token;
Instead of preventing a new session from being opened in a new browser if there is already an open session elsewhere, consider invalidating any existing sessions to that user account when a new Sign In occurs. This will minimise user frustration, and is simple to implement.
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