User authentication with different devices?

And so, we present the question:

A certain John DOE opened an account on the website, then that Bob decided to visit the site from your phone or being a friend through the browser, but that's not the problem, coming home and opening your browser and our website Vasya have to re-enter the username and password of the account, and later lying on the couch Bob again have to enter the same data again, but on mobile.

The question arises: How to be in this situation and keep the username and password on both devices without additional manipulations with the login?
March 20th 20 at 11:41
2 answers
March 20th 20 at 11:43
Create a table where you store key autentifikatsii (cookies) and every cook referred to belongs to whom.
There extra can add additional info, cook for a browser, etc. (purely for informagiovani user)
Actually that's the whole logic.
A user logs in to the website via computer.
him in a cookie signed up.
On the phone is logged, the old key is not overwritten and dobavyatsya new.
Next, in the settings/user profile he can choose which device will disconnect him
March 20th 20 at 11:45
And what exactly is the problem? And so it will work without any additional manipulation. Assume the simplest case - you store user_id in session. When you login from other device will create a new session completely independent of the first. Ie radlogin on the first device will not occur.

In the browser you can store only the session cookie but not the username and password. In the simplest case, if you didn't do anything in addition - unlimited number of sessions can indicate one and the same user.

Find more questions by tags PHPHTTP Cookies