-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
52 lines (32 loc) · 882 Bytes
/
index.php
File metadata and controls
52 lines (32 loc) · 882 Bytes
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
<?php
error_reporting(E_ALL);
include "autoload.php";
use Controller\LightShowController;
// Todo: Start coding here
$ctrl = new LightShowController();
switch ($_GET["action"]) {
case "play":
$ctrl->playPlaylist();
break;
case "add":
echo "add";
$song = $_GET["song"];
$ctrl->addToPlaylist($song, $song);
echo "Added $song to playlist<br>";
break;
}
?>
<a href="?action=play">play playlist</a>
<form action="index.php" method="get">
Add song to playlist:
<select name="song">
<?php
foreach ($ctrl->getSongs() as $song) {
echo "<option value='$song'>$song</option>";
}
?>
</select>
<button type="submit" name="action" value="add" >add</button>
<p>Songs in playlist</p>
<pre><?php echo $ctrl->getPlaylistContent(); ?></pre>
</form>