$link .= "?id=" . $id; $link .= "&title=" . $title; $link .= "&created=" . $created; $link .= "&updated=" . $updated; $link .= "&tracks=" . $tracks; $link .= "&er=" . $er; $link .= "&status=" . $status; header('Location: ' . $link); exit; break; case "Change": $er = ""; if (!testDescr($title)) { $er = "Full Title Required - " . $title; } if (!testnum($id)) { $er .= "ID must be numeric."; } elseif (!testId($id)) { $er .= "ID " . $id . " not found"; } if (strlen($er) == 0) { $updated = date("Y-m-d G:i:s"); $postdata = http_build_query(array("id" => $id, "title" => $title, "updated_at" => $updated, "created_at" => $created)); $opts = array('http' => array('method' => 'PUT', 'header' => "api-username: guy\r\n" . "api-token: d55eb61bda4b6a45d2e7252f25c8949f\r\n", 'content' => $postdata)); $context = stream_context_create($opts); $result = file_get_contents('http://178.62.37.42/albums/' . $id, false, $context); $status = "Changed Album"; } $link = "album.php"; $link .= "?id=" . $id; $link .= "&title=" . $title;
$context = stream_context_create($opts); $resturl = 'http://178.62.37.42/albums/' . $id . '/tracks/' . $trackid; $result = file_get_contents($resturl, false, $context); $status = "Deleted "; } $link = "tracks.php"; $link .= "?id=" . $id; $link .= "&title=" . $title; $link .= "&created=" . $created; $link .= "&updated=" . $updated; $link .= "&er=" . $er; $link .= "&status=" . $status; header('Location: ' . $link); break; case "Enquire": if (!testnum($trackid)) { $er .= "Track ID must be numeric."; } elseif (!testTrackId($id, $trackid)) { $er .= "Album " . $id . " Track ID " . $trackid . " not found"; } if (strlen($er) == 0) { $opts = array('http' => array('method' => "GET", 'header' => "api-username: guy\r\n" . "api-token: d55eb61bda4b6a45d2e7252f25c8949f\r\n")); $context = stream_context_create($opts); $resturl = 'http://178.62.37.42/albums/' . $id . '/tracks/' . $trackid; $file = file_get_contents($resturl, false, $context); $aAlbum0 = json_decode($file, true); foreach ($aAlbum0 as $v => $k) { $tracks = $k[0]; } $status = "Enquiry Succeeded"; }