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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
|
<?php
case "add":
if(isset($_POST['submit']) AND "Titel bearbeiten" == $_POST['submit']) {
echo "<form ".
"action=\"index.php?section=admin&site=news&action=add\" ".
"method=\"post\" ".
"class=\"formular\">\n";
echo " <p>\n";
echo " Titel bearbeiten\n";
echo " </p>\n";
echo " <ol>\n";
echo " <li>\n";
echo " <label for=\"titel\">Titel</label>\n";
echo " <input type=\"text\" ".
"id=\"titel\" ".
"name=\"titel\" ".
"value=\"".$_SESSION['titel']."\" />\n";
echo " </li>\n";
echo " <li>\n";
echo " <input type=\"submit\" name=\"submit\" value=\"Titel speichern\" />\n";
echo " <input type=\"reset\" name=\"submit\" value=\"Zurücksetzen\" />\n";
echo " <input type=\"hidden\" name=\"".session_name()."\" value=\"".session_id()."\" />\n";
echo " </li>\n";
echo " </ol>\n";
echo "</form>\n";
back2admin();
} elseif(isset($_POST['submit']) AND "Text bearbeiten" == $_POST['submit']) {
echo "<form ".
"action=\"index.php?section=admin&site=news&action=add\" ".
"method=\"post\" ".
"class=\"formular\">\n";
echo " <p>\n";
echo " Text bearbeiten\n";
echo " </p>\n";
echo " <ol>\n";
echo " <li>\n";
echo " <label for=\"text\">Text</label>\n";
echo " <textarea id=\"text\" name=\"text\" cols=\"60\" rows=\"10\">\n";
echo htmlspecialchars($_SESSION['text']);
echo " </textarea>\n";
echo " </li>\n";
echo " <li>\n";
echo " <input type=\"submit\" name=\"submit\" value=\"Text speichern\" />\n";
echo " <input type=\"reset\" name=\"submit\" value=\"Zurücksetzen\" />\n";
echo " <input type=\"hidden\" name=\"".session_name()."\" value=\"".session_id()."\" />\n";
echo " </li>\n";
echo " </ol>\n";
echo "</form>\n";
back2admin();
} elseif(isset($_POST['submit']) AND "Link hinzufügen" == $_POST['submit']) {
echo "<form ".
"action=\"index.php?section=admin&site=news&action=add\" ".
"method=\"post\" ".
"class=\"formular\">\n";
echo " <p>\n";
echo " Link hinzufügen\n";
echo " </p>\n";
echo " <ol>\n";
echo " <li>\n";
echo " <label for=\"link\">Link</label>\n";
echo " <input type=\"text\" id=\"link\" name=\"link\" />\n";
echo " </li>\n";
echo " <li>\n";
echo " <label for=\"beschreibung\">Beschreibung</label>\n";
echo " <input type=\"text\" id=\"beschreibung\" name=\"beschreibung\" />\n";
echo " </li>\n";
echo " <li>\n";
echo " <input type=\"submit\" name=\"submit\" value=\"Link speichern\" />\n";
echo " <input type=\"reset\" name=\"submit\" value=\"Zurücksetzen\" />\n";
echo " <input type=\"hidden\" name=\"".session_name()."\" value=\"".session_id()."\" />\n";
echo " </li>\n";
echo " </ol>\n";
echo "</form>\n";
back2admin();
} else {
if(isset($_POST['submit']) AND "Link speichern" == $_POST['submit']) {
$_SESSION['links'][] = array('link' => trim($_POST['link']),
'beschreibung' => trim($_POST['beschreibung']));
}
if(isset($_POST['submit']) AND "Text speichern" == $_POST['submit']) {
$_SESSION['text'] = trim($_POST['text']);
}
if(isset($_POST['submit']) AND "Titel speichern" == $_POST['submit']) {
$_SESSION['titel'] = trim($_POST['titel']);
}
if(isset($_POST['submit']) AND "Markierte Links löschen" == $_POST['submit']) {
if(isset($_POST['link'])) {
foreach($_POST['link'] as $value) {
unset($_SESSION['links'][$value]);
}
}
}
if(!isset($_SESSION['titel'])) {
$_SESSION['titel'] = "";
}
if(!isset($_SESSION['text'])) {
$_SESSION['text'] = "";
}
if(!isset($_SESSION['links'])) {
$_SESSION['links'] = array();
}
echo "<form ".
"action=\"index.php?section=admin&site=news&action=add\" ".
"method=\"post\" ".
"class=\"formular\">\n";
echo " <p>\n";
echo " Neue News hinzufügen.\n";
echo " </p>\n";
echo " <ol>\n";
echo " <li>\n";
echo " Titel:\n";
echo " <ul>\n";
echo " <li>\n";
echo $_SESSION['titel']."\n";
echo " </li>\n";
echo " <li>\n";
echo " <input type=\"submit\" name=\"submit\" value=\"Titel bearbeiten\" />\n";
echo " </li>\n";
echo " </ul>\n";
echo " </li>\n";
echo " <li>\n";
echo " Text:\n";
echo " <ul>\n";
echo " <li>\n";
echo nl2br($_SESSION['text'])."\n";
echo " </li>\n";
echo " <li>\n";
echo " <input type=\"submit\" name=\"submit\" value=\"Text bearbeiten\" />\n";
echo " </li>\n";
echo " </ul>\n";
echo " </li>\n";
echo " <li>\n";
echo " Links zu den News:\n";
echo " <ul>\n";
if(count($_SESSION['links'])) {
foreach($_SESSION['links'] as $key => $value) {
echo "<li>\n";
echo " <input type=\"checkbox\" name=\"link[]\" value=\"".$key."\" />\n";
echo $value['beschreibung']."<br />\n";
echo $value['link']."\n";
echo "</li>\n";
}
} else {
echo "<li>\n";
echo " Keine Links vorhanden\n";
echo "</li>\n";
}
echo " <li>\n";
echo " <input type=\"submit\" name=\"submit\" value=\"Link hinzufügen\" />\n";
if(count($_SESSION['links'])) {
echo "<input type=\"submit\" name=\"submit\" value=\"Markierte Links löschen\" />\n";
}
echo " </li>\n";
echo " </ul>\n";
echo " </li>\n";
echo " <li>\n";
echo " <input type=\"submit\" name=\"submit\" value=\"News hinzufügen\" />\n";
echo " <input type=\"reset\" name=\"submit\" value=\"Zurücksetzen\" />\n";
echo " <input type=\"hidden\" name=\"".session_name()."\" value=\"".session_id()."\" />\n";
echo " </li>\n";
echo " </ol>\n";
echo "</form>\n";
back2admin();
}
break;
?>
|