From 6990d421b8b2494bfe66cb74634b45829cb778fe Mon Sep 17 00:00:00 2001 From: mcguirepr89 Date: Sun, 27 Feb 2022 13:16:26 -0500 Subject: [PATCH] checks for empty urls --- homepage/index.php | 20 ++++++++-- homepage/views.php | 6 +-- scripts/index.html | 94 ---------------------------------------------- 3 files changed, 17 insertions(+), 103 deletions(-) delete mode 100644 scripts/index.html diff --git a/homepage/index.php b/homepage/index.php index ccfb05b..00e03ba 100644 --- a/homepage/index.php +++ b/homepage/index.php @@ -30,16 +30,28 @@ if (!isset($_SERVER['PHP_AUTH_USER'])) { echo "

BirdNET-Pi

"; } echo ""; -if(isset($_GET['log'])){ +if(isset($_GET['log'])) { if (file_exists('/home/pi/BirdNET-Pi/thisrun.txt')) { $config = parse_ini_file('/home/pi/BirdNET-Pi/thisrun.txt'); - $logs = $config['BIRDNETLOG_URL']; + if(empty($config['BIRDNETLOG_URL']) !== true) { + $logs = $config['BIRDNETLOG_URL']; + } elseif(empty($config['BIRDNETPI_URL'] !== true)) { + $logs = $config['BIRDNETPI_URL'].":8080"; + } else { + $logs = "http://birdnetpi.local:8080"; + } } elseif (file_exists('/home/pi/BirdNET-Pi/firstrun.ini')) { $config = parse_ini_file('/home/pi/BirdNET-Pi/firstrun.ini'); - $logs = $config['BIRDNETLOG_URL']; + if(empty($config['BIRDNETLOG_URL']) !== true){ + $logs = $config['BIRDNETLOG_URL']; + } elseif(empty($config['BIRDNETPI_URL'] !== true)) { + $logs = $config['BIRDNETPI_URL'].":8080"; + } else { + $logs = "http://birdnetpi.local:8080"; + } } header("Location: $logs"); -}elseif(isset($_GET['spectrogram'])){ +} elseif(isset($_GET['spectrogram'])){ header("Location: /spectrogram.php"); } else { echo "