Fix set cookie with tag "secure" when https is forced.

This commit is contained in:
Laurent Destailleur 2021-08-04 14:38:05 +02:00
parent 928a2154b3
commit 841176fdfd
2 changed files with 2 additions and 2 deletions

View File

@ -265,7 +265,7 @@ if (!empty($_POST["DOL_AUTOSET_COOKIE"])) {
$cookiename = $tmpautoset[0];
$cookievalue = json_encode($cookiearrayvalue);
//var_dump('setcookie cookiename='.$cookiename.' cookievalue='.$cookievalue);
setcookie($cookiename, empty($cookievalue) ? '' : $cookievalue, empty($cookievalue) ? 0 : (time() + (86400 * 354)), '/', null, false, true); // keep cookie 1 year and add tag httponly
setcookie($cookiename, empty($cookievalue) ? '' : $cookievalue, empty($cookievalue) ? 0 : (time() + (86400 * 354)), '/', null, (empty($dolibarr_main_force_https) ? false : true), true); // keep cookie 1 year and add tag httponly
if (empty($cookievalue)) {
unset($_COOKIE[$cookiename]);
}

View File

@ -67,7 +67,7 @@ if ($_SESSION["takeposterminal"] == "") {
if ($setterminal > 0) {
$_SESSION["takeposterminal"] = $setterminal;
setcookie("takeposterminal", $setterminal, (time() + (86400 * 354)), '/', null, false, true); // Permanent takeposterminal var in a cookie
setcookie("takeposterminal", $setterminal, (time() + (86400 * 354)), '/', null, (empty($dolibarr_main_force_https) ? false : true), true); // Permanent takeposterminal var in a cookie
}
if ($setcurrency != "") {