Fix undefined array key warning for $_SESSION['user_id'] in index.php
Agent-Logs-Url: https://github.com/GameServerPanel/GSP/sessions/a301a563-c83f-44f7-affb-422b2efccfe1 Co-authored-by: iaretechnician <2749183+iaretechnician@users.noreply.github.com>
This commit is contained in:
parent
f9f888ef41
commit
e87eefaebc
1 changed files with 4 additions and 2 deletions
|
|
@ -68,8 +68,10 @@ if (!$db instanceof OGPDatabase) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Logged in user settings - access this global variable where needed
|
// Logged in user settings - access this global variable where needed
|
||||||
if(hasValue($_SESSION['user_id'])){
|
// Guard: read user_id only if it exists in the session to avoid undefined-key warnings.
|
||||||
$loggedInUserInfo = $db->getUserById($_SESSION['user_id']);
|
$sessionUserId = $_SESSION['user_id'] ?? null;
|
||||||
|
if(hasValue($sessionUserId)){
|
||||||
|
$loggedInUserInfo = $db->getUserById($sessionUserId);
|
||||||
}
|
}
|
||||||
|
|
||||||
$settings = $db->getSettings();
|
$settings = $db->getSettings();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue