summaryrefslogtreecommitdiff
path: root/api/removeLibrary.php
blob: 50b283ae781f3221cf4e0b9d653e01c79d39acd5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
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));