Eccoti il codice:
Grazie!!codice:<?php // set this to a creator name $creator = " "; // search for mp3 files $filter = ".mp3"; // path to the directory you want to scan // "./" = current directory $directory = "./mp3"; // URL to files $url = "http://www.miosito.it/multimedia/"; /////////////////////////// no user configuration variables below this \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ // read through the directory and filter files to an array @$d = dir($directory); if ($d) { while($entry = $d->read()) { $ps = strpos(strtolower($entry), $filter); if (!($ps === false)) { //////////////////////////////////////////// Windows debug code \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ // unset($output); // exec('stat -t ' . escapeshellarg($entry), $output); // print "<pre>"; // print_r($output); // exit; // $output = explode(' ', $output[0]); // $items[$entry]['mtime'] = $output[10]; //////////////////////////////////////////// Windows debug code \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ //...Windows normal code - sorting by mtime // $items[$entry]['mtime'] = filemtime($entry); //...Linux/Unix code - sorting by mtime // There is an option in the "stat" command to return the MAC timestamps of a file in epoch time, // where Access/Modify/Change are given in format %X/%Y/%Z. // $items[$entry]['mtime'] = exec('stat -c %Y ' . escapeshellarg("{$directory}/{$entry}")); //...Windows/Linux/Unix normal code - sorting by filename $items[$entry] = $entry; } } $d->close(); // reverse sort - latest first // arsort($items); // normal sort - alphabetically by filename asort($items); } // xml header and opening tags header("content-type:text/xml;charset=utf-8"); print <<<END <?xml version='1.0' encoding='utf-8'?> <playlist version='1' xmlns='http://xspf.org/ns/0/'> <title>Multimedia</title> <trackList> END; // loop through the array to build the track foreach($items as $key => $value) { $title = substr($key, 0, strlen($key) - 4); print <<<END <track> <creator>$creator</creator> <title>$title</title> <location>$url/$key</location> </track> END; } // closing tags print <<<END </trackList> </playlist> END; ?>

Rispondi quotando