changes that remove the default pi user

This commit is contained in:
mcguirepr89
2022-04-11 17:29:00 -04:00
parent 6495284d21
commit f69f04d19d
24 changed files with 169 additions and 153 deletions
+22 -22
View File
@@ -45,10 +45,10 @@ if(isset($_POST['view'])){
if($_POST['view'] == "Streamlit"){header('location:/stats');}
if($_POST['view'] == "Daily Charts"){include('history.php');}
if($_POST['view'] == "Tools"){
if (file_exists('/home/*/BirdNET-Pi/thisrun.txt')) {
$config = parse_ini_file('/home/*/BirdNET-Pi/thisrun.txt');
} elseif (file_exists('/home/*/BirdNET-Pi/firstrun.ini')) {
$config = parse_ini_file('/home/*/BirdNET-Pi/firstrun.ini');
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'])) {
@@ -87,64 +87,64 @@ if(isset($_POST['view'])){
if($_POST['view'] == "Advanced"){include('scripts/advanced.php');}
if($_POST['view'] == "Included"){
if(isset($_POST['species']) && isset($_POST['add'])){
$file = '/home/*/BirdNET-Pi/include_species_list.txt';
$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($_POST['species'])){
foreach ($_POST['species'] as $selectedOption)
file_put_contents("/home/*/BirdNET-Pi/include_species_list.txt", $selectedOption."\n", FILE_APPEND);
file_put_contents("./scripts/include_species_list.txt", $selectedOption."\n", FILE_APPEND);
}
} elseif(isset($_POST['species']) && isset($_POST['del'])){
$file = '/home/*/BirdNET-Pi/include_species_list.txt';
$file = './scripts/include_species_list.txt';
$str = file_get_contents("$file");
$str = preg_replace('/^\h*\v+/m', '', $str);
file_put_contents("$file", "$str");
foreach($_POST['species'] as $selectedOption) {
$content = file_get_contents("/home/*/BirdNET-Pi/include_species_list.txt");
$content = file_get_contents("../BirdNET-Pi/include_species_list.txt");
$newcontent = str_replace($selectedOption, "", "$content");
file_put_contents("/home/*/BirdNET-Pi/include_species_list.txt", "$newcontent");
file_put_contents("./scripts/include_species_list.txt", "$newcontent");
}
$file = '/home/*/BirdNET-Pi/include_species_list.txt';
$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');
include('./scripts/include_list.php');
}
if($_POST['view'] == "Excluded"){
if(isset($_POST['species']) && isset($_POST['add'])){
$file = '/home/*/BirdNET-Pi/exclude_species_list.txt';
$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 ($_POST['species'] as $selectedOption)
file_put_contents("/home/*/BirdNET-Pi/exclude_species_list.txt", $selectedOption."\n", FILE_APPEND);
file_put_contents("./scripts/exclude_species_list.txt", $selectedOption."\n", FILE_APPEND);
} elseif (isset($_POST['species']) && isset($_POST['del'])){
$file = '/home/*/BirdNET-Pi/exclude_species_list.txt';
$file = './scripts/exclude_species_list.txt';
$str = file_get_contents("$file");
$str = preg_replace('/^\h*\v+/m', '', $str);
file_put_contents("$file", "$str");
foreach($_POST['species'] as $selectedOption) {
$content = file_get_contents("/home/*/BirdNET-Pi/exclude_species_list.txt");
$content = file_get_contents("./scripts/exclude_species_list.txt");
$newcontent = str_replace($selectedOption, "", "$content");
file_put_contents("/home/*/BirdNET-Pi/exclude_species_list.txt", "$newcontent");
file_put_contents("./scripts/exclude_species_list.txt", "$newcontent");
}
$file = '/home/*/BirdNET-Pi/exclude_species_list.txt';
$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');
include('./scripts/exclude_list.php');
}
if($_POST['view'] == "File"){
header('Location: scripts/filemanager/filemanager.php');
}
if($_POST['view'] == "Webterm"){
if (file_exists('/home/*/BirdNET-Pi/thisrun.txt')) {
$config = parse_ini_file('/home/*/BirdNET-Pi/thisrun.txt');
} elseif (file_exists('/home/*/BirdNET-Pi/firstrun.ini')) {
$config = parse_ini_file('/home/*/BirdNET-Pi/firstrun.ini');
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'])) {