Simple Showcenter 1000 Server with Apache

File and Directory Structure

index.php
./tmp
./media/video
./media/music
./media/picture

index.php

<html>
<body>
<a href="http://[IP-Address]:[Port]">Refresh</a><br>
<?php
 
error_reporting(E_ALL);
ini_set('display_errors', TRUE);
 
function get_media($dir) {
$files = array();
  if ($handle = opendir($dir)) {
    while (false !== ($file = readdir($handle))) {
      if ($file != "." && $file != "..") {
        if (is_dir("$dir/$file")) {
          $files = array_merge($files, get_media("$dir/$file"));
        } else {
          $files[] = ("$dir/$file");
        }
      }
    }
    closedir($handle);
  }
  asort($files);
  return $files;
}
 
# $current_path = dirname(__FILE__);
# $dir = $current_path."/media";

$dir = "media";
 
$media = get_media($dir);
 
foreach ($media as $value) {
    $file = md5($value);
    $handle = fopen("tmp/".$file,"w");
    fwrite($handle,"|0|0|[IP-Address]:[Port]/".$value."| + #13#10");
    ?>
    <br>
    <a href="tmp/<?php echo $file; ?>" vod="playlist"><?php echo $value; ?></a>
    <?php
}
 
?>
</body>
</html>