Answer the question
In order to leave comments, you need to log in
How to protect cookies?
It is necessary to create 2 types of cookies (lifetime 0 seconds and 30 days) there are no problems with this.
if ( $_POST['remember'] == '')
{
setCookie('user', $user);
} else {
setCookie('user', $user, time() + 86400 * 30, '/');
}
Answer the question
In order to leave comments, you need to log in
javascript.ru/unsorted/id
There are a lot of types of user identification with all kinds of protection.
Read what cookies are, how they work and WHAT THEY ARE FOR.
At least on Wikipedia, at least in any textbook ( 1 , 2 , 3 ).
You are now facing problems because you are trying to misuse this tool.
Just like in the joke about "driving a screw with a hammer is easier than tightening a nail with a screwdriver."
It would be better to write this $user of yours to the session, and not to cookies. If the session is not applicable for some reason, JWT can be applied (but this is more difficult for a beginner).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question