/
playlistedit.php
executable file
·79 lines (62 loc) · 1.57 KB
/
playlistedit.php
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<?php
require_once "./klassen/authentication.class.php";
require_once "./config.php";
require_once "./klassen/datenbank.class.php";
require_once "./klassen/playlist.class.php";
$datenbank = new Datenbank();
$playlist = new TPlaylist();
$playlist->ladePlaylist($datenbank);
if (!isset($_GET["action"])) {
die("Keine Aktion :/");
}
switch ($_GET["action"]) {
case "up":
nachOben($playlist, $datenbank);
break;
case "down":
nachUnten($playlist, $datenbank);
break;
case "delete":
loeschen($playlist, $datenbank);
break;
case "add":
hinzufuegen($playlist, $datenbank);
break;
}
function nachOben($playlist, $datenbank) {
if (isset($_GET["index"]) && is_numeric($_GET["index"])) {
$playlist->nachOben($_GET["index"], $datenbank);
zurueck();
} else {
echo "Kein oder ungültiger Index :/";
}
}
function nachUnten($playlist, $datenbank) {
if (isset($_GET["index"]) && is_numeric($_GET["index"])) {
$playlist->nachUnten($_GET["index"], $datenbank);
zurueck();
} else {
echo "Kein oder ungültiger Index :/";
}
}
function loeschen($playlist, $datenbank) {
if (isset($_GET["id"]) && is_numeric($_GET["id"])) {
$playlist->loeschen($_GET["id"], $datenbank);
zurueck();
} else {
echo "Keine oder ungültige Id :/";
}
}
function hinzufuegen($playlist, $datenbank) {
if (isset($_POST["modulId"]) && is_numeric($_POST["modulId"])) {
$playlist->hinzufuegen($_POST["modulId"], $datenbank);
zurueck();
} else {
echo "Keine oder ungültige Id :/";
}
}
function zurueck() {
global $config;
header("Location: /" . $config["rootDir"]);
}
?>