Cookie and Session in Remember Me Function

I never wanted the user to stay on for a period of time, so I never saw the use of the Remember Me feature . I began to think about how to do this, although I would like some clarification.

I am currently storing my sessions in a database. What always puzzled me was that although I do not explicitly set a cookie, it is placed in my browser. I'm a little confused because session is a session and cookie is a cookie. I do not see how the session sets a cookie.

I would also like to know if it would be simple enough to set another session variable in the session array for user login, or would I still need to set a cookie?

+3
source share
4 answers

What always puzzled me was that although I do not explicitly set a cookie, it is placed in my browser.

The session handler must determine which session belongs to the user.

The vast majority of session libraries do this by setting a cookie.

(Is) setting another session variable in the session array to keep the user logged in would be enough or would I still need to set a cookie?

. cookie . , " " (, , , ).

+2

, . .

- . URL, , , , cookie . , cookie , .

.

, , , , 4 ( ); , , , .

, , 4 , cookie . , , . , cookie, .

, , , , , . , , , .

+4

Cookie Session:

PHP Cookie . , cookie , . cookie, , PHP tmp, , . , , .

cookie , , . , , cookie, .

0

PHP- cookie. , . cookie, PHP . , cookie, .

, , , cookie?

, cookie . , - , .

0

Source: https://habr.com/ru/post/1731402/


All Articles