} else { exit("Malformed URL."); } if (isset($_GET["s"]) and $_GET["s"] != "") { $song_id = $_GET["s"]; } else { exit("You must provide a valid song ID."); } //check the key is valid and current require_once "../models/users.php"; $mUsers = new UsersModel(); require_once "../models/settings.php"; $settings = new Settings(); $userAuthInfo = json_decode($mUsers->getAuthInfo_json("", $key), true); $bitrate = json_decode($mUsers->loadSettings("", array('bitrate'), $key), true); $mUsers->__destruct(); unset($mUsers); if ($userAuthInfo['isError']) { echo "The key provided is old or invalid<br/><br/>\n"; exit($userAuthInfo['resultStr']); } else { if (time() - $userAuthInfo['resultStr']['last_key_date'] > $settings->get("keyLastsFor")) { die("The key provided is old. This song url is not valid anymore. Login to to Mandolin and get a new one."); } } if ($bitrate['isError']) { echo "ERROR: Retrieving the user settings. <br />"; exit($bitrate['resultStr']); } else { $bitrate = $bitrate['resultStr']['bitrate']; }