Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
- <?php
- header('Content-type: text/html; charset=utf-8');
- mb_internal_encoding('UTF-8');
- mb_http_output('UTF-8');
- mb_http_input('UTF-8');
- if(!isset($_GET['loc'])){
- $DIR = "G:/Musikk/";
- }else{
- $DIR = "G:/Musikk/".$_GET['loc']."/";
- }
- $illegal = ["Audacity", "Spillelister", 'cgi-bin', '.', '..','._'];
- $legalExtension = ["mp3", "MP3", "", "m4a", "wav", "wma"];
- $OIR = "/musicdir/";
- $back = substr($_GET['loc'], 0, strrpos($_GET['loc'], "/"));
- $files = preg_grep('/^([^.])/', scandir($DIR));
- $Directories = [];
- $MP3 = [];
- $Others = [];
- if (strpos($_GET['loc'],'../') !== false) :
- echo 'Illegal';
- else :
- foreach($files as $file){
- $file = iconv(mb_detect_encoding($file, mb_detect_order(), true), 'utf-8', $file);
- if(!in_array($file, $illegal)){
- if(in_array(pathinfo($file, PATHINFO_EXTENSION), $legalExtension)){
- if(is_dir($DIR.$file)){
- array_push($Directories, $file);
- }else{
- switch(pathinfo($file, PATHINFO_EXTENSION)){
- case "mp3":
- case "MP3":
- case "m4a":
- array_push($MP3, $file);
- break;
- default:
- array_push($Others, $file);
- }
- }
- }
- }
- }
- echo "<a href='/musictest.php?loc=".$back."'>Back</a>";
- if(!$Directories == []){echo "<br><br>Directories:";
- if(!isset($_GET['loc'])){
- foreach ($Directories as $Dirs){echo "<br><a href=\"/musictest.php?loc=".$Dirs."\">".$Dirs."</a>";}
- }else{
- foreach ($Directories as $Dirs){echo "<br><a href=\"/musictest.php?loc=".$_GET['loc']."/".$Dirs."\">".$Dirs."</a>";}
- }
- }else{
- echo "<br>";
- }
- echo "<br>";
- if(isset($_GET['loc']) && $Others !== []){displayOthers($_GET['loc'], $Others);}
- if(isset($_GET['loc']) && $MP3 !== []){displayMusic($_GET['loc'], $MP3);}
- endif;
- function displayOthers($loc, $Filepahts){
- echo "<br>Unstreamable files:";
- foreach ($Filepahts as $SingleFile){
- echo '<br><a target="_blank" href="/musicdir/'.$loc.'/'.$SingleFile.'">'.$SingleFile."</a>";
- }
- echo "<br>";
- }
- function displayMusic($loc, $Filepaths){
- echo "<br>Streamable files:";
- echo '
- <br><br>
- <link href="/tools/jPlayer-2.9.2/dist/skin/blue.monday/css/jplayer.blue.monday.min.css" rel="stylesheet" type="text/css" />
- <script type="text/javascript" src="/tools/jPlayer-2.9.2/lib/jquery.min.js"></script>
- <script type="text/javascript" src="/tools/jPlayer-2.9.2/dist/jplayer/jquery.jplayer.min.js"></script>
- <script type="text/javascript" src="/tools/jPlayer-2.9.2/dist/add-on/jplayer.playlist.min.js"></script>
- <script type="text/javascript">
- //<![CDATA[
- $(document).ready(function(){
- new jPlayerPlaylist({
- jPlayer: "#jquery_jplayer_1",
- cssSelectorAncestor: "#jp_container_1"
- }, [
- ';
- foreach ($Filepaths as $Path){
- echo '{
- title:"'.$Path.'",
- free:true,
- '.pathinfo($Path, PATHINFO_EXTENSION).':"/musicdir/'.$loc."/".$Path.'"
- },';
- }
- echo '
- ], {
- swfPath: "/tools/jPlayer-2.9.2/dist/jplayer",
- supplied: "mp3,m4a,wav",
- wmode: "window",
- useStateClassSkin: true,
- autoBlur: false,
- smoothPlayBar: true,
- keyEnabled: true
- });
- });
- //]]>
- </script>
- <div id="jquery_jplayer_1" class="jp-jplayer"></div>
- <div id="jp_container_1" class="jp-audio" role="application" aria-label="media player">
- <div class="jp-type-playlist">
- <div class="jp-gui jp-interface">
- <div class="jp-controls">
- <button class="jp-previous" role="button" tabindex="0">previous</button>
- <button class="jp-play" role="button" tabindex="0">play</button>
- <button class="jp-next" role="button" tabindex="0">next</button>
- <button class="jp-stop" role="button" tabindex="0">stop</button>
- </div>
- <div class="jp-progress">
- <div class="jp-seek-bar">
- <div class="jp-play-bar"></div>
- </div>
- </div>
- <div class="jp-volume-controls">
- <button class="jp-mute" role="button" tabindex="0">mute</button>
- <button class="jp-volume-max" role="button" tabindex="0">max volume</button>
- <div class="jp-volume-bar">
- <div class="jp-volume-bar-value"></div>
- </div>
- </div>
- <div class="jp-time-holder">
- <div class="jp-current-time" role="timer" aria-label="time"> </div>
- <div class="jp-duration" role="timer" aria-label="duration"> </div>
- </div>
- <div class="jp-toggles">
- <button class="jp-repeat" role="button" tabindex="0">repeat</button>
- <button class="jp-shuffle" role="button" tabindex="0">shuffle</button>
- </div>
- </div>
- <div class="jp-playlist">
- <ul>
- <li> </li>
- </ul>
- </div>
- <div class="jp-no-solution">
- <span>Update Required</span>
- To play the media you will need to either update your browser to a recent version or update your <a href="http://get.adobe.com/flashplayer/" target="_blank">Flash plugin</a>.
- </div>
- </div>
- </div>
- ';
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement