From 38fef88f5e583d1a6ddbb79f3e32dff8f5a408c2 Mon Sep 17 00:00:00 2001 From: Marius Date: Wed, 11 Aug 2021 18:54:38 +0200 Subject: [PATCH] Auth --- index.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/index.php b/index.php index 0470561..e9b1c20 100644 --- a/index.php +++ b/index.php @@ -495,10 +495,14 @@ function login() { $txt = Date('Y-m-d\TH:i',time()) . ' ' . $USERS[$_SERVER['PHP_AUTH_USER']]; file_put_contents('logins.txt', $txt.PHP_EOL , FILE_APPEND | LOCK_EX); } else { + header('HTTP/1.1 401 Authorization Required'); + header('WWW-Authenticate: Basic realm="Access denied"'); echo 'Check your pw ' . $_SERVER['PHP_AUTH_PW'] . ' ' . $pw; exit; } } else { + header('HTTP/1.1 401 Authorization Required'); + header('WWW-Authenticate: Basic realm="Access denied"'); echo 'User not found ' . $_SERVER['PHP_AUTH_USER']; exit; }