A
A
Alexander2014-08-23 18:37:24
PHP
Alexander, 2014-08-23 18:37:24

How to make a memorable authorization that works on multiple computers?

I can't shake the feeling that I'm reinventing the wheel. Read How to make authorization by cookies on several PCs? PHP , but in the link provided in the answer, the token is overwritten on each visit. Those. logged in from a PC - one token signed up, logged in from a laptop - another token signed up, and now you have to log in to the PC again.
How to make an authorization that works on several devices at once? Use one token for all devices? Or make a separate table in the database, where to write down all active user tokens? Or are there any other options?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
_
_ _, 2014-08-23
@AMar4enko

What tokens are you referring to? Session ID?
The client sends you a session identifier, you pull out data using this identifier, in the user ID data.
Actually, if the client gave you a session ID and you found session data using it, it means that the user is logged in (we will not go into details of checking the validity of sessions by IP, etc.)
There will be different session IDs on different computers, but the same user ID will be bound to them on the server side.
I can assume, of course, that when a user logs in, in the "Users" table in the SESSION_ID column, write down the session ID of the newly logged in user - in this case, everything will be exactly as you described. But in this case, you are your own evil Pinocchio - users separately, sessions separately.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question