Do I think correctly about the work of the social network?

When a user is already registered, he is authorized.

If the authorization is successful, his login is saved in the session, and is transmitted to all the following pages.

And this login is used to access the database ???

    1 answer 1

    As far as I understood the question - yes, exactly. The user is authorized, you write, for example, his login (you can still something, not the essence) in the session. The bottom line is that authorization confirms the rights of a particular user and, in terms of code, opens the session of a particular user.

    Well, and then, of course, you can use the data recorded in the session in your queries to the database.