Remove external ipv6 brackets if any in servername

Signed-off-by: Patrik Cyvoct <patrik@ptrk.io>
This commit is contained in:
Patrik Cyvoct 2018-08-22 09:11:55 +02:00
parent ddbdb51d20
commit 048e5bb9a2
No known key found for this signature in database
GPG key ID: D9105E724B0143B2

View file

@ -8,6 +8,8 @@
// Sanitise HTTP_HOST output
$serverName = htmlspecialchars($_SERVER["HTTP_HOST"]);
// Remove external ipv6 brackets if any
$serverName = preg_replace('/^\[(.*)\]$/', '${1}', $serverName);
if (!is_file("/etc/pihole/setupVars.conf"))
die("[ERROR] File not found: <code>/etc/pihole/setupVars.conf</code>");