admin eruithalen
Code (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
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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
<?php
$actie = $_GET['actie'];
$reactie = $_GET['reactie'];
echo "<script type=\"text/javascript\" src=\"images/javascript.js\"></script>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"images/style.css\">";
// Tabel
echo "<center>\n";
echo "<table class=\"listtable\" cellspacing=\"1\" width=\"75%\">\n";
echo "<tr>\n";
echo "<td class=\"listtop\" colSpan=\"1\" width=\"100%\" style=\"background-color: #E6E6E6\">\n\n";
echo "<b>Administratie:</b> (<a href=\"uitloggen.php\">uitloggen</a>)</td></tr>\n\n";
echo "<tr class=\"list1\">\n";
echo "<td class=\"list1\" width=\"100%\">";
// Database connectie toevoegen
include("database.inc.php");
function date_format($tijd, $jaar = false)
{
$dagen_array = array("Zondag", "Maandag", "Dinsdag", "Woensdag", "Donderdag", "Vrijdag", "Zaterdag");
$maand_array = array("Januari", "Februari", "Maart", "April", "Mei", "Juni", "Juli", "Augustus", "September", "Oktober", "November", "December");
if(!$jaar)
$datum = $dagen_array[date("w", $tijd)] . " " . date("j", $tijd) . " " . $maand_array[(date("n", $tijd) - 1)];
else
$datum = $dagen_array[date("w", $tijd)] . " " . date("j", $tijd) . " " . $maand_array[(date("n", $tijd) - 1)] . " " . date("Y", $tijd);
return $datum;
}
$tijd = time();
$datum = date_format($tijd);
// *** INLOGGEN *** //
if(($_POST['username'] == "". $user ."") && ($_POST['password'] == "". $pass .""))
{
$_SESSION['username'] = $_POST['username'];
$_SESSION['password'] = $_POST['password'];
}
if(($_SESSION['username'] == "". $user ."") && ($_SESSION['password'] == "". $pass .""))
{
// *** NIEUWS-ADMIN VERWIJDEREN *** //
if ($actie == "verwijderen") {
$delete = "DELETE FROM nieuws WHERE id = '".$_GET['id']."'";
mysql_query($delete) or die(mysql_error());
echo "<meta http-equiv=\"refresh\" content=\"0;URL=admin.php\">";
}
// *** REACTIE-ADMIN VERWIJDEREN *** //
if ($reactie == "verwijderen") {
$delete = "DELETE FROM reacties WHERE id = '".$_GET['id']."'";
mysql_query($delete) or die(mysql_error());
echo "<meta http-equiv=\"refresh\" content=\"0;URL=admin.php\">";
}
// *** NIEUWS-ADMIN TOEVOEGEN *** //
elseif ($actie == "toevoegen") {
if ($_POST['toevoegen']) {
mysql_query ("INSERT INTO nieuws (id,titel,auteur,datum,nieuws) VALUES ('','".$_POST["titel"]."','".$_POST["auteur"]."','". $datum . "','".$_POST["nieuws"]."')") or die (mysql_error ());
echo "<meta http-equiv=\"refresh\" content=\"0;URL=admin.php\">";
}
// Anti Flood
if($_SESSION[tijd] + $verlooptijd > time()){
echo "Je kunt maar 1 bericht plaatsen om de 30 seconden!";
$tijd = time();
session_register("tijd");
} else{
echo "<form name=\"form\" method=\"POST\">\n";
echo "<input type=hidden name=bewerken value=1>\n";
echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">\n";
echo "<tr>\n";
echo "<td width=\"100%\" colspan=\"2\"><b>Nieuws Toevoegen</b><br><br></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td width=\"50%\">Auteur:</td>\n";
echo "<td width=\"50%\"><input type=\"text\" name=\"auteur\" size=\"20\"></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td width=\"50%\">Titel:</td>\n";
echo "<td width=\"50%\"><input type=\"text\" name=\"titel\" size=\"20\"></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td width=\"50%\">Nieuws:</td>\n";
echo "<td width=\"50%\">\n";
// BB Buttons
echo "<input type=\"button\" value=\"B\" style=\"font-weight:bold; width: 30px\" onClick=\"javascript:addtext('nieuws','[b] [/b]')\">\n";
echo "<input type=\"button\" value=\"i\" style=\"font-style:italic; width: 30px\" onClick=\"javascript:addtext('nieuws','[i] [/i]')\">\n";
echo "<input type=\"button\" value=\"u\" style=\"text-decoration: underline; width: 30px\" onClick=\"javascript:addtext('nieuws','[u] [/u]')\">\n";
echo "<input type=\"button\" value=\"Link\" onClick=\"javascript:addtext('nieuws','[url=] [/url]')\">\n";
echo "<input type=\"button\" value=\"Figuur\" onClick=\"javascript:addtext('nieuws','[img] [/img]')\">\n";
echo "<br><textarea rows=\"13\" name=\"nieuws\" cols=\"41\"></textarea></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td width=\"50%\"> </td>\n";
echo "<td width=\"50%\">\n";
// Smilies
echo "<a href=\"javascript:addtext('nieuws',':)')\"><img border=\"0\" src=\"images/smilies/icon_razz.gif\" width=\"15\" height=\"15\"></a>\n";
echo "<a href=\"javascript:addtext('nieuws',':D')\"><img border=\"0\" src=\"images/smilies/icon_biggrin.gif\" width=\"15\" height=\"15\"></a>\n";
echo "<a href=\"javascript:addtext('nieuws',':B')\"><img border=\"0\" src=\"images/smilies/icon_cool.gif\" width=\"15\" height=\"15\"></a>\n";
echo "<a href=\"javascript:addtext('nieuws',':S')\"><img border=\"0\" src=\"images/smilies/icon_confused.gif\" width=\"15\" height=\"15\"></a>\n";
echo "<a href=\"javascript:addtext('nieuws',':(')\"><img border=\"0\" src=\"images/smilies/icon_cry.gif\" width=\"15\" height=\"15\"></a>\n";
echo "<a href=\"javascript:addtext('nieuws',':|')\"><img border=\"0\" src=\"images/smilies/icon_neutral.gif\" width=\"15\" height=\"15\"></a>\n";
echo "<a href=\"javascript:addtext('nieuws',':O')\"><img border=\"0\" src=\"images/smilies/icon_eek.gif\" width=\"15\" height=\"15\"></a>\n";
echo "<br><input type=\"submit\" value=\"Toevoegen\" name=\"toevoegen\"></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td width=\"100%\" colspan=\"2\"><a href=\"javascript.history.go(-1);\">Ga terug</a></td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "</form>\n";
}
}
// *** NIEUWS-ADMIN BEWERKEN *** //
elseif (isset($_GET["id"]) && is_numeric($_GET["id"])) {
if ($_POST['bewerken']) {
$update = "UPDATE nieuws SET auteur = '" . $auteur . "', titel = '" . $titel . "', nieuws = '" . $nieuws . "' WHERE id = '". $_GET['id'] ."'";
mysql_query($update) or die(mysql_error());
echo "<meta http-equiv=\"refresh\" content=\"0;URL=admin.php\">";
}
// Gegevens uit de database ophalen
$select = "SELECT * FROM nieuws WHERE id = '". $_GET['id'] ."' ORDER by id DESC";
$sql = mysql_query($select) or die(mysql_error());
// Gegevens laten zien met een while
while($GET = mysql_fetch_assoc($sql))
{
echo "<form name=\"form\" method=\"POST\" action=\"\">\n";
echo "<input type=hidden name=bewerken value=1>\n";
echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">\n";
echo "<tr>\n";
echo "<td width=\"100%\" colspan=\"2\"><b>Nieuws bewerken</b><br><br></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td width=\"50%\">Auteur:</td>\n";
echo "<td width=\"50%\"><input type=\"text\" name=\"auteur\" size=\"20\" value=\"". $GET['auteur'] ."\"></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td width=\"50%\">Titel:</td>\n";
echo "<td width=\"50%\"><input type=\"text\" name=\"titel\" size=\"20\" value=\"". $GET['titel'] ."\"></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td width=\"50%\">Nieuws:</td>\n";
echo "<td width=\"50%\">\n";
// BB Buttons
echo "<input type=\"button\" value=\"B\" style=\"font-weight:bold; width: 30px\" onClick=\"javascript:addtext('nieuws','[b] [/b]')\">\n";
echo "<input type=\"button\" value=\"i\" style=\"font-style:italic; width: 30px\" onClick=\"javascript:addtext('nieuws','[i] [/i]')\">\n";
echo "<input type=\"button\" value=\"u\" style=\"text-decoration: underline; width: 30px\" onClick=\"javascript:addtext('nieuws','[u] [/u]')\">\n";
echo "<input type=\"button\" value=\"Link\" onClick=\"javascript:addtext('nieuws','[url=] [/url]')\">\n";
echo "<input type=\"button\" value=\"Figuur\" onClick=\"javascript:addtext('nieuws','[img] [/img]')\">\n";
echo "<br><textarea rows=\"13\" name=\"nieuws\" cols=\"41\">". $GET['nieuws'] ."</textarea></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td width=\"50%\"> </td>\n";
echo "<td width=\"50%\">\n";
// Smilies
echo "<a href=\"javascript:addtext('nieuws',':)')\"><img border=\"0\" src=\"images/smilies/icon_razz.gif\" width=\"15\" height=\"15\"></a>\n";
echo "<a href=\"javascript:addtext('nieuws',':D')\"><img border=\"0\" src=\"images/smilies/icon_biggrin.gif\" width=\"15\" height=\"15\"></a>\n";
echo "<a href=\"javascript:addtext('nieuws',':B')\"><img border=\"0\" src=\"images/smilies/icon_cool.gif\" width=\"15\" height=\"15\"></a>\n";
echo "<a href=\"javascript:addtext('nieuws',':S')\"><img border=\"0\" src=\"images/smilies/icon_confused.gif\" width=\"15\" height=\"15\"></a>\n";
echo "<a href=\"javascript:addtext('nieuws',':(')\"><img border=\"0\" src=\"images/smilies/icon_cry.gif\" width=\"15\" height=\"15\"></a>\n";
echo "<a href=\"javascript:addtext('nieuws',':|')\"><img border=\"0\" src=\"images/smilies/icon_neutral.gif\" width=\"15\" height=\"15\"></a>\n";
echo "<a href=\"javascript:addtext('nieuws',':O')\"><img border=\"0\" src=\"images/smilies/icon_eek.gif\" width=\"15\" height=\"15\"></a>\n";
echo "<br><input type=\"submit\" value=\"Bewerken\" name=\"bewerk\"></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td width=\"100%\" colspan=\"2\"><a href=\"javascript.history.go(-1);\">Ga terug</a></td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "</form>\n";
}
} else {
// *** NIEUWS-ADMIN INDEX *** //
// Gegevens uit de database ophalen
$select = "SELECT * FROM nieuws ORDER by id DESC";
$sql = mysql_query($select) or die(mysql_error());
// Tabel
echo "<a href=\"admin.php?actie=toevoegen\">Nieuwsbericht toevoegen</a><br><br>";
echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">\n";
echo "<tr>\n";
echo "<td width=\"100%\" colspan=\"3\"><b>Pagina's bewerken</b></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td width=\"100%\" colspan=\"3\"> </td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td width=\"34%\"><b>Titel</b></td>\n";
echo "<td width=\"33%\"><b>Auteur</b></td>\n";
echo "<td width=\"33%\"><b>Datum</b></td>\n";
echo "</tr>\n";
if(empty($sql)) {
echo "<tr>\n";
echo "<td width=\"34%\">\n";
echo "Er zijn geen nieuwsberichten</td>\n";
echo "<td width=\"33%\"></td>\n";
echo "<td width=\"33%\"></td>\n";
echo "</tr>\n";
} else {
// Gegevens laten zien met een while
while($GET = mysql_fetch_assoc($sql))
{
echo "<tr>\n";
echo "<td width=\"34%\">\n";
echo "<a href=\"admin.php?actie=verwijderen&id=". $GET['id'] ."\"><img alt=\"Verwijderen\" border=\"0\" src=\"images/icon.verwijder.gif\" width=\"12\" height=\"12\"></a> <a href=\"admin.php?bewerken=nieuws&id=". $GET['id'] ."\">". $GET['titel'] ."</a></td>\n";
echo "<td width=\"33%\">". $GET['auteur'] ."</td>\n";
echo "<td width=\"33%\">". $GET['datum'] ."</td>\n";
echo "</tr>\n";
}
}
// *** REACTIES-ADMIN INDEX *** //
// Gegevens uit de database ophalen
$select = "SELECT * FROM reacties ORDER by id DESC";
$sql = mysql_query($select) or die(mysql_error());
// Tabel
echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">\n";
echo "<tr>\n";
echo "<td width=\"100%\" colspan=\"3\"><br><br><b>Reacties</b></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td width=\"100%\" colspan=\"3\"> </td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td width=\"34%\"><b>Door</b></td>\n";
echo "<td width=\"33%\"><b>Ip</b></td>\n";
echo "<td width=\"33%\"><b>Datum</b></td>\n";
echo "</tr>\n";
if(empty($sql)) {
echo "<tr>\n";
echo "<td width=\"34%\">\n";
echo "Er zijn geen reacties</td>\n";
echo "<td width=\"33%\"></td>\n";
echo "<td width=\"33%\"></td>\n";
echo "</tr>\n";
} else {
// Gegevens laten zien met een while
while($GET = mysql_fetch_assoc($sql))
{
echo "<tr>\n";
echo "<td width=\"34%\">\n";
echo "<a href=\"admin.php?reactie=verwijderen&id=". $GET['id'] ."\"><img alt=\"Verwijderen\" border=\"0\" src=\"images/icon.verwijder.gif\" width=\"12\" height=\"12\"></a>". $GET['naam'] ."</td>\n";
echo "<td width=\"33%\">". $GET['ip'] ."</td>\n";
echo "<td width=\"33%\">". $GET['datum'] ."</td>\n";
echo "</tr>\n";
}
}
// Einde Tabel
echo "</table>\n";
}
} else {
echo "<center>";
echo "<form method=\"POST\" action=\"\">";
echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"50%\">";
echo " <tr>";
echo " <td width=\"100%\" colspan=\"2\"><b>Administratie</b></td>";
echo " </tr>";
echo " <tr>";
echo " <td width=\"50%\">Gebruikersnaam:</td>";
echo " <td width=\"50%\"><input type=\"text\" name=\"username\" size=\"20\"></td>";
echo " </tr>";
echo " <tr>";
echo " <td width=\"50%\">Wachtwoord:</td>";
echo " <td width=\"50%\"><input type=\"text\" name=\"password\" size=\"20\"></td>";
echo " </tr>";
echo " <tr>";
echo " <td width=\"50%\"> </td>";
echo " <td width=\"50%\"><input type=\"submit\" value=\"Inloggen\" name=\"submit\"></td>";
echo " </tr>";
echo "</table>";
echo "</form>";
echo "</center>";
}
echo "</td>\n";
echo "</tr>\n\n";
// Einde Tabel
echo "</table>\n";
echo "</center>";
?>
$actie = $_GET['actie'];
$reactie = $_GET['reactie'];
echo "<script type=\"text/javascript\" src=\"images/javascript.js\"></script>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"images/style.css\">";
// Tabel
echo "<center>\n";
echo "<table class=\"listtable\" cellspacing=\"1\" width=\"75%\">\n";
echo "<tr>\n";
echo "<td class=\"listtop\" colSpan=\"1\" width=\"100%\" style=\"background-color: #E6E6E6\">\n\n";
echo "<b>Administratie:</b> (<a href=\"uitloggen.php\">uitloggen</a>)</td></tr>\n\n";
echo "<tr class=\"list1\">\n";
echo "<td class=\"list1\" width=\"100%\">";
// Database connectie toevoegen
include("database.inc.php");
function date_format($tijd, $jaar = false)
{
$dagen_array = array("Zondag", "Maandag", "Dinsdag", "Woensdag", "Donderdag", "Vrijdag", "Zaterdag");
$maand_array = array("Januari", "Februari", "Maart", "April", "Mei", "Juni", "Juli", "Augustus", "September", "Oktober", "November", "December");
if(!$jaar)
$datum = $dagen_array[date("w", $tijd)] . " " . date("j", $tijd) . " " . $maand_array[(date("n", $tijd) - 1)];
else
$datum = $dagen_array[date("w", $tijd)] . " " . date("j", $tijd) . " " . $maand_array[(date("n", $tijd) - 1)] . " " . date("Y", $tijd);
return $datum;
}
$tijd = time();
$datum = date_format($tijd);
// *** INLOGGEN *** //
if(($_POST['username'] == "". $user ."") && ($_POST['password'] == "". $pass .""))
{
$_SESSION['username'] = $_POST['username'];
$_SESSION['password'] = $_POST['password'];
}
if(($_SESSION['username'] == "". $user ."") && ($_SESSION['password'] == "". $pass .""))
{
// *** NIEUWS-ADMIN VERWIJDEREN *** //
if ($actie == "verwijderen") {
$delete = "DELETE FROM nieuws WHERE id = '".$_GET['id']."'";
mysql_query($delete) or die(mysql_error());
echo "<meta http-equiv=\"refresh\" content=\"0;URL=admin.php\">";
}
// *** REACTIE-ADMIN VERWIJDEREN *** //
if ($reactie == "verwijderen") {
$delete = "DELETE FROM reacties WHERE id = '".$_GET['id']."'";
mysql_query($delete) or die(mysql_error());
echo "<meta http-equiv=\"refresh\" content=\"0;URL=admin.php\">";
}
// *** NIEUWS-ADMIN TOEVOEGEN *** //
elseif ($actie == "toevoegen") {
if ($_POST['toevoegen']) {
mysql_query ("INSERT INTO nieuws (id,titel,auteur,datum,nieuws) VALUES ('','".$_POST["titel"]."','".$_POST["auteur"]."','". $datum . "','".$_POST["nieuws"]."')") or die (mysql_error ());
echo "<meta http-equiv=\"refresh\" content=\"0;URL=admin.php\">";
}
// Anti Flood
if($_SESSION[tijd] + $verlooptijd > time()){
echo "Je kunt maar 1 bericht plaatsen om de 30 seconden!";
$tijd = time();
session_register("tijd");
} else{
echo "<form name=\"form\" method=\"POST\">\n";
echo "<input type=hidden name=bewerken value=1>\n";
echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">\n";
echo "<tr>\n";
echo "<td width=\"100%\" colspan=\"2\"><b>Nieuws Toevoegen</b><br><br></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td width=\"50%\">Auteur:</td>\n";
echo "<td width=\"50%\"><input type=\"text\" name=\"auteur\" size=\"20\"></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td width=\"50%\">Titel:</td>\n";
echo "<td width=\"50%\"><input type=\"text\" name=\"titel\" size=\"20\"></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td width=\"50%\">Nieuws:</td>\n";
echo "<td width=\"50%\">\n";
// BB Buttons
echo "<input type=\"button\" value=\"B\" style=\"font-weight:bold; width: 30px\" onClick=\"javascript:addtext('nieuws','[b] [/b]')\">\n";
echo "<input type=\"button\" value=\"i\" style=\"font-style:italic; width: 30px\" onClick=\"javascript:addtext('nieuws','[i] [/i]')\">\n";
echo "<input type=\"button\" value=\"u\" style=\"text-decoration: underline; width: 30px\" onClick=\"javascript:addtext('nieuws','[u] [/u]')\">\n";
echo "<input type=\"button\" value=\"Link\" onClick=\"javascript:addtext('nieuws','[url=] [/url]')\">\n";
echo "<input type=\"button\" value=\"Figuur\" onClick=\"javascript:addtext('nieuws','[img] [/img]')\">\n";
echo "<br><textarea rows=\"13\" name=\"nieuws\" cols=\"41\"></textarea></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td width=\"50%\"> </td>\n";
echo "<td width=\"50%\">\n";
// Smilies
echo "<a href=\"javascript:addtext('nieuws',':)')\"><img border=\"0\" src=\"images/smilies/icon_razz.gif\" width=\"15\" height=\"15\"></a>\n";
echo "<a href=\"javascript:addtext('nieuws',':D')\"><img border=\"0\" src=\"images/smilies/icon_biggrin.gif\" width=\"15\" height=\"15\"></a>\n";
echo "<a href=\"javascript:addtext('nieuws',':B')\"><img border=\"0\" src=\"images/smilies/icon_cool.gif\" width=\"15\" height=\"15\"></a>\n";
echo "<a href=\"javascript:addtext('nieuws',':S')\"><img border=\"0\" src=\"images/smilies/icon_confused.gif\" width=\"15\" height=\"15\"></a>\n";
echo "<a href=\"javascript:addtext('nieuws',':(')\"><img border=\"0\" src=\"images/smilies/icon_cry.gif\" width=\"15\" height=\"15\"></a>\n";
echo "<a href=\"javascript:addtext('nieuws',':|')\"><img border=\"0\" src=\"images/smilies/icon_neutral.gif\" width=\"15\" height=\"15\"></a>\n";
echo "<a href=\"javascript:addtext('nieuws',':O')\"><img border=\"0\" src=\"images/smilies/icon_eek.gif\" width=\"15\" height=\"15\"></a>\n";
echo "<br><input type=\"submit\" value=\"Toevoegen\" name=\"toevoegen\"></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td width=\"100%\" colspan=\"2\"><a href=\"javascript.history.go(-1);\">Ga terug</a></td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "</form>\n";
}
}
// *** NIEUWS-ADMIN BEWERKEN *** //
elseif (isset($_GET["id"]) && is_numeric($_GET["id"])) {
if ($_POST['bewerken']) {
$update = "UPDATE nieuws SET auteur = '" . $auteur . "', titel = '" . $titel . "', nieuws = '" . $nieuws . "' WHERE id = '". $_GET['id'] ."'";
mysql_query($update) or die(mysql_error());
echo "<meta http-equiv=\"refresh\" content=\"0;URL=admin.php\">";
}
// Gegevens uit de database ophalen
$select = "SELECT * FROM nieuws WHERE id = '". $_GET['id'] ."' ORDER by id DESC";
$sql = mysql_query($select) or die(mysql_error());
// Gegevens laten zien met een while
while($GET = mysql_fetch_assoc($sql))
{
echo "<form name=\"form\" method=\"POST\" action=\"\">\n";
echo "<input type=hidden name=bewerken value=1>\n";
echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">\n";
echo "<tr>\n";
echo "<td width=\"100%\" colspan=\"2\"><b>Nieuws bewerken</b><br><br></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td width=\"50%\">Auteur:</td>\n";
echo "<td width=\"50%\"><input type=\"text\" name=\"auteur\" size=\"20\" value=\"". $GET['auteur'] ."\"></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td width=\"50%\">Titel:</td>\n";
echo "<td width=\"50%\"><input type=\"text\" name=\"titel\" size=\"20\" value=\"". $GET['titel'] ."\"></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td width=\"50%\">Nieuws:</td>\n";
echo "<td width=\"50%\">\n";
// BB Buttons
echo "<input type=\"button\" value=\"B\" style=\"font-weight:bold; width: 30px\" onClick=\"javascript:addtext('nieuws','[b] [/b]')\">\n";
echo "<input type=\"button\" value=\"i\" style=\"font-style:italic; width: 30px\" onClick=\"javascript:addtext('nieuws','[i] [/i]')\">\n";
echo "<input type=\"button\" value=\"u\" style=\"text-decoration: underline; width: 30px\" onClick=\"javascript:addtext('nieuws','[u] [/u]')\">\n";
echo "<input type=\"button\" value=\"Link\" onClick=\"javascript:addtext('nieuws','[url=] [/url]')\">\n";
echo "<input type=\"button\" value=\"Figuur\" onClick=\"javascript:addtext('nieuws','[img] [/img]')\">\n";
echo "<br><textarea rows=\"13\" name=\"nieuws\" cols=\"41\">". $GET['nieuws'] ."</textarea></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td width=\"50%\"> </td>\n";
echo "<td width=\"50%\">\n";
// Smilies
echo "<a href=\"javascript:addtext('nieuws',':)')\"><img border=\"0\" src=\"images/smilies/icon_razz.gif\" width=\"15\" height=\"15\"></a>\n";
echo "<a href=\"javascript:addtext('nieuws',':D')\"><img border=\"0\" src=\"images/smilies/icon_biggrin.gif\" width=\"15\" height=\"15\"></a>\n";
echo "<a href=\"javascript:addtext('nieuws',':B')\"><img border=\"0\" src=\"images/smilies/icon_cool.gif\" width=\"15\" height=\"15\"></a>\n";
echo "<a href=\"javascript:addtext('nieuws',':S')\"><img border=\"0\" src=\"images/smilies/icon_confused.gif\" width=\"15\" height=\"15\"></a>\n";
echo "<a href=\"javascript:addtext('nieuws',':(')\"><img border=\"0\" src=\"images/smilies/icon_cry.gif\" width=\"15\" height=\"15\"></a>\n";
echo "<a href=\"javascript:addtext('nieuws',':|')\"><img border=\"0\" src=\"images/smilies/icon_neutral.gif\" width=\"15\" height=\"15\"></a>\n";
echo "<a href=\"javascript:addtext('nieuws',':O')\"><img border=\"0\" src=\"images/smilies/icon_eek.gif\" width=\"15\" height=\"15\"></a>\n";
echo "<br><input type=\"submit\" value=\"Bewerken\" name=\"bewerk\"></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td width=\"100%\" colspan=\"2\"><a href=\"javascript.history.go(-1);\">Ga terug</a></td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "</form>\n";
}
} else {
// *** NIEUWS-ADMIN INDEX *** //
// Gegevens uit de database ophalen
$select = "SELECT * FROM nieuws ORDER by id DESC";
$sql = mysql_query($select) or die(mysql_error());
// Tabel
echo "<a href=\"admin.php?actie=toevoegen\">Nieuwsbericht toevoegen</a><br><br>";
echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">\n";
echo "<tr>\n";
echo "<td width=\"100%\" colspan=\"3\"><b>Pagina's bewerken</b></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td width=\"100%\" colspan=\"3\"> </td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td width=\"34%\"><b>Titel</b></td>\n";
echo "<td width=\"33%\"><b>Auteur</b></td>\n";
echo "<td width=\"33%\"><b>Datum</b></td>\n";
echo "</tr>\n";
if(empty($sql)) {
echo "<tr>\n";
echo "<td width=\"34%\">\n";
echo "Er zijn geen nieuwsberichten</td>\n";
echo "<td width=\"33%\"></td>\n";
echo "<td width=\"33%\"></td>\n";
echo "</tr>\n";
} else {
// Gegevens laten zien met een while
while($GET = mysql_fetch_assoc($sql))
{
echo "<tr>\n";
echo "<td width=\"34%\">\n";
echo "<a href=\"admin.php?actie=verwijderen&id=". $GET['id'] ."\"><img alt=\"Verwijderen\" border=\"0\" src=\"images/icon.verwijder.gif\" width=\"12\" height=\"12\"></a> <a href=\"admin.php?bewerken=nieuws&id=". $GET['id'] ."\">". $GET['titel'] ."</a></td>\n";
echo "<td width=\"33%\">". $GET['auteur'] ."</td>\n";
echo "<td width=\"33%\">". $GET['datum'] ."</td>\n";
echo "</tr>\n";
}
}
// *** REACTIES-ADMIN INDEX *** //
// Gegevens uit de database ophalen
$select = "SELECT * FROM reacties ORDER by id DESC";
$sql = mysql_query($select) or die(mysql_error());
// Tabel
echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">\n";
echo "<tr>\n";
echo "<td width=\"100%\" colspan=\"3\"><br><br><b>Reacties</b></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td width=\"100%\" colspan=\"3\"> </td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td width=\"34%\"><b>Door</b></td>\n";
echo "<td width=\"33%\"><b>Ip</b></td>\n";
echo "<td width=\"33%\"><b>Datum</b></td>\n";
echo "</tr>\n";
if(empty($sql)) {
echo "<tr>\n";
echo "<td width=\"34%\">\n";
echo "Er zijn geen reacties</td>\n";
echo "<td width=\"33%\"></td>\n";
echo "<td width=\"33%\"></td>\n";
echo "</tr>\n";
} else {
// Gegevens laten zien met een while
while($GET = mysql_fetch_assoc($sql))
{
echo "<tr>\n";
echo "<td width=\"34%\">\n";
echo "<a href=\"admin.php?reactie=verwijderen&id=". $GET['id'] ."\"><img alt=\"Verwijderen\" border=\"0\" src=\"images/icon.verwijder.gif\" width=\"12\" height=\"12\"></a>". $GET['naam'] ."</td>\n";
echo "<td width=\"33%\">". $GET['ip'] ."</td>\n";
echo "<td width=\"33%\">". $GET['datum'] ."</td>\n";
echo "</tr>\n";
}
}
// Einde Tabel
echo "</table>\n";
}
} else {
echo "<center>";
echo "<form method=\"POST\" action=\"\">";
echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"50%\">";
echo " <tr>";
echo " <td width=\"100%\" colspan=\"2\"><b>Administratie</b></td>";
echo " </tr>";
echo " <tr>";
echo " <td width=\"50%\">Gebruikersnaam:</td>";
echo " <td width=\"50%\"><input type=\"text\" name=\"username\" size=\"20\"></td>";
echo " </tr>";
echo " <tr>";
echo " <td width=\"50%\">Wachtwoord:</td>";
echo " <td width=\"50%\"><input type=\"text\" name=\"password\" size=\"20\"></td>";
echo " </tr>";
echo " <tr>";
echo " <td width=\"50%\"> </td>";
echo " <td width=\"50%\"><input type=\"submit\" value=\"Inloggen\" name=\"submit\"></td>";
echo " </tr>";
echo "</table>";
echo "</form>";
echo "</center>";
}
echo "</td>\n";
echo "</tr>\n\n";
// Einde Tabel
echo "</table>\n";
echo "</center>";
?>
Waarom zou je dat willen?
omdat ik het systeem wilk plaatsen in een ledensysteem, zou je iemand dat asjeblieft willen doen??:(
Dat is nog niet zo simpel als je de rest van het script goed wil laten werken. Als iedereen de admin handelingen mag verrichten dan maak je toch iedereen 'admin'.
Is toch een nieuws systeemof heb ik het mis?
In plaats van de admin eruit te slopen kan je beter het systeem 'from scratch' maken die jij wilt. Dat kost minder moeite.
doet er toch niet toe ik heb een script, nu plak ik boven aan dan include hij beveiligingen en dan kijkt hij daar of je mag nieuws toevoegen. dan hoeft er niemand in te loggen.maar hij is dan wel beveiligd
Dan verander je de login toch alleen. Je verandert m zo dat er geen formulier komt en iedereen admin rechten heeft.
ja maar als ik als naar admin.php ga dan pakt hij automatisha de login hij kan er toch wel gewoon uit??
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12
// *** INLOGGEN *** //
if(($_POST['username'] == "". $user ."") && ($_POST['password'] == "". $pass .""))
{
$_SESSION['username'] = $_POST['username'];
$_SESSION['password'] = $_POST['password'];
}
if(($_SESSION['username'] == "". $user ."") && ($_SESSION['password'] == "". $pass .""))
{
if(($_POST['username'] == "". $user ."") && ($_POST['password'] == "". $pass .""))
{
$_SESSION['username'] = $_POST['username'];
$_SESSION['password'] = $_POST['password'];
}
if(($_SESSION['username'] == "". $user ."") && ($_SESSION['password'] == "". $pass .""))
{
Er wordt vast wel ergens een 'rank' ofzo in de SESSION gezet en die maak je altijd de hoogste.
het komt er gewoon op neer, ik wil die hele login in dat bestand admin.php van het nieuws eruit hebben, dus nergens meer een login.
Misschien iemand anders dan?
is er dan echt niemand?? als ik er nou geld voor ga geven???
Maareh, probeer dit eens:
Code (php)
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
<?php
if(($_POST['username'] == "". $user ."") && ($_POST['password'] == "". $pass .""))
{
$_SESSION['username'] = $_POST['username'];
$_SESSION['password'] = $_POST['password'];
}
?>
if(($_POST['username'] == "". $user ."") && ($_POST['password'] == "". $pass .""))
{
$_SESSION['username'] = $_POST['username'];
$_SESSION['password'] = $_POST['password'];
}
?>
veranderen naar
Maar om nou een gebruikersnaam en wachtwoord in een sessie te zetten... ik zou opzoek gaan naar een ander systeem want ik vind deze 3x niks.