require_once '../../../config.php'; require_once '../../../api/soundcloud.php'; require_once '../../../api/classes/db.inc.php'; require_once '../../../api/classes/battle.inc.php'; if (isset($_REQUEST['cmd'])) { $cmd = $_REQUEST['cmd']; } else { echo "No command specified."; return false; } if ($cmd == "sync") { $soundcloud = new Soundcloud(SOUNDCLOUD_API_CLIENT_ID, SOUNDCLOUD_API_CLIENT_SECRET, SOUNDCLOUD_API_REDIRECT_URL); $tracks = $soundcloud->execute('groups/20839/tracks?consumer_key=' . SOUNDCLOUD_API_CLIENT_ID . '&format=json', '', 'GET'); $battleObj = new Battle(); $battleObj->syncTracks($tracks); echo loadBattle(); } else { if ($cmd == "vote" && $_POST) { $postArr = $_POST; $battleObj = new Battle(); $battleObj->voteOnTrack($postArr); echo loadBattle(); } else { if ($cmd == "load") { echo loadBattle(); } else { echo "Invalid command."; return false; } }