Example #1
0
         $status = "Added Album";
     }
     $link = "album.php";
     $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";
     }
Example #2
0
     $link .= "?trackid=" . $trackid;
     $link .= "&tracktitle=" . $tracktitle;
     $link .= "&tracklength=" . $tracklength;
     $link .= "&trackcreated=" . $trackcreated;
     $link .= "&trackupdated=" . $trackupdated;
     $link .= "&id=" . $id;
     $link .= "&title=" . $title;
     $link .= "&created=" . $created;
     $link .= "&updated=" . $updated;
     $link .= "&er=" . $er;
     $link .= "&status=" . $status;
     header("location: " . $link);
     exit;
     break;
 case "Change":
     if (!testDescr($tracktitle)) {
         $er = "Full Track Title Required - " . $title;
     }
     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) {
         $trackupdated = date("Y-m-d G:i:s");
         $postdata = http_build_query(array("album_id" => $id, "id" => $trackid, "title" => $tracktitle, "length" => $tracklength, "created_at" => $trackcreated, "updated_at" => $trackupdated));
         $opts = array('http' => array('method' => 'PUT', 'header' => "api-username: guy\r\n" . "api-token: d55eb61bda4b6a45d2e7252f25c8949f\r\n", 'content' => $postdata));
         $context = stream_context_create($opts);
         $resturl = 'http://178.62.37.42/albums/' . $id . '/tracks/' . $trackid;
         $result = file_get_contents($resturl, false, $context);
         $status = "Changed Track";