diff --git a/advanced/index.php b/advanced/index.php index 911f3cc8..5e88a050 100644 --- a/advanced/index.php +++ b/advanced/index.php @@ -28,7 +28,7 @@ $authorizedHosts = []; // Append FQDN to $authorizedHosts if (!empty($svFQDN)) array_push($authorizedHosts, $svFQDN); - + // Append virtual hostname to $authorizedHosts if (!empty($_SERVER["VIRTUAL_HOST"])) { array_push($authorizedHosts, $_SERVER["VIRTUAL_HOST"]); @@ -40,6 +40,15 @@ $validExtTypes = array("asp", "htm", "html", "php", "rss", "xml", ""); // Get extension of current URL $currentUrlExt = pathinfo($_SERVER["REQUEST_URI"], PATHINFO_EXTENSION); +// Check if this is served over HTTP or HTTPS +if(isset($_SERVER['HTTPS'])) { + if ($_SERVER['HTTPS'] == "on") { + $proto = "https"; + } else { + $proto = "http"; + } +} + // Set mobile friendly viewport $viewPort = ''; @@ -60,7 +69,7 @@ if ($serverName === "pi.hole") {
Pi-hole: Your black hole for Internet advertisements "; - + // Render splash page or landing page when directly browsing via IP or auth'd hostname $renderPage = is_file(getcwd()."/$landPage") ? include $landPage : "$splashPage"; unset($serverName, $svFQDN, $svPasswd, $svEmail, $authorizedHosts, $validExtTypes, $currentUrlExt, $viewPort); @@ -134,7 +143,7 @@ function queryAds($serverName) { } catch (Exception $e) { return array("0" => "error", "1" => $e->getMessage()); } - + } $queryAds = queryAds($serverName); @@ -201,10 +210,10 @@ if (explode("-", $phVersion)[1] != "0") - - + + ● <?=$serverName ?> - +