From 1ed98f6f38411d2edb6482f0cbc8d13b5d33de67 Mon Sep 17 00:00:00 2001 From: Chris Miceli Date: Wed, 6 Oct 2021 17:39:21 -0500 Subject: [PATCH] 1777 Remember me for 7 days doesn't work if you log in from Recent Queries (#1870) set cookie if requested Signed-off-by: Chris Miceli --- scripts/pi-hole/php/password.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/scripts/pi-hole/php/password.php b/scripts/pi-hole/php/password.php index 7391a311..038d4bbb 100644 --- a/scripts/pi-hole/php/password.php +++ b/scripts/pi-hole/php/password.php @@ -75,14 +75,15 @@ // Set hash in new session $_SESSION["hash"] = $pwhash; + // Set persistent cookie if selected + if (isset($_POST['persistentlogin'])) + { + // setcookie( $name, $value, $expire, $path, $domain, $secure, $httponly ) + setcookie('persistentlogin', $pwhash, time()+60*60*24*7, null, null, null, true ); + } + // Login successful, redirect the user to the homepage to discard the POST request if ($_SERVER['REQUEST_METHOD'] === 'POST' && $_SERVER['QUERY_STRING'] === 'login') { - // Set persistent cookie if selected - if (isset($_POST['persistentlogin'])) - { - // setcookie( $name, $value, $expire, $path, $domain, $secure, $httponly ) - setcookie('persistentlogin', $pwhash, time()+60*60*24*7, null, null, null, true ); - } header('Location: index.php'); exit(); }