url: 'index.php', type: 'POST', dataType: 'json', data: { action: 'control'} }); event.preventDefault(); }); }); // Refresh Queue setTimeout("location.reload(true);", 60000); </script> </head> <body> <a class='button control' href='skip'>SKIP CURRENTLY PLAYING SONG</a> <?php $request = new Request_Thingy(); $cred_array = array("username" => $_COOKIE['username'], "password" => $_COOKIE['password']); $request->set_credentials($cred_array); // Grab the queued songs $queued_songs = $request->get_song_queue(); echo "<h1>Songs in the Play Queue</h1><ol class='song-queue'>"; // loop with all the songs if (!array_key_exists("__error", $queued_songs)) { foreach ($queued_songs as $queued_song) { echo "<li>{$queued_song['artist']} - {$queued_song['name']}</li>"; } } else { print_r($queued_songs['__error']); } echo "</ol>"; ?>
<?php require 'request.php'; $request = new Request_Thingy(); if (!empty($_COOKIE['username']) && !empty($_COOKIE['password'])) { header('Location: index.php'); } if (isset($_GET['username']) && isset($_GET['password'])) { try { $cred_array = array("username" => $_GET['username'], "password" => $_GET['password']); $request->set_credentials($cred_array); $request->check_credentials(); $username = $_GET['username']; $password = $_GET['password']; setcookie("username", $username); setcookie("password", $password); header('Location: index.php'); } catch (Exception $e) { $invalid_login = true; } } elseif (isset($_GET['email'])) { $email_sent = $request->create_account($_GET['email']); } ?> <!DOCTYPE HTML> <html> <head> <style> <!-- #login { background :red;
<?php if (!isset($_COOKIE['username']) || !isset($_COOKIE['password'])) { setcookie("username"); setcookie("password"); } if (empty($_COOKIE['username']) && empty($_COOKIE['password'])) { header('Location: login.php'); } require 'request.php'; $request = new Request_Thingy(); $cred_array = array("username" => $_COOKIE['username'], "password" => $_COOKIE['password']); $request->set_credentials($cred_array); // Check for POST if ($_SERVER['REQUEST_METHOD'] == 'POST') { // Check that we have an action in our post vars if (isset($_POST['action'])) { switch ($_POST['action']) { case "play": // play action gets played $request->play(urldecode($_POST['file']), $_POST['file_type']); break; case "queue": // queue action gets queued $request->queue(urldecode($_POST['file']), $_POST['file_type']); break; case "control": // control action only has skip right now, so skip $request->skip(); break; }