color: blue; } </style> </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";
<?php include "mpd.class.php"; $inst = new mpd("127.0.0.1", 6600); $inst->Stop(); $inst->DBRefresh(); $inst->PLClear(); $inst->PLAdd($_GET["file"]); $inst->Play();