Hulp gevraagd met nieuws script
Ik heb al eerder deze vraag gesteld maar nog niet de oplossing gevonden. Ik heb een nieuws scriptje bestaande uit 4 bestanden; admin.php, confog.php, content.php en index.php. Nu staat dit script in de GET method maar ik moet hem zo zien om te bouwen naar POST method zodat er veel tekst bewaard kan worden.
De broncodes:
//admin.php
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
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
<?php
session_start();
$action = $_GET['action'];
$go = $_GET['go'];
$nr = $_GET['nr'];
$text = $_GET['text'];
$name = $_GET['name'];
$pass = $_GET['pass'];
@(include('config.php')) OR die ('<b>config.php is niet gevonden!</b>');
(is_writable($file))?include($file):die ('<b>content.php is niet te beschrijven of bestaat niet!</b>');
// session check
if ( $action == 'login' && $name == $username && $pass == $password || $action == '' && $_SESSION['login'] == 'true' )
{
$_SESSION['login'] = 'true';
htmlhead('on');
print '
<TABLE WIDTH=300 BORDER=0 CELLPADDING=0 CELLSPACING=0 BGCOLOR=#FFFFFF>
<TR>
<TD>
<br>
<center>
<br><br><br>
'.$welcome.'
<br><br><br>
</TD>
</TR>
</TABLE>
';
htmlfooter('');
}
if ( $action == 'logout' || $_SESSION['login'] != 'true' ) // login-logout-screen
{
$_SESSION['login'] = 'false';
if ( $action == 'xx' ) header("Location: ".$web);
htmlhead('Haagse Notitie Schrijver');
?>
<TABLE height=200 WIDTH=300 BORDER=0 CELLPADDING=0 CELLSPACING=0 BGCOLOR=#FFFFFF>
<TR>
<TD width="300" height=35></TD>
<td></td>
<td width="300"></td>
</TR>
<TR>
<TD WIDTH=300>
<form action="<?=$_SERVER['PHP_SELF'] ?>">
<input type="hidden" name="action" value="login">
</TD>
<TD valign="left" WIDTH=20><b>Naam:</b></TD>
<TD valign="left" WIDTH=300>
<input style="width:120px" type="text" size="20" maxlength="15" name="name">
</TD>
</TR>
<TR>
<TD WIDTH=300></TD>
<TD valign="left" WIDTH=50>
<b>Password:</b>
</TD>
<TD valign="left" WIDTH=300>
<input style="width:120px" type="password" size="20" maxlength="15" name="pass">
</TD>
</TR>
<TR>
<TD width="300"></TD>
<TD></TD>
<TD valign="left" WIDTH=330>
<input style="width:120px" type="submit" value="Login">
</form>
</TD>
</TR>
</TABLE>
<?php
htmlfooter('');
}
else
{
// new -->
if ( $action == 'new' )
{
htmlhead('on');
?>
<TABLE WIDTH=300 BORDER=0 CELLPADDING=0 CELLSPACING=0 BGCOLOR=#FFFFFF>
<TR>
<TD colspan=5 width="300"><br><br></TD>
</TR>
<TR>
<TD WIDTH=50></TD>
<TD WIDTH=300 valign=top>
<form action="<?=$_SERVER['PHP_SELF'] ?>">
<textarea style="width:300px;height:100px" wrap=PHYSICAL name="text"></textarea>
<br>
</TD>
<TD WIDTH=40></TD>
<TD WIDTH=110 align=right valign=middle>
</TD>
<TD WIDTH=50></TD>
</TR>
<TR>
<TD></TD>
<TD colspan=3 width="300"><br>
<input type=hidden name=action value="save" /><input type=hidden name=nr value="new" /><input style="width:100px" type="submit" value="Aanmaken" /></form><br>
<form action="<?=$_SERVER['PHP_SELF'] ?>">
<input type=hidden name=action value="show" /><input style="width:100px" type="submit" value="Terug" />
</form>
<hr><br>
</TD>
<TD></TD>
</TR>
</TABLE>
<?php
htmlfooter('');
}
// edit -->
if ( $action == 'edit' )
{
htmlhead('on');
?>
<TABLE WIDTH=300 BORDER=0 CELLPADDING=0 CELLSPACING=0 BGCOLOR=#FFFFFF>
<TR>
<TD colspan=5 width="300"><br>
<br>
</TD>
</TR>
<TR>
<TD WIDTH=50></TD>
<TD WIDTH=300 valign=top>
<form action="<?=$_SERVER['PHP_SELF'] ?>>
<textarea style="width:300px;height:100px" wrap=PHYSICAL name="text"><?=$news[$number[$nr]] ?></textarea>
<br>
</TD>
<TD WIDTH=40></TD>
<TD WIDTH=110 align=right valign=middle>
</TD>
<TD WIDTH=50></TD>
</TR>
<TR>
<TD></TD>
<TD colspan=3 width="300"><br>
<input type=hidden name=action value="save" /><input type=hidden name=nr value="<?=$nr ?>" /><input style="width:100px" type="submit" value="Aanmaken" /></form><br>
<form action="<?=$_SERVER['PHP_SELF'] ?>">
<input type=hidden name=action value="show" /><input style="width:100px" type="submit" value="Terug" />
</form>
<hr><br>
</TD>
<TD></TD>
</TR>
</TABLE>
<?php
htmlfooter('');
}
// move -->
if ( $action == 'move' )
{
if ( $go == 'up' )
{
if ( $nr == '0' ){ $go = $nr; }
elseif ( $nr == '1' ){ $go = '0'; }
else { $go = $nr - 1; }
}
if ( $go == 'down' )
{
$go = $nr + 1;
if ( $number[$go] == '' ) { $go = $nr; }
}
$temp = $number[$nr];
$number[$nr] = $number[$go];
$number[$go] = $temp;
$save = 'true';
}
// delete -->
if ( $action == 'del' )
{
$news[$number[$nr]] = '';
$i = 0;
$x = 0;
while ($number[$nr] != '')
{
$x = $nr + 1;
if ( $number[$x] != '' )
{
$number[$nr] = $number[$x];
$nr = $x;
}
else { unset ($number[$nr]); }
}
$save = 'true';
}
// save -->
if ( $action == 'save' || $save == 'true' )
{
$text = trim($text);
if ( $text !='' )
{
$text = ereg_replace("\\\'", "'", $text); // make the quotes visible ' --> '
if ( $nr =='new' )
{
$x = 0;
$i = count ($number);
while ($i >= 1)
{
$x = $i - 1;
$number[$i] = $number[$x];
$i = $x;
}
$i = 0;
while ($news[$i] != '')
{
$i++;
}
$number[0] = $i;
$news[$i] = $text;
}
else
{
$news[$number[$nr]] = $text;
}
}
$i = 0;
while ($number[$i] >= '0')
{
$datastring .= '$number['.$i.'] = '."'".$number[$i]."';\n";
$datastring .= '$news['.$number[$i].'] = '."'".$news[$number[$i]]."';\n";
$i++;
}
$data = '<?php'."\n".$datastring.'?>';
$data = ereg_replace('\\\"', '"', $data); // remove escaping from doublequotes \"
$fp = fopen($file,"w+");
fputs($fp,$data);
fclose($fp);
header("Location: ".$_SERVER['PHP_SELF']."?action=show"); // Stop the reload problem
}
// show -->
if ( $action == 'show' )
{
htmlhead('on');
?>
<TABLE WIDTH=300 BORDER=0 CELLPADDING=0 CELLSPACING=0 BGCOLOR=#FFFFFF>
<TR>
<td width="63"></td>
<td width="30"></td>
<td width="300"></td>
<td width="30"></td>
</TR>
<?php
if ( $number[0] >= '0' )
{
foreach ($number as $key => $value )
{
if ( $value >= '0' )
{
?>
<TR>
<TD WIDTH=63 align=left valign=middle>
<br>
<form action="<?=$_SERVER['PHP_SELF'] ?>">
<input type=hidden name=action value="move" />
<input type=hidden name=nr value="<?=$key ?>" />
<input type=hidden name=go value="up" />
<input style="width:20px" type="submit" value=↑ />
</form>
<form action="<?=$_SERVER['PHP_SELF'] ?>">
<input type=hidden name=action value="move" />
<input type=hidden name=nr value="<?=$key ?>" />
<input type=hidden name=go value="down" />
<input style="width:20px" type="submit" value=↓ />
</form>
</TD>
<TD WIDTH=30></TD>
<TD WIDTH=300 valign=top>
<br><br>
<?=$news[$value] ?>
<br>
</TD>
<TD WIDTH=30></TD>
</TR>
<TR>
<TD colspan="4" width="423"><br>
<form action="<?=$_SERVER['PHP_SELF'] ?>">
<input type=hidden name=action value=edit>
<input type=hidden name=nr value="<?=$key ?>" /><input style="width:100px" type="submit" value="Aanpassen" />
</form>
<form action="<?=$_SERVER['PHP_SELF'] ?>" onsubmit="return check()">
<input type=hidden name=action value="del" /><input type=hidden name=nr value="<?=$key ?>" /><input style="width:100px" type="submit" value="Verwijderen" />
</form>
<hr>
</TD>
</TR>
<?php
}
}
?>
</TABLE>
<?php
}
else print '
<TABLE WIDTH=300 BORDER=0 CELLPADDING=0 CELLSPACING=0 BGCOLOR=#FFFFFF>
<TR>
<TD align="center">
<br>
'.$nonews.'
</TD>
</TR>
</TABLE>';
htmlfooter('');
}
}
?>
session_start();
$action = $_GET['action'];
$go = $_GET['go'];
$nr = $_GET['nr'];
$text = $_GET['text'];
$name = $_GET['name'];
$pass = $_GET['pass'];
@(include('config.php')) OR die ('<b>config.php is niet gevonden!</b>');
(is_writable($file))?include($file):die ('<b>content.php is niet te beschrijven of bestaat niet!</b>');
// session check
if ( $action == 'login' && $name == $username && $pass == $password || $action == '' && $_SESSION['login'] == 'true' )
{
$_SESSION['login'] = 'true';
htmlhead('on');
print '
<TABLE WIDTH=300 BORDER=0 CELLPADDING=0 CELLSPACING=0 BGCOLOR=#FFFFFF>
<TR>
<TD>
<br>
<center>
<br><br><br>
'.$welcome.'
<br><br><br>
</TD>
</TR>
</TABLE>
';
htmlfooter('');
}
if ( $action == 'logout' || $_SESSION['login'] != 'true' ) // login-logout-screen
{
$_SESSION['login'] = 'false';
if ( $action == 'xx' ) header("Location: ".$web);
htmlhead('Haagse Notitie Schrijver');
?>
<TABLE height=200 WIDTH=300 BORDER=0 CELLPADDING=0 CELLSPACING=0 BGCOLOR=#FFFFFF>
<TR>
<TD width="300" height=35></TD>
<td></td>
<td width="300"></td>
</TR>
<TR>
<TD WIDTH=300>
<form action="<?=$_SERVER['PHP_SELF'] ?>">
<input type="hidden" name="action" value="login">
</TD>
<TD valign="left" WIDTH=20><b>Naam:</b></TD>
<TD valign="left" WIDTH=300>
<input style="width:120px" type="text" size="20" maxlength="15" name="name">
</TD>
</TR>
<TR>
<TD WIDTH=300></TD>
<TD valign="left" WIDTH=50>
<b>Password:</b>
</TD>
<TD valign="left" WIDTH=300>
<input style="width:120px" type="password" size="20" maxlength="15" name="pass">
</TD>
</TR>
<TR>
<TD width="300"></TD>
<TD></TD>
<TD valign="left" WIDTH=330>
<input style="width:120px" type="submit" value="Login">
</form>
</TD>
</TR>
</TABLE>
<?php
htmlfooter('');
}
else
{
// new -->
if ( $action == 'new' )
{
htmlhead('on');
?>
<TABLE WIDTH=300 BORDER=0 CELLPADDING=0 CELLSPACING=0 BGCOLOR=#FFFFFF>
<TR>
<TD colspan=5 width="300"><br><br></TD>
</TR>
<TR>
<TD WIDTH=50></TD>
<TD WIDTH=300 valign=top>
<form action="<?=$_SERVER['PHP_SELF'] ?>">
<textarea style="width:300px;height:100px" wrap=PHYSICAL name="text"></textarea>
<br>
</TD>
<TD WIDTH=40></TD>
<TD WIDTH=110 align=right valign=middle>
</TD>
<TD WIDTH=50></TD>
</TR>
<TR>
<TD></TD>
<TD colspan=3 width="300"><br>
<input type=hidden name=action value="save" /><input type=hidden name=nr value="new" /><input style="width:100px" type="submit" value="Aanmaken" /></form><br>
<form action="<?=$_SERVER['PHP_SELF'] ?>">
<input type=hidden name=action value="show" /><input style="width:100px" type="submit" value="Terug" />
</form>
<hr><br>
</TD>
<TD></TD>
</TR>
</TABLE>
<?php
htmlfooter('');
}
// edit -->
if ( $action == 'edit' )
{
htmlhead('on');
?>
<TABLE WIDTH=300 BORDER=0 CELLPADDING=0 CELLSPACING=0 BGCOLOR=#FFFFFF>
<TR>
<TD colspan=5 width="300"><br>
<br>
</TD>
</TR>
<TR>
<TD WIDTH=50></TD>
<TD WIDTH=300 valign=top>
<form action="<?=$_SERVER['PHP_SELF'] ?>>
<textarea style="width:300px;height:100px" wrap=PHYSICAL name="text"><?=$news[$number[$nr]] ?></textarea>
<br>
</TD>
<TD WIDTH=40></TD>
<TD WIDTH=110 align=right valign=middle>
</TD>
<TD WIDTH=50></TD>
</TR>
<TR>
<TD></TD>
<TD colspan=3 width="300"><br>
<input type=hidden name=action value="save" /><input type=hidden name=nr value="<?=$nr ?>" /><input style="width:100px" type="submit" value="Aanmaken" /></form><br>
<form action="<?=$_SERVER['PHP_SELF'] ?>">
<input type=hidden name=action value="show" /><input style="width:100px" type="submit" value="Terug" />
</form>
<hr><br>
</TD>
<TD></TD>
</TR>
</TABLE>
<?php
htmlfooter('');
}
// move -->
if ( $action == 'move' )
{
if ( $go == 'up' )
{
if ( $nr == '0' ){ $go = $nr; }
elseif ( $nr == '1' ){ $go = '0'; }
else { $go = $nr - 1; }
}
if ( $go == 'down' )
{
$go = $nr + 1;
if ( $number[$go] == '' ) { $go = $nr; }
}
$temp = $number[$nr];
$number[$nr] = $number[$go];
$number[$go] = $temp;
$save = 'true';
}
// delete -->
if ( $action == 'del' )
{
$news[$number[$nr]] = '';
$i = 0;
$x = 0;
while ($number[$nr] != '')
{
$x = $nr + 1;
if ( $number[$x] != '' )
{
$number[$nr] = $number[$x];
$nr = $x;
}
else { unset ($number[$nr]); }
}
$save = 'true';
}
// save -->
if ( $action == 'save' || $save == 'true' )
{
$text = trim($text);
if ( $text !='' )
{
$text = ereg_replace("\\\'", "'", $text); // make the quotes visible ' --> '
if ( $nr =='new' )
{
$x = 0;
$i = count ($number);
while ($i >= 1)
{
$x = $i - 1;
$number[$i] = $number[$x];
$i = $x;
}
$i = 0;
while ($news[$i] != '')
{
$i++;
}
$number[0] = $i;
$news[$i] = $text;
}
else
{
$news[$number[$nr]] = $text;
}
}
$i = 0;
while ($number[$i] >= '0')
{
$datastring .= '$number['.$i.'] = '."'".$number[$i]."';\n";
$datastring .= '$news['.$number[$i].'] = '."'".$news[$number[$i]]."';\n";
$i++;
}
$data = '<?php'."\n".$datastring.'?>';
$data = ereg_replace('\\\"', '"', $data); // remove escaping from doublequotes \"
$fp = fopen($file,"w+");
fputs($fp,$data);
fclose($fp);
header("Location: ".$_SERVER['PHP_SELF']."?action=show"); // Stop the reload problem
}
// show -->
if ( $action == 'show' )
{
htmlhead('on');
?>
<TABLE WIDTH=300 BORDER=0 CELLPADDING=0 CELLSPACING=0 BGCOLOR=#FFFFFF>
<TR>
<td width="63"></td>
<td width="30"></td>
<td width="300"></td>
<td width="30"></td>
</TR>
<?php
if ( $number[0] >= '0' )
{
foreach ($number as $key => $value )
{
if ( $value >= '0' )
{
?>
<TR>
<TD WIDTH=63 align=left valign=middle>
<br>
<form action="<?=$_SERVER['PHP_SELF'] ?>">
<input type=hidden name=action value="move" />
<input type=hidden name=nr value="<?=$key ?>" />
<input type=hidden name=go value="up" />
<input style="width:20px" type="submit" value=↑ />
</form>
<form action="<?=$_SERVER['PHP_SELF'] ?>">
<input type=hidden name=action value="move" />
<input type=hidden name=nr value="<?=$key ?>" />
<input type=hidden name=go value="down" />
<input style="width:20px" type="submit" value=↓ />
</form>
</TD>
<TD WIDTH=30></TD>
<TD WIDTH=300 valign=top>
<br><br>
<?=$news[$value] ?>
<br>
</TD>
<TD WIDTH=30></TD>
</TR>
<TR>
<TD colspan="4" width="423"><br>
<form action="<?=$_SERVER['PHP_SELF'] ?>">
<input type=hidden name=action value=edit>
<input type=hidden name=nr value="<?=$key ?>" /><input style="width:100px" type="submit" value="Aanpassen" />
</form>
<form action="<?=$_SERVER['PHP_SELF'] ?>" onsubmit="return check()">
<input type=hidden name=action value="del" /><input type=hidden name=nr value="<?=$key ?>" /><input style="width:100px" type="submit" value="Verwijderen" />
</form>
<hr>
</TD>
</TR>
<?php
}
}
?>
</TABLE>
<?php
}
else print '
<TABLE WIDTH=300 BORDER=0 CELLPADDING=0 CELLSPACING=0 BGCOLOR=#FFFFFF>
<TR>
<TD align="center">
<br>
'.$nonews.'
</TD>
</TR>
</TABLE>';
htmlfooter('');
}
}
?>
//config.php
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
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
<?php
/
$web = 'http://www.webfire.org';
//
$username = '.......'; // your login name
$password = '.......'; // your login password
$title = '....................'; // Page title
$file = 'content.php'; // where the data will be saved
$nonews = 'Er zijn nog geen notities!'; // message if no news
$welcome = '<b>..............</b>'; // welcome message
//-------------------------------------------------------------------------|
// Do not edit beyond this line! |
//-------------------------------------------------------------------------|
function htmlhead($links)
{
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
<TITLE>...................</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1" />
<SCRIPT TYPE="text/javascript" SRC="help.js"></script>
<link rel="stylesheet" href="style.css" type="text/css">
</HEAD>
<BODY bgcolor="white" LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0>
<div align="left">
<table width=300 border=0 cellpadding=0 cellspacing=0>
<tr>
<td align="left"></td>
</tr>
</table>
<br>
<table width=300 border=0 cellpadding=0 cellspacing=0>
<tr>
<td align="center" width=300 height=30 bgcolor="#ffffff"><?php
if ( $links == 'on')
{
?><a href="<?=$_SERVER['PHP_SELF'] ?>?action=new" class="subnavi">Maak notitie</a> | <a href="<?=$_SERVER['PHP_SELF'] ?>?action=show" class="subnavi">Bekijk notities</a><br>
<a href="#" onclick="help();" class="subnavi">Help</a> | <a href="<?=$_SERVER['PHP_SELF'] ?>?action=logout" class="subnavi">Uitloggen</a> <?php
}
else { print '<span class="subnavi">'.$links.'</span>'; }
?></td>
</tr>
<tr>
<td><img src="line.gif" width=300 height=1 alt=""></td>
</tr>
</table>
<?php
}
function htmlfooter($links)
{
?>
<table width=300 border=0 cellpadding=0 cellspacing=0 bgcolor=#FFFFFF>
<tr>
<td height=20></td>
</tr>
</table>
<table width=300 border=0 cellpadding=0 cellspacing=0>
<tr>
<td><img src="line.gif" width=300 height=1 alt=""></td>
</tr>
<tr>
<td align="center" width=300 height=30 bgcolor="#ffffff"><a href="admin.php" class="subnavi"><?=$links ?></a></td>
</tr>
</table>
</div>
</BODY></HTML>
<?php
}
?>
/
$web = 'http://www.webfire.org';
//
$username = '.......'; // your login name
$password = '.......'; // your login password
$title = '....................'; // Page title
$file = 'content.php'; // where the data will be saved
$nonews = 'Er zijn nog geen notities!'; // message if no news
$welcome = '<b>..............</b>'; // welcome message
//-------------------------------------------------------------------------|
// Do not edit beyond this line! |
//-------------------------------------------------------------------------|
function htmlhead($links)
{
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
<TITLE>...................</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1" />
<SCRIPT TYPE="text/javascript" SRC="help.js"></script>
<link rel="stylesheet" href="style.css" type="text/css">
</HEAD>
<BODY bgcolor="white" LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0>
<div align="left">
<table width=300 border=0 cellpadding=0 cellspacing=0>
<tr>
<td align="left"></td>
</tr>
</table>
<br>
<table width=300 border=0 cellpadding=0 cellspacing=0>
<tr>
<td align="center" width=300 height=30 bgcolor="#ffffff"><?php
if ( $links == 'on')
{
?><a href="<?=$_SERVER['PHP_SELF'] ?>?action=new" class="subnavi">Maak notitie</a> | <a href="<?=$_SERVER['PHP_SELF'] ?>?action=show" class="subnavi">Bekijk notities</a><br>
<a href="#" onclick="help();" class="subnavi">Help</a> | <a href="<?=$_SERVER['PHP_SELF'] ?>?action=logout" class="subnavi">Uitloggen</a> <?php
}
else { print '<span class="subnavi">'.$links.'</span>'; }
?></td>
</tr>
<tr>
<td><img src="line.gif" width=300 height=1 alt=""></td>
</tr>
</table>
<?php
}
function htmlfooter($links)
{
?>
<table width=300 border=0 cellpadding=0 cellspacing=0 bgcolor=#FFFFFF>
<tr>
<td height=20></td>
</tr>
</table>
<table width=300 border=0 cellpadding=0 cellspacing=0>
<tr>
<td><img src="line.gif" width=300 height=1 alt=""></td>
</tr>
<tr>
<td align="center" width=300 height=30 bgcolor="#ffffff"><a href="admin.php" class="subnavi"><?=$links ?></a></td>
</tr>
</table>
</div>
</BODY></HTML>
<?php
}
?>
//content.php staat niets in gewoon chmod 777
//index.php
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
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
<body bgcolor="white" leftmargin="0" marginheight="0" marginwidth="0" topmargin="0">
<?php
@(include('config.php')) OR die ('<b>config.php is niet gevonden!</b>');
(is_writable($file))?include($file):die ('<b>content.php is niet te beschrijven of bestaat niet!</b>');
$links = '...................';
htmlhead($links);
if ( $number[0] >= '0' )
{
print ' <TABLE WIDTH=300 BORDER=0 CELLPADDING=0 CELLSPACING=0 BGCOLOR=#FFFFFF>
<TR>
<TD colspan=7><br></TD>
</TR>
';
foreach ($number as $key => $value )
{
if ( $value >= '0' )
{
?>
<TR>
<TD WIDTH=40></TD>
<TD WIDTH=300 valign=top><br>
<?=$news[$value] ?><br>
<br>
</TD>
<TD WIDTH=40></TD>
</TR>
<TR>
<TD></TD>
<TD><br>
<hr>
</TD>
<TD></TD>
</TR>
<?php
}
}
print '</TABLE>';
}
else print '
<TABLE WIDTH=300 BORDER=0 CELLPADDING=0 CELLSPACING=0 BGCOLOR=#FFFFFF>
<TR>
<TD>
<br>
<left>
'.$nonews.'
</TD>
</TR>
</TABLE>';
htmlfooter('¶');
?>
</body>
<?php
@(include('config.php')) OR die ('<b>config.php is niet gevonden!</b>');
(is_writable($file))?include($file):die ('<b>content.php is niet te beschrijven of bestaat niet!</b>');
$links = '...................';
htmlhead($links);
if ( $number[0] >= '0' )
{
print ' <TABLE WIDTH=300 BORDER=0 CELLPADDING=0 CELLSPACING=0 BGCOLOR=#FFFFFF>
<TR>
<TD colspan=7><br></TD>
</TR>
';
foreach ($number as $key => $value )
{
if ( $value >= '0' )
{
?>
<TR>
<TD WIDTH=40></TD>
<TD WIDTH=300 valign=top><br>
<?=$news[$value] ?><br>
<br>
</TD>
<TD WIDTH=40></TD>
</TR>
<TR>
<TD></TD>
<TD><br>
<hr>
</TD>
<TD></TD>
</TR>
<?php
}
}
print '</TABLE>';
}
else print '
<TABLE WIDTH=300 BORDER=0 CELLPADDING=0 CELLSPACING=0 BGCOLOR=#FFFFFF>
<TR>
<TD>
<br>
<left>
'.$nonews.'
</TD>
</TR>
</TABLE>';
htmlfooter('¶');
?>
</body>
Kan iemand mij helpen? Je hebt wel gelijk een werkend script voor kleine nieuws berichten.
Alvast bedankt voor jullie reactie.
Gewijzigd op 15/11/2004 09:30:00 door Menno Geene
En <form action='bla.php' method='post'>
En voortaan:
http://www.phphulp.nl/php/tutorials/10/143/241/ eerst lezen. Wij gaan hier geen 400 door lezen voor onze plezier
Ja dat heb ik gedaan en geprobeerd maar dan werkt het geheel helemaal niet meer!!!!!!
En <form action='bla.php' method='post'>
niet werkt dan is er verschijnlijk een typfout :P
Bla.php == bestandsnaam die dat moet veroorzaken.
Hey Menno je moet ook nadenken dat 2000 regels een beetje teveel is, maar wat is er nou leuker dan zelf debuggen, daar leer je toch eigenlijk zelf meer van.
Ja, dat is zeker zo. Maar ik heb dus alle GET in POST veranderd en ook de form action. Dan werkt het dus niet. Nu weet ik dus niet waar ik moet beginnen en waarop ik moet letten.
Btw je 2000 regels code zorgen ervoor dat mijn arme Opera 7.0 blijft laden :-/
Heb hem even bruut moeten afbreken.
Notice: Undefined index: action in /home/renswoudehuisnl/HTML/test/admin.php on line 26
Notice: Undefined index: go in /home/renswoudehuisnl/HTML/test/admin.php on line 27
Notice: Undefined index: nr in /home/renswoudehuisnl/HTML/test/admin.php on line 28
Notice: Undefined index: text in /home/renswoudehuisnl/HTML/test/admin.php on line 29
Notice: Undefined index: name in /home/renswoudehuisnl/HTML/test/admin.php on line 30
Notice: Undefined index: pass in /home/renswoudehuisnl/HTML/test/admin.php on line 31
Notice: Undefined index: login in /home/renswoudehuisnl/HTML/test/admin.php on line 37
Notice: Undefined index: login in /home/renswoudehuisnl/HTML/test/admin.php on line 56
Nu heb ik gekeken maar ik wordt er echt niet wijzer van.
Iemand een idee?
Die notices (niet eens een foutmelding, en krijg je enkel te zien als error_reporting(e_all) aanstaat) geven aan dat in deze array nog geen waardes staan.
Dit komt waarschijnlijk doordat je de eerste keer ook doorheen deze array gaat ook al is je form nog niet gepost.
Ik was door je bovenstaande code aan het kijken maar kan niet meteen de plaats vinden waar het nu precies om gaat omdat je geen gebruik maakt van superglobals.
Geposte velden spreek je aan met $_POST['naam_van_veld']. Pas ook dat even aan.
Geposte velden spreek je aan met $_POST['naam_van_veld'].
Waar moet ik beginnen?
Elwin
// new -->
if ( $action == 'new' )
{
htmlhead('on');
?>
<TABLE WIDTH=300 BORDER=0 CELLPADDING=0 CELLSPACING=0 BGCOLOR=#FFFFFF>
<TR>
<TD colspan=5 width="300"><br><br></TD>
</TR>
<TR>
<TD WIDTH=50></TD>
<TD WIDTH=300 valign=top>
<form action="" method="post">
<textarea style="width:300px;height:100px" wrap=PHYSICAL name="text"></textarea>
<br>
</TD>
<TD WIDTH=40></TD>
<TD WIDTH=110 align=right valign=middle>
</TD>
<TD WIDTH=50></TD>
</TR>
<TR>
<TD></TD>
<TD colspan=3 width="300"><br>
<input type=hidden name=action value="save" /><input type=hidden name=nr value="new" /><input style="width:100px" type="submit" value="Aanmaken" /></form><br>
<form action="" method="post">
<input type=hidden name=action value="show" /><input style="width:100px" type="submit" value="Terug" />
</form>
<hr><br>
</TD>
<TD></TD>
</TR>
</TABLE>
Als het werkt voor jou en doet wat jij verwacht dan is dat toch genoeg?
Nou dit script werkt goed met kleine teksten, maar als je veel tekst wilt plaatsen werkt het dus niet.
Is leuk, maar het moet toch mogelijk zijn om dit script om te zetten van GET naar POST? Dit is namelijk een heel makkelijk en gebruiksvriendelijk script voor het plaatsen van teksten.