From bdeae51bdb14357ddfdce9b0e7f9fec2de3f6b5e Mon Sep 17 00:00:00 2001 From: Remo Zaros Date: Wed, 1 Jul 2026 11:17:12 +0200 Subject: [PATCH] rewrite pppr_is_local --- pppr_cookie.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/pppr_cookie.php b/pppr_cookie.php index 97eef1a..5d389cd 100644 --- a/pppr_cookie.php +++ b/pppr_cookie.php @@ -162,6 +162,14 @@ function get_PPPR_data() { } function pppr_is_local() { - $first_char = $_COOKIE['PPPR'][0]; - return $first_char === '1'; + // Check if the cookie exists and is not empty + if (isset($_COOKIE['PPPR']) && !empty($_COOKIE['PPPR'])) { + // Ensure it's treated as a string before accessing the first character + $cookie_value = (string) $_COOKIE['PPPR']; + $first_char = $cookie_value[0] ?? ''; + return $first_char === '1'; + } + + // Return false if cookie is missing or empty + return false; }