summaryrefslogtreecommitdiff
path: root/api/removeLibrary.php
diff options
context:
space:
mode:
Diffstat (limited to 'api/removeLibrary.php')
-rw-r--r--api/removeLibrary.php14
1 files changed, 14 insertions, 0 deletions
diff --git a/api/removeLibrary.php b/api/removeLibrary.php
new file mode 100644
index 0000000..50b283a
--- /dev/null
+++ b/api/removeLibrary.php
@@ -0,0 +1,14 @@
+<?php
+
+require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.php";
+global $songs; global $_PROFILE; global $library;
+
+if (!isset($_GET["i"])) return;
+
+if (in_array($_GET["i"], $library)) {
+ $library = array_filter($library, function ($i) {
+ return $i !== $_GET["i"];
+ });
+}
+
+file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/users/" . $_PROFILE["id"] . "-library.json", json_encode($library)); \ No newline at end of file