-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtemp.php
More file actions
57 lines (47 loc) · 1.87 KB
/
temp.php
File metadata and controls
57 lines (47 loc) · 1.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<!DOCTYPE html>
<html>
<head>
<title>web-mp3 player</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="test.css">
<script src="test.js" type="text/javascript">
</script>
</head>
<body>
<p> MP3 Web Player </p>
<?php populateMusic(); ?>
</body>
</html>
<?php
function populateMusic(){
$dir = "music"; //where the tunes at?
//HTML foundation....
echo "<audio id=\"webplayerCore\" controls>
<source id=\"webplayerSource\" src=\"highlights.mp3\" type=\"audio/mpeg\">
Your browser doesn't support HTML 5 Audio Elements. You should upgrade!
</audio>
<ol>";
if(is_dir($dir)){ //is it a directory?
if($dh = opendir($dir)){ //can we open this directory? If so, create direcotry handle
while(($file = readdir($dh)) !== false){ //while there are files in the directory...
if($file != "." && $file != "..")// . and .. aren't "real" files, at least for our purposes!
echo "<li onclick=\"updateSource(this);\" data-track=\"".$dir."/".$file."\">".$file."</li> \n \t"; //print out each file name wrapped in HTML :)
}
closedir($dh);//readdir($dh) is returning false; close this directory MAFACKA! HahhhhNN?
}
}
//don't forget to close that ordered list ;)
echo "</ol>";
}//end populateMusic();
function listDir($dir){
if(is_dir($dir)){ //is it a directory?
if($dh = opendir($dir)){ //can we open this directory? If so, create direcotry handle
while(($file = readdir($dh)) !== false){ //while there are files in the directory...
if($file != "." && $file != "..")// . and .. aren't "real" files, at least for our purposes!
echo "filename:".$file."<br>"; //print out each file name wrapped in HTML :)
}
closedir($dh);//readdir($dh) is returning false; close this directory MAFACKA! HahhhhNN?
}
}
}//end listDir($dir);
?>