Esempio n. 1
0
</head>
<body>

BLK1;
require_once 'mpd-class/mpd.class.php';
$mpd = new mpd($host, $port, $password);
$pl = $mpd->GetDir();
if (isset($_GET['setTo'])) {
    if (in_array($_GET['setTo'], $pl['playlist'])) {
        //test for illegit data
        $mpd->PLLoad($_GET['setTo']);
    } elseif (isset($_GET['clear'])) {
        $mpd->PLClear();
    } elseif (isset($_GET['del'])) {
        //mpd.class tests for integer
        $mpd->PLRemove($_GET['del']);
    } elseif (isset($_GET['play'])) {
        //mpd.class tests for integer
        $mpd->SkipTo($_GET['play']);
        $mpd->Play();
    }
}
$me = basename($_SERVER['PHP_SELF']);
$rnd = substr(md5(rand()), 0, 8);
// having trouble with refreshes. this should convince the browser that everything's unique
print "<p><a href=\"playlist.php?{$rnd}\" accesskey=\"*\">*. Refresh</a> | ";
print "<a href=\"index.php?{$rnd}\" accesskey=\"#\">#. Back</a></p>\n";
print "<p><a href=\"{$me}?clear={$rnd}\">Clear Playlist</a></p>\n";
print "<h3>Available Playlists</h3>\n<p>";
foreach ($pl['playlist'] as $key => $val) {
    print "<a href=\"{$me}?setTo={$val}&{$rnd}\">{$val}</a><br />\n";