From decf49e37cc1e672d6d3535ee94ee8f0509849bf Mon Sep 17 00:00:00 2001 From: mcguirepr89 Date: Fri, 4 Mar 2022 20:58:06 -0500 Subject: [PATCH] fixed the streamer mess --- homepage/index.php | 44 +++++++++++++++++++++++--------------------- homepage/style.css | 4 ++++ scripts/overview.php | 13 +------------ 3 files changed, 28 insertions(+), 33 deletions(-) diff --git a/homepage/index.php b/homepage/index.php index e498aa7..4b26467 100644 --- a/homepage/index.php +++ b/homepage/index.php @@ -7,30 +7,31 @@ -

BirdNET-Pi

"; - } else { + $config = parse_ini_file('/home/pi/BirdNET-Pi/thisrun.txt'); + } elseif (file_exists('/home/pi/BirdNET-Pi/firstrun.ini')) { + $config = parse_ini_file('/home/pi/BirdNET-Pi/firstrun.ini'); + } + $caddypwd = $config['CADDY_PWD']; + if (!isset($_SERVER['PHP_AUTH_USER'])) { header('WWW-Authenticate: Basic realm="My Realm"'); header('HTTP/1.0 401 Unauthorized'); echo 'You cannot listen to the live audio stream'; exit; + } else { + $submittedpwd = $_SERVER['PHP_AUTH_PW']; + $submitteduser = $_SERVER['PHP_AUTH_USER']; + if($submittedpwd == $caddypwd && $submitteduser == 'birdnet'){ + echo " + +

BirdNET-Pi

+ "; + } else { + header('WWW-Authenticate: Basic realm="My Realm"'); + header('HTTP/1.0 401 Unauthorized'); + echo 'You cannot listen to the live audio stream'; + exit; + } } -} } else { echo "
@@ -63,6 +64,7 @@ if(isset($_GET['log'])) { } elseif(isset($_GET['spectrogram'])){ header("Location: /spectrogram.php"); } else { - echo " -