From 4feacbf66a496995dc81d009789aa0933f036221 Mon Sep 17 00:00:00 2001 From: jojoc4 Date: Thu, 29 Dec 2022 10:41:27 +0100 Subject: [PATCH 1/2] updater and admin space --- admin/music.php | 61 +++++++++++++++++++++++++++++++++++++++++++++++ config_sample.php | 2 +- updater/v1.php | 4 ++-- updater/v2.php | 36 ++++++++++++++++++++++++++++ updater/v2.sql | 8 +++++++ 5 files changed, 108 insertions(+), 3 deletions(-) create mode 100644 updater/v2.php create mode 100644 updater/v2.sql diff --git a/admin/music.php b/admin/music.php index a1cc102..bbf6c9d 100644 --- a/admin/music.php +++ b/admin/music.php @@ -41,6 +41,31 @@ break; case 've': $pdo->exec("UPDATE `version` SET `name` = '".addslashes($_GET['name'])."', `number` = '".$_GET['number']."' WHERE `id_version` = '".$_GET['id_version']."';"); + if(isset($_GET["soprano"])){ + $pdo->exec("UPDATE `version` SET `soprano` = '1' WHERE `id_version` = ". $_GET['id_version']); + }else{ + $pdo->exec("UPDATE `version` SET `soprano` = '0' WHERE `id_version` = ". $_GET['id_version']); + } + if(isset($_GET["alto"])){ + $pdo->exec("UPDATE `version` SET `alto` = '1' WHERE `id_version` = ". $_GET['id_version']); + }else{ + $pdo->exec("UPDATE `version` SET `alto` = '0' WHERE `id_version` = ". $_GET['id_version']); + } + if(isset($_GET["tenor"])){ + $pdo->exec("UPDATE `version` SET `tenor` = '1' WHERE `id_version` = ". $_GET['id_version']); + }else{ + $pdo->exec("UPDATE `version` SET `tenor` = '0' WHERE `id_version` = ". $_GET['id_version']); + } + if(isset($_GET["basse"])){ + $pdo->exec("UPDATE `version` SET `basse` = '1' WHERE `id_version` = ". $_GET['id_version']); + }else{ + $pdo->exec("UPDATE `version` SET `basse` = '0' WHERE `id_version` = ". $_GET['id_version']); + } + if(isset($_GET["tutti"])){ + $pdo->exec("UPDATE `version` SET `tutti` = '1' WHERE `id_version` = ". $_GET['id_version']); + }else{ + $pdo->exec("UPDATE `version` SET `tutti` = '0' WHERE `id_version` = ". $_GET['id_version']); + } break; case 'vd': $version = $pdo->query("SELECT * FROM version WHERE `id_version` = '".$_GET['id_version']."' ")->fetch(PDO::FETCH_ASSOC); @@ -58,6 +83,22 @@ } if(move_uploaded_file($_FILES["version"]["tmp_name"], $target)){ $pdo->exec("INSERT INTO `version` (`name`, `id_music`, `url`, `number`) VALUES ('".addslashes($_POST['name'])."', '".$_GET['id']."', '".$music['directory'] . "/" . $_POST['name'] . ".mp3"."', '".$_POST['number']."');"); + $id = $pdo->lastInsertId(); + if(str_contains($_POST["name"], "SOPRANO")){ + $pdo->exec("UPDATE `version` SET `soprano` = '1' WHERE `id_version` = ". $id); + } + if(str_contains($_POST["name"], "ALTO")){ + $pdo->exec("UPDATE `version` SET `alto` = '1' WHERE `id_version` = ". $id); + } + if(str_contains($_POST["name"], "TENOR")){ + $pdo->exec("UPDATE `version` SET `tenor` = '1' WHERE `id_version` = ". $id); + } + if(str_contains($_POST["name"], "BASSE")){ + $pdo->exec("UPDATE `version` SET `basse` = '1' WHERE `id_version` = ". $id); + } + if(str_contains($_POST["name"], "TUTTI")){ + $pdo->exec("UPDATE `version` SET `tutti` = '1' WHERE `id_version` = ". $id); + } }else{ echo "Error"; } @@ -132,6 +173,26 @@ +
+ > + +
+
+ > + +
+
+ > + +
+
+ > + +
+
+ > + +