diff --git a/lib/Session.php b/lib/Session.php index d954ade9..b3b99ba2 100644 --- a/lib/Session.php +++ b/lib/Session.php @@ -98,7 +98,7 @@ class Session{ } public static function SetSessionCookie(string $sessionId): void{ - setcookie('sessionid', $sessionId, ['expires' => (new DateTimeImmutable('+1 week'))->format('@'), 'path' => '/', 'domain' => SITE_DOMAIN, 'secure' => true, 'httponly' => false, 'samesite' => 'Lax']); // Expires in two weeks + setcookie('sessionid', $sessionId, ['expires' => (new DateTimeImmutable('+1 week'))->format('U'), 'path' => '/', 'domain' => SITE_DOMAIN, 'secure' => true, 'httponly' => false, 'samesite' => 'Lax']); // Expires in two weeks } /** diff --git a/www/ebooks/download.php b/www/ebooks/download.php index 8ba94fd8..0f42d206 100644 --- a/www/ebooks/download.php +++ b/www/ebooks/download.php @@ -60,7 +60,7 @@ try{ // Increment local download count, expires in 2 weeks $downloadCount++; - setcookie('download-count', (string)$downloadCount, ['expires' => (new DateTimeImmutable('+2 week'))->format('@'), 'path' => '/', 'domain' => SITE_DOMAIN, 'secure' => true, 'httponly' => false, 'samesite' => 'Lax']); + setcookie('download-count', (string)$downloadCount, ['expires' => (new DateTimeImmutable('+2 week'))->format('U'), 'path' => '/', 'domain' => SITE_DOMAIN, 'secure' => true, 'httponly' => false, 'samesite' => 'Lax']); } catch(Exceptions\InvalidFileException | Exceptions\EbookNotFoundException){ Template::Emit404(); diff --git a/www/settings/post.php b/www/settings/post.php index 842a80da..249ffe5e 100644 --- a/www/settings/post.php +++ b/www/settings/post.php @@ -3,7 +3,7 @@ $hideDonationAlert = HttpInput::Bool(POST, 'hide-donation-alert'); $colorScheme = HttpInput::Str(POST, 'color-scheme'); if($hideDonationAlert !== null){ - setcookie('hide-donation-alert', $hideDonationAlert ? 'true' : 'false', ['expires' => (new DateTimeImmutable('+1 month'))->format('@'), 'path' => '/', 'domain' => SITE_DOMAIN, 'secure' => true, 'httponly' => true, 'samesite' => 'Lax']); + setcookie('hide-donation-alert', $hideDonationAlert ? 'true' : 'false', ['expires' => (new DateTimeImmutable('+1 month'))->format('U'), 'path' => '/', 'domain' => SITE_DOMAIN, 'secure' => true, 'httponly' => true, 'samesite' => 'Lax']); } if($colorScheme !== null){ @@ -16,7 +16,7 @@ if($colorScheme !== null){ setcookie('color-scheme', '', ['expires' => 0, 'path' => '/', 'domain' => SITE_DOMAIN, 'secure' => true, 'httponly' => true, 'samesite' => 'Lax']); } else{ - setcookie('color-scheme', $colorScheme, ['expires' => (new DateTimeImmutable('+1 year'))->format('@'), 'path' => '/', 'domain' => SITE_DOMAIN, 'secure' => true, 'httponly' => true, 'samesite' => 'Lax']); + setcookie('color-scheme', $colorScheme, ['expires' => (new DateTimeImmutable('+1 year'))->format('U'), 'path' => '/', 'domain' => SITE_DOMAIN, 'secure' => true, 'httponly' => true, 'samesite' => 'Lax']); } }