$dir = $_GET['caminho'];
$escreve = fopen('play.m3u', 'w');
$tipo = $_GET["tipo"];
$nome = $_GET["nome"];
$arquivo = $_GET['arquivo'];
if ($tipo == 'geral') {
foreach (new DirectoryIterator($dir) as $file) {
if (substr($file, 0, 1) != '.') {
fwrite($escreve, $url_musicas . $nome . '/' . $file . chr(13) . chr(10));
}
}
} else {
fwrite($escreve, $url_musicas . str_replace('../', '', $dir) . '/' . $arquivo . chr(13) . chr(10));
}
fclose($escreve);
?>