From 33db4f2842474f780d30a393380df38742f41759 Mon Sep 17 00:00:00 2001 From: Andres Rey Date: Tue, 10 Oct 2017 10:40:18 +0100 Subject: [PATCH 1/2] Redirect the user in a POST-Redirect-GET fashion after a successful login --- scripts/pi-hole/php/password.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/pi-hole/php/password.php b/scripts/pi-hole/php/password.php index 40095563..acb404ab 100644 --- a/scripts/pi-hole/php/password.php +++ b/scripts/pi-hole/php/password.php @@ -40,6 +40,13 @@ if($postinput == $pwhash) { $_SESSION["hash"] = $pwhash; + + // Login successful, redirect the user to the homepage to discard the POST request + if ($_SERVER['REQUEST_METHOD'] === 'POST' && $_SERVER['QUERY_STRING'] === 'login') { + header(sprintf('Location: index.php')); + exit(); + } + $auth = true; } else From a3aecbf15a9bb71bae02b6a563d030b1ba77dd0d Mon Sep 17 00:00:00 2001 From: Andres Rey Date: Tue, 10 Oct 2017 18:42:32 +0100 Subject: [PATCH 2/2] Remove unused sprintf function --- scripts/pi-hole/php/password.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/pi-hole/php/password.php b/scripts/pi-hole/php/password.php index acb404ab..77ee2863 100644 --- a/scripts/pi-hole/php/password.php +++ b/scripts/pi-hole/php/password.php @@ -43,7 +43,7 @@ // Login successful, redirect the user to the homepage to discard the POST request if ($_SERVER['REQUEST_METHOD'] === 'POST' && $_SERVER['QUERY_STRING'] === 'login') { - header(sprintf('Location: index.php')); + header('Location: index.php'); exit(); }