From d94d86bad800edab5e77dae981833844540a8093 Mon Sep 17 00:00:00 2001 From: Glenn Strauss Date: Sun, 18 Dec 2022 23:09:57 -0500 Subject: [PATCH] remove hard-coded /admin/ path; relocatable Signed-off-by: Glenn Strauss --- scripts/pi-hole/php/password.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/pi-hole/php/password.php b/scripts/pi-hole/php/password.php index 7724cd05..6487f812 100644 --- a/scripts/pi-hole/php/password.php +++ b/scripts/pi-hole/php/password.php @@ -68,7 +68,11 @@ function verifyPassword($pwhash, $use_api = false) $_SESSION['auth'] = true; // Login successful, redirect the user to the original requested page - if ($_SERVER['REQUEST_METHOD'] === 'POST' && $_SERVER['SCRIPT_NAME'] === '/admin/login.php') { + if ( + $_SERVER['REQUEST_METHOD'] === 'POST' && + strlen($_SERVER['SCRIPT_NAME']) >= 10 && + substr_compare($_SERVER['SCRIPT_NAME'], '/login.php', -10) === 0 + ) { header('Location: '.$redirect_url); exit; }