";} if($_GET['view'] == "System Controls"){include('scripts/system_controls.php');} if($_GET['view'] == "Services"){include('scripts/service_controls.php');} if($_GET['view'] == "Spectrogram"){include('spectrogram.php');} if($_GET['view'] == "View Log"){echo "";} if($_GET['view'] == "Overview"){include('overview.php');} if($_GET['view'] == "Today's Detections"){include('todays_detections.php');} if($_GET['view'] == "Species Stats"){echo "

";include('stats.php');} if($_GET['view'] == "Streamlit"){echo "";} if($_GET['view'] == "Daily Charts"){include('history.php');} if($_GET['view'] == "Tools"){ if (file_exists('./scripts/thisrun.txt')) { $config = parse_ini_file('./scripts/thisrun.txt'); } elseif (file_exists('./scripts/firstrun.ini')) { $config = parse_ini_file('./scripts/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 edit the settings for this installation'; exit; } else { $submittedpwd = $_SERVER['PHP_AUTH_PW']; $submitteduser = $_SERVER['PHP_AUTH_USER']; if($submittedpwd == $caddypwd && $submitteduser == 'birdnet'){ $url = $_SERVER['SERVER_NAME']."/scripts/adminer.php"; echo "
"; } else { header('WWW-Authenticate: Basic realm="My Realm"'); header('HTTP/1.0 401 Unauthorized'); echo 'You cannot edit the settings for this installation'; exit; } } } if($_GET['view'] == "Recordings"){include('play.php');} if($_GET['view'] == "Settings"){include('scripts/config.php');} if($_GET['view'] == "Advanced"){include('scripts/advanced.php');} if($_GET['view'] == "Included"){ if(isset($_GET['species']) && isset($_GET['add'])){ $file = './scripts/include_species_list.txt'; $str = file_get_contents("$file"); $str = preg_replace("/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/", "\n", $str); file_put_contents("$file", "$str"); if(isset($_GET['species'])){ foreach ($_GET['species'] as $selectedOption) file_put_contents("./scripts/include_species_list.txt", $selectedOption."\n", FILE_APPEND); } } elseif(isset($_GET['species']) && isset($_GET['del'])){ $file = './scripts/include_species_list.txt'; $str = file_get_contents("$file"); $str = preg_replace('/^\h*\v+/m', '', $str); file_put_contents("$file", "$str"); foreach($_GET['species'] as $selectedOption) { $content = file_get_contents("../BirdNET-Pi/include_species_list.txt"); $newcontent = str_replace($selectedOption, "", "$content"); file_put_contents("./scripts/include_species_list.txt", "$newcontent"); } $file = './scripts/include_species_list.txt'; $str = file_get_contents("$file"); $str = preg_replace('/^\h*\v+/m', '', $str); file_put_contents("$file", "$str"); } include('./scripts/include_list.php'); } if($_GET['view'] == "Excluded"){ if(isset($_GET['species']) && isset($_GET['add'])){ $file = './scripts/exclude_species_list.txt'; $str = file_get_contents("$file"); $str = preg_replace("/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/", "\n", $str); file_put_contents("$file", "$str"); foreach ($_GET['species'] as $selectedOption) file_put_contents("./scripts/exclude_species_list.txt", $selectedOption."\n", FILE_APPEND); } elseif (isset($_GET['species']) && isset($_GET['del'])){ $file = './scripts/exclude_species_list.txt'; $str = file_get_contents("$file"); $str = preg_replace('/^\h*\v+/m', '', $str); file_put_contents("$file", "$str"); foreach($_GET['species'] as $selectedOption) { $content = file_get_contents("./scripts/exclude_species_list.txt"); $newcontent = str_replace($selectedOption, "", "$content"); file_put_contents("./scripts/exclude_species_list.txt", "$newcontent"); } $file = './scripts/exclude_species_list.txt'; $str = file_get_contents("$file"); $str = preg_replace('/^\h*\v+/m', '', $str); file_put_contents("$file", "$str"); } include('./scripts/exclude_list.php'); } if($_GET['view'] == "File"){ echo ""; } if($_GET['view'] == "Webterm"){ if (file_exists('./scripts/thisrun.txt')) { $config = parse_ini_file('./scripts/thisrun.txt'); } elseif (file_exists('./scripts/firstrun.ini')) { $config = parse_ini_file('./scripts/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 access the web terminal'; exit; } else { $submittedpwd = $_SERVER['PHP_AUTH_PW']; $submitteduser = $_SERVER['PHP_AUTH_USER']; if($submittedpwd == $caddypwd && $submitteduser == 'birdnet'){ #ACCESS THE WEB TERMINAL echo ""; } else { header('WWW-Authenticate: Basic realm="My Realm"'); header('HTTP/1.0 401 Unauthorized'); echo 'You cannot access the web terminal'; exit; } } } } elseif(isset($_GET['submit'])) { $command = $_GET['submit']; ob_end_flush(); } else {include('overview.php');} ?>