D
D
Daniel_R2021-02-19 13:51:54
PHP
Daniel_R, 2021-02-19 13:51:54

How to set cookies for the entire folder?

Good afternoon.
There was such a problem. Browsers have stopped setting cookies without the SameSite attribute via ajax. No matter how hard I tried, I couldn't. (SSl is not present).
After that, I decided to do it the old fashioned way in another file.
The scheme is like this. The form in index.php communicates via ajax with enter.php. As soon as the correct data is entered, there is a transition to cookie.php, where everything is rechecked and the cookie is set.
I put cookies like this, but for some reason they are displayed only in this file and disappear when you go to the Home page.
I know about the Path attribute. index.php (main) and cookie.php (the cookie is placed here) are in the same folder.
setcookie("login",$login, time()+60*60*24*365*10, '/');
Do not tell me what could be the problem? Thanks in advance.
PS
Displays in issues
602f993191366318061956.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Shamanov, 2021-02-19
@SilenceOfWinter

and what hinders to set SameSite?

// PHP < 7.3
$path .= '; ' . $sameSite;
setcookie($name, $value, $expires, $path, $domain, $secure, $httpOnly)
// PHP >= 7.3
setcookie($name, $value, ['samesite' => 'Lax']);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question