How do you implement authorization so that only one user can log in?

Hello!
The problem is this...when the user is logged in to the site through another computer should not go to his account...
how can this be implemented?
June 8th 19 at 16:46
2 answers
June 8th 19 at 16:48
put the cookie to the user (once a minute, the cookie in the background updating), somewhere on the server remember that he logged on (type cook updated), if tries to login check is there a record of its authorization and all
well, let's say I kept the cookies in the browser and in the database.....and with this check....but when the user just closed the browser and left? and then maybe he will have another computer to log into the system.... but in DB another cookie.... - Jessica.Schmele commented on June 8th 19 at 16:51
I need to deny authorization only when the user is already authorized....that is, during the work on the other compco to enter the same account is impossible... - Jessica.Schmele commented on June 8th 19 at 16:54
I wrote in the background update the cookie once the browser is closed the cookie with the browser left and on the server in crone check if the cookie is not updated every N minutes, then remove it. - Mitchell_Zemlak16 commented on June 8th 19 at 16:57
in the crown will put the task in the definition of time? it's the load on the server.... - Jessica.Schmele commented on June 8th 19 at 17:00
let's say for 5 or 10 min... - Jessica.Schmele commented on June 8th 19 at 17:03
if you are afraid the crown can come up with something else :) radishes, Menkes etc. but the essence of logic has not changed. - Mitchell_Zemlak16 commented on June 8th 19 at 17:06
June 8th 19 at 16:50
From Yii user Dektrium for example there are auth_key, which is used for authorization. Now, under the new login and overwrite the key on a new one, this is equivalent to anlogin with other devices.
and you also a question as to the top.....
well, let's say I kept the key in the cookie and in the DB...and with this checked...
but when the user just closed the browser and went...and then went with another Conca...? - Jessica.Schmele commented on June 8th 19 at 16:53
old browser become inactive. - Jessica.Schmele commented on June 8th 19 at 16:56
but this is how you can know? when in DB other key recorded...
older browser become inactive.

but it's not possible to know what other browsers the user is active or not... - Mitchell_Zemlak16 commented on June 8th 19 at 16:59
That was the user informed?

Write for each new authorization key in the database, rewrite the methods of obtaining the key.
If the key is not logged into for a week, or a month - then make it inactive, i.e., disconnected person. If the person is logged in from another device and do other inactive. - Jessica.Schmele commented on June 8th 19 at 17:02
as online users on the website via php you can implement is to make up every minute and if he's still here - no change. If not remove its key from the database. - Jessica.Schmele commented on June 8th 19 at 17:05

Find more questions by tags YiiPHP