From 933072f8f9ab8a232d83a49468681f33253124e3 Mon Sep 17 00:00:00 2001 From: Rushaway Date: Sat, 7 Dec 2024 11:13:11 +0100 Subject: [PATCH] fix(blockit): Prevent php warnings - Uncommented and fixed the database query to get server data and prevent php warnings for $data - Added null coalescing operator for hostname array access --- web/pages/admin.blockit.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/web/pages/admin.blockit.php b/web/pages/admin.blockit.php index c4849f8bc..a8f237db9 100644 --- a/web/pages/admin.blockit.php +++ b/web/pages/admin.blockit.php @@ -80,13 +80,13 @@ function BlockPlayer($check, int $sid, $num, $type, int $length) return $objResponse; } -// $GLOBALS['PDO']->query("SELECT ip, port FROM `:prefix_servers` WHERE sid = :sid"); -// $GLOBALS['PDO']->bind(':sid', $sid); -// $sdata = $GLOBALS['PDO']->single(); + $GLOBALS['PDO']->query("SELECT ip, port FROM `:prefix_servers` WHERE sid = :sid"); + $GLOBALS['PDO']->bind(':sid', $sid); + $sdata = $GLOBALS['PDO']->single(); // show hostname instead of the ip, but leave the ip in the title $hostsearch = preg_match_all('/hostname:[ ]*(.+)/', $ret, $hostname, PREG_PATTERN_ORDER); - $hostname = trunc(htmlspecialchars($hostname[1][0]), 25); + $hostname = trunc(htmlspecialchars($hostname[1][0] ?? ''), 25); if (!empty($hostname)) $objResponse->addAssign("srvip_$num", "innerHTML", "" . $hostname . "");