Cookie format to save and use cookies for each user...? (Not a basic method question)

Asked 2 years ago, Updated 2 years ago, 114 views

JS in use

To save and use cookies by user In the url to be saved in document.cookie, add user="anything" Check the user value on the cookie every time I'm guessing that you're using the user's Is this how you do it?

So far, I've been using 3 cookies for each function I thought there would be more users Is it right to put all the cookies in a row for each user?

There are many basic ways to use Google, but there is no guide, so I am asking because I am curious.

cookie javascript html web

2022-09-20 17:09

1 Answers

Is it right to put all the cookies in a row for each user?

Cookies are supposed to be one line. As a result, this is the content of the Cookie header used when the request is sent.

Is this how you do it?

Yes.

There are many basic ways to use Google, but there is no guide.

That's because it's true no matter what or how you implement it using the means of cookies.
For example, this is not a very wrong answer.

setcookie("user", "jkl0931");
setcookie("pass", "bklove3311!!");
setcookie("subscription_due", "2021-05-03 23:59:59");

But obviously, there's a security problem. So it's usually done by creating a meaningless random number on the server and implementing a one-on-one session that matches it with specific user information, and then leaving only that random number on the cookie.

By the way,

Considering that there will be more users

You said that increasing the number of users does not necessarily mean that the size of the cookies left in each user's browser will increase, so what exactly are you worried about or prepared for? If there is a specific scenario, it will be easier to explain or analyze.


2022-09-20 17:09

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.