Exemplo n.º 1
0
 public static function remove($user_id, $song_id, $position)
 {
     $servername = "classroom.cs.unc.edu";
     $username = "******";
     $password = "******";
     $dbname = "tklosedb";
     $conn = new mysqli($servername, $username, $password, $dbname);
     $delete = "DELETE FROM 1trainSongQueue WHERE user='******' AND id='{$song_id}' AND pos='{$position}'";
     $result = $conn->query($delete);
     if (!$result) {
         echo "error removing song from queue database" . $conn->error;
     }
     return SongQueue::getUsersQueue($user_id);
 }
Exemplo n.º 2
0
            $queue;
            foreach (SongQueue::remove($user, $song_id, $pos) as $idx => $song) {
                $queue[] = array('user' => $song['user'], 'song' => $song['song'], 'title' => $song['title'], 'artist' => $song['artist'], 'art' => $song['art']);
            }
            header('Content-type: application/json');
            print json_encode($queue);
            exit;
        }
        header('Content-type: application/json');
        print "nada";
        exit;
    }
} else {
    if ($_SERVER['REQUEST_METHOD'] == "POST") {
        if ($resource_type == 'queue') {
            $queued = SongQueue::add($_REQUEST['user'], $_REQUEST['id']);
            header('Content-type: application/json');
            print $queued->getJSON();
            exit;
        } else {
            if ($resource_type == 'upload') {
                $songid = $_REQUEST['id'];
                $artistid = $_REQUEST['user_id'];
                $title = $_REQUEST['title'];
                $artist = $_REQUEST['user']['username'];
                $art = $_REQUEST['artwork_url'];
                $avatar = $_REQUEST['user']['avatar_url'];
                $user_id = $_REQUEST['whoLikedID'];
                $profile = $_REQUEST['whoLiked'];
                Artists::create($artistid, $artist);
                Users::create($user_id, $profile);