rewrite pppr_is_local
This commit is contained in:
@@ -162,6 +162,14 @@ function get_PPPR_data() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function pppr_is_local() {
|
function pppr_is_local() {
|
||||||
$first_char = $_COOKIE['PPPR'][0];
|
// 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 $first_char === '1';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return false if cookie is missing or empty
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user