foreach fout
Ik krijg deze foutmelding:
Warning: Invalid argument supplied for foreach() in C:\AppServ\www\Thomaz.eu.tc\pberichten.php on line 30
Berichten succesvol verwijdert, u wordt over 5 sec. doorgestuurd.
En ik had nog een vraag, hoe je dit plaatje goed kan uitlijnen, net zoals de rest van de plaatjes. (Dat plaatje van verwijderen.)
En nog een fout in het script, als je de eerste selectbox selecteert, selecteert die de rest niet, weet iemand ook daar de fout van?
Hier mijn script:
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
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
<head>
<script language="JavaScript">
var checkflag = "false";
function check(field) {
if (checkflag == "false") {
for (i = 0; i < field.length; i++) {
field[i].checked = true;}
checkflag = "true";
return "Uncheck All"; }
else {
for (i = 0; i < field.length; i++) {
field[i].checked = false; }
checkflag = "false";
return "Check All"; }
}
</script>
</head>
<?php
include ("config.php");
include ("global.php");
if (!isset($inuit))
{
header("Location: index.php?pagina=fout");
exit;
}
if (!isset($_SESSION['login']))
{
echo '<table width="99%" border="0" align="center" cellspacing="0" cellpadding="0">
<tr>
<td class="Tekst">Je moet ingelogd zijn om je privéberichten te bekijken!</td>
</tr>
</table>';
echo '<table width="524" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="3" background="png/content_onder.PNG"></td>
</tr>
</table>';
}
else
{
if ($_SERVER['REQUEST_METHOD'] == "POST"){
foreach ($_POST['delete'] as $value) {
$query = "DELETE FROM pb WHERE id='".$value."'";
mysql_query($query) or die (mysql_error());
}
echo "Berichten succesvol verwijdert, u wordt over 5 sec. doorgestuurd. <META HTTP-EQUIV='refresh' CONTENT='5; URL=?pagina=pberichten'> ";
}
else
{
if (empty($_GET['id']))
{
?>
<link href="newstyle.css" rel="stylesheet" type="text/css" />
<table width="99%" height="2" border="0" cellspacing="0" cellpadding="0">
<tr>
<td></td>
</tr>
</table>
<table width="524" border="0" cellpadding="0" cellspacing="0" background="png/content.PNG">
<tr>
<td><table width="99%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="left" valign="middle"><form id="form1" name="form1" method="post" action="">
<img src="png/pb/Pb_nieuw.png" width="121" height="26" />
<img src="png/pb/Pb_inbox.png" width="75" height="26" />
<img src="png/pb/Pb_Outbox.png" width="75" height="26" />
<img src="png/pb/Pb_blokkeren.png" width="93" height="26" />
<input type="submit" name="verwijderen" class="msgdel" value=" " onclick="return confirm('Weet je zeker dat je de geselecteerde berichten wilt verwijderen?');" />
</form></td>
</tr>
</table>
<table width="99%" height="2" border="0" cellspacing="0" cellpadding="0">
<tr>
<td></td>
</tr>
</table>
</td>
</tr>
</table>
<table width="524" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="2" height="2" background="png/pb/pb_hoek_links1.PNG"></td>
<td width="20" background="png/pb/pb_boven.PNG"></td>
<td width="1" background="png/pb/punt.PNG"></td>
<td width="119" background="png/pb/pb_boven.PNG"></td>
<td width="1" background="png/pb/punt.PNG"></td>
<td width="258" background="png/pb/pb_boven.PNG"></td>
<td width="1" background="png/pb/punt.PNG"></td>
<td width="120" background="png/pb/pb_boven.PNG"></td>
<td width="2" height="2" background="png/pb/pb_hoek_rechts1.PNG"></td>
</tr>
</table>
<table width="524" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="2" background="png/pb/pb_links.PNG"></td>
<td width="20" align="center" background="png/pb/pb_midden.PNG" class="Tekst"><label>
<input type="checkbox" value="Check All" onClick="this.value=check(this.form.delete[])">
</label></td>
<td width="1" align="center" background="png/pb/punt.png" class="Tekst"></td>
<td width="119" align="center" background="png/pb/pb_midden.PNG" class="Tekst">Verzonden door:</td>
<td width="1" align="center" background="png/pb/punt.png" class="Tekst"></td>
<td width="258" align="center" background="png/pb/pb_midden.PNG" class="Tekst">Onderwerp:</td>
<td width="1" align="center" background="png/pb/punt.png" class="Tekst"></td>
<td width="120" align="center" background="png/pb/pb_midden.PNG" class="Tekst">Datum:</td>
<td width="2" background="png/pb/pb_rechts.PNG"></td>
</tr>
</table>
<table width="524" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="2" height="2" background="png/pb/pb_hoek_links2.PNG"></td>
<td width="20" background="png/pb/pb_onder.PNG"></td>
<td width="1" background="png/pb/punt.PNG"></td>
<td width="119" background="png/pb/pb_onder.PNG"></td>
<td width="1" background="png/pb/punt.PNG"></td>
<td width="258" background="png/pb/pb_onder.PNG"></td>
<td width="1" background="png/pb/punt.PNG"></td>
<td width="120" background="png/pb/pb_onder.PNG"></td>
<td width="2" height="2" background="png/pb/pb_hoek_rechts2.PNG"></td>
</tr>
</table>
<?php
$query = "SELECT * FROM pb WHERE user='".$_SESSION['naam']."'";
$result=mysql_query($query) or die (mysql_error());
$mnr = mysql_num_rows($result);
while ($sql = mysql_fetch_assoc($result))
{
if ($sql['1read'] == "ja")
{
?>
<table width="524" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="2" background="png/pb/pb_links.PNG"></td>
<td width="20" align="center" background="png/pb/pb_midden.PNG" class="Tekst"><label>
<input type="checkbox" name="delete[]" value="<?php echo $sql['id']; ?>" />
</label></td>
<td width="1" align="center" background="png/pb/punt.png" class="Tekst"></td>
<td width="119" align="center" background="png/pb/pb_midden.PNG" class="Tekst"><?php echo ucfirst($sql['from']); ?></td>
<td width="1" align="center" background="png/pb/punt.png" class="Tekst"></td>
<td width="258" align="center" background="png/pb/pb_midden.PNG" onclick="parent.location='index.php?pagina=pberichten&id=<?php echo $sql['id']; ?>'" onmouseover= "this.style.cursor='pointer'" class="Tekst"><?php echo $sql['onderwerp']; ?></td>
<td width="1" align="center" background="png/pb/punt.png" class="Tekst"></td>
<td width="120" align="center" background="png/pb/pb_midden.PNG" class="Tekst"><?php echo $sql['datum']; ?></td>
<td width="2" background="png/pb/pb_rechts.PNG"></td>
</tr>
</table>
<table width="524" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="2" height="2" background="png/pb/pb_hoek_links2.PNG"></td>
<td width="20" background="png/pb/pb_onder.PNG"></td>
<td width="1" background="png/pb/punt.PNG"></td>
<td width="119" background="png/pb/pb_onder.PNG"></td>
<td width="1" background="png/pb/punt.PNG"></td>
<td width="258" background="png/pb/pb_onder.PNG"></td>
<td width="1" background="png/pb/punt.PNG"></td>
<td width="120" background="png/pb/pb_onder.PNG"></td>
<td width="2" height="2" background="png/pb/pb_hoek_rechts2.PNG"></td>
</tr>
</table>
<?php
}
else
{
?>
<table width="524" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="2" background="png/pb/pb_links_g.PNG"></td>
<td width="20" align="center" background="png/pb/pb_midden_g.PNG" class="Tekst"><label>
<input type="checkbox" name="delete[]" value="<?php echo $sql['id']; ?>" />
</label></td>
<td width="1" align="center" background="png/pb/punt.png" class="Tekst"></td>
<td width="119" align="center" background="png/pb/pb_midden_g.PNG" class="Tekst"><?php echo ucfirst($sql['from']); ?></td>
<td width="1" align="center" background="png/pb/punt.png" class="Tekst"></td>
<td width="258" align="center" background="png/pb/pb_midden_g.PNG" onclick="parent.location='index.php?pagina=pberichten&id=<?php echo $sql['id']; ?>'" onmouseover= "this.style.cursor='pointer'" class="Tekst"><?php echo $sql['onderwerp']; ?></td>
<td width="1" align="center" background="png/pb/punt.png" class="Tekst"></td>
<td width="120" align="center" background="png/pb/pb_midden_g.PNG" class="Tekst"><?php echo $sql['datum']; ?></td>
<td width="2" background="png/pb/pb_rechts_g.PNG"></td>
</tr>
</table>
<table width="524" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="2" height="2" background="png/pb/pb_hoek_links2g.PNG"></td>
<td width="20" background="png/pb/pb_onder_g.PNG"></td>
<td width="1" background="png/pb/punt.PNG"></td>
<td width="119" background="png/pb/pb_onder_g.PNG"></td>
<td width="1" background="png/pb/punt.PNG"></td>
<td width="258" background="png/pb/pb_onder_g.PNG"></td>
<td width="1" background="png/pb/punt.PNG"></td>
<td width="120" background="png/pb/pb_onder_g.PNG"></td>
<td width="2" height="2" background="png/pb/pb_hoek_rechts2g.PNG"></td>
</tr>
</table>
<?php
}
}
}
else
{
$query = "SELECT * FROM pb WHERE user='".$_SESSION['naam']."' && id='".htmlspecialchars($_GET['id'])."'";
$result=mysql_query($query) or die (mysql_error());
$mnr = mysql_num_rows($result);
$sql = mysql_fetch_assoc($result);
if ($mnr == "0")
{
echo '<table width="99%" border="0" align="center" cellspacing="0" cellpadding="0">
<tr>
<td class="Tekst">Dit bericht bestaat niet (meer) !</td>
</tr>
</table>';
echo '<table width="524" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="3" background="png/content_onder.PNG"></td>
</tr>
</table>';
}
else
{
echo '<table width="99%" border="0" align="center" cellspacing="0" cellpadding="0">
<tr>
<td class="Tekst">';
echo $sql['bericht'];
echo '</td>
</tr>
</table>';
echo '<table width="524" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="3" background="png/content_onder.PNG"></td>
</tr>
</table>';
}
}
}
}
?>
<script language="JavaScript">
var checkflag = "false";
function check(field) {
if (checkflag == "false") {
for (i = 0; i < field.length; i++) {
field[i].checked = true;}
checkflag = "true";
return "Uncheck All"; }
else {
for (i = 0; i < field.length; i++) {
field[i].checked = false; }
checkflag = "false";
return "Check All"; }
}
</script>
</head>
<?php
include ("config.php");
include ("global.php");
if (!isset($inuit))
{
header("Location: index.php?pagina=fout");
exit;
}
if (!isset($_SESSION['login']))
{
echo '<table width="99%" border="0" align="center" cellspacing="0" cellpadding="0">
<tr>
<td class="Tekst">Je moet ingelogd zijn om je privéberichten te bekijken!</td>
</tr>
</table>';
echo '<table width="524" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="3" background="png/content_onder.PNG"></td>
</tr>
</table>';
}
else
{
if ($_SERVER['REQUEST_METHOD'] == "POST"){
foreach ($_POST['delete'] as $value) {
$query = "DELETE FROM pb WHERE id='".$value."'";
mysql_query($query) or die (mysql_error());
}
echo "Berichten succesvol verwijdert, u wordt over 5 sec. doorgestuurd. <META HTTP-EQUIV='refresh' CONTENT='5; URL=?pagina=pberichten'> ";
}
else
{
if (empty($_GET['id']))
{
?>
<link href="newstyle.css" rel="stylesheet" type="text/css" />
<table width="99%" height="2" border="0" cellspacing="0" cellpadding="0">
<tr>
<td></td>
</tr>
</table>
<table width="524" border="0" cellpadding="0" cellspacing="0" background="png/content.PNG">
<tr>
<td><table width="99%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="left" valign="middle"><form id="form1" name="form1" method="post" action="">
<img src="png/pb/Pb_nieuw.png" width="121" height="26" />
<img src="png/pb/Pb_inbox.png" width="75" height="26" />
<img src="png/pb/Pb_Outbox.png" width="75" height="26" />
<img src="png/pb/Pb_blokkeren.png" width="93" height="26" />
<input type="submit" name="verwijderen" class="msgdel" value=" " onclick="return confirm('Weet je zeker dat je de geselecteerde berichten wilt verwijderen?');" />
</form></td>
</tr>
</table>
<table width="99%" height="2" border="0" cellspacing="0" cellpadding="0">
<tr>
<td></td>
</tr>
</table>
</td>
</tr>
</table>
<table width="524" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="2" height="2" background="png/pb/pb_hoek_links1.PNG"></td>
<td width="20" background="png/pb/pb_boven.PNG"></td>
<td width="1" background="png/pb/punt.PNG"></td>
<td width="119" background="png/pb/pb_boven.PNG"></td>
<td width="1" background="png/pb/punt.PNG"></td>
<td width="258" background="png/pb/pb_boven.PNG"></td>
<td width="1" background="png/pb/punt.PNG"></td>
<td width="120" background="png/pb/pb_boven.PNG"></td>
<td width="2" height="2" background="png/pb/pb_hoek_rechts1.PNG"></td>
</tr>
</table>
<table width="524" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="2" background="png/pb/pb_links.PNG"></td>
<td width="20" align="center" background="png/pb/pb_midden.PNG" class="Tekst"><label>
<input type="checkbox" value="Check All" onClick="this.value=check(this.form.delete[])">
</label></td>
<td width="1" align="center" background="png/pb/punt.png" class="Tekst"></td>
<td width="119" align="center" background="png/pb/pb_midden.PNG" class="Tekst">Verzonden door:</td>
<td width="1" align="center" background="png/pb/punt.png" class="Tekst"></td>
<td width="258" align="center" background="png/pb/pb_midden.PNG" class="Tekst">Onderwerp:</td>
<td width="1" align="center" background="png/pb/punt.png" class="Tekst"></td>
<td width="120" align="center" background="png/pb/pb_midden.PNG" class="Tekst">Datum:</td>
<td width="2" background="png/pb/pb_rechts.PNG"></td>
</tr>
</table>
<table width="524" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="2" height="2" background="png/pb/pb_hoek_links2.PNG"></td>
<td width="20" background="png/pb/pb_onder.PNG"></td>
<td width="1" background="png/pb/punt.PNG"></td>
<td width="119" background="png/pb/pb_onder.PNG"></td>
<td width="1" background="png/pb/punt.PNG"></td>
<td width="258" background="png/pb/pb_onder.PNG"></td>
<td width="1" background="png/pb/punt.PNG"></td>
<td width="120" background="png/pb/pb_onder.PNG"></td>
<td width="2" height="2" background="png/pb/pb_hoek_rechts2.PNG"></td>
</tr>
</table>
<?php
$query = "SELECT * FROM pb WHERE user='".$_SESSION['naam']."'";
$result=mysql_query($query) or die (mysql_error());
$mnr = mysql_num_rows($result);
while ($sql = mysql_fetch_assoc($result))
{
if ($sql['1read'] == "ja")
{
?>
<table width="524" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="2" background="png/pb/pb_links.PNG"></td>
<td width="20" align="center" background="png/pb/pb_midden.PNG" class="Tekst"><label>
<input type="checkbox" name="delete[]" value="<?php echo $sql['id']; ?>" />
</label></td>
<td width="1" align="center" background="png/pb/punt.png" class="Tekst"></td>
<td width="119" align="center" background="png/pb/pb_midden.PNG" class="Tekst"><?php echo ucfirst($sql['from']); ?></td>
<td width="1" align="center" background="png/pb/punt.png" class="Tekst"></td>
<td width="258" align="center" background="png/pb/pb_midden.PNG" onclick="parent.location='index.php?pagina=pberichten&id=<?php echo $sql['id']; ?>'" onmouseover= "this.style.cursor='pointer'" class="Tekst"><?php echo $sql['onderwerp']; ?></td>
<td width="1" align="center" background="png/pb/punt.png" class="Tekst"></td>
<td width="120" align="center" background="png/pb/pb_midden.PNG" class="Tekst"><?php echo $sql['datum']; ?></td>
<td width="2" background="png/pb/pb_rechts.PNG"></td>
</tr>
</table>
<table width="524" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="2" height="2" background="png/pb/pb_hoek_links2.PNG"></td>
<td width="20" background="png/pb/pb_onder.PNG"></td>
<td width="1" background="png/pb/punt.PNG"></td>
<td width="119" background="png/pb/pb_onder.PNG"></td>
<td width="1" background="png/pb/punt.PNG"></td>
<td width="258" background="png/pb/pb_onder.PNG"></td>
<td width="1" background="png/pb/punt.PNG"></td>
<td width="120" background="png/pb/pb_onder.PNG"></td>
<td width="2" height="2" background="png/pb/pb_hoek_rechts2.PNG"></td>
</tr>
</table>
<?php
}
else
{
?>
<table width="524" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="2" background="png/pb/pb_links_g.PNG"></td>
<td width="20" align="center" background="png/pb/pb_midden_g.PNG" class="Tekst"><label>
<input type="checkbox" name="delete[]" value="<?php echo $sql['id']; ?>" />
</label></td>
<td width="1" align="center" background="png/pb/punt.png" class="Tekst"></td>
<td width="119" align="center" background="png/pb/pb_midden_g.PNG" class="Tekst"><?php echo ucfirst($sql['from']); ?></td>
<td width="1" align="center" background="png/pb/punt.png" class="Tekst"></td>
<td width="258" align="center" background="png/pb/pb_midden_g.PNG" onclick="parent.location='index.php?pagina=pberichten&id=<?php echo $sql['id']; ?>'" onmouseover= "this.style.cursor='pointer'" class="Tekst"><?php echo $sql['onderwerp']; ?></td>
<td width="1" align="center" background="png/pb/punt.png" class="Tekst"></td>
<td width="120" align="center" background="png/pb/pb_midden_g.PNG" class="Tekst"><?php echo $sql['datum']; ?></td>
<td width="2" background="png/pb/pb_rechts_g.PNG"></td>
</tr>
</table>
<table width="524" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="2" height="2" background="png/pb/pb_hoek_links2g.PNG"></td>
<td width="20" background="png/pb/pb_onder_g.PNG"></td>
<td width="1" background="png/pb/punt.PNG"></td>
<td width="119" background="png/pb/pb_onder_g.PNG"></td>
<td width="1" background="png/pb/punt.PNG"></td>
<td width="258" background="png/pb/pb_onder_g.PNG"></td>
<td width="1" background="png/pb/punt.PNG"></td>
<td width="120" background="png/pb/pb_onder_g.PNG"></td>
<td width="2" height="2" background="png/pb/pb_hoek_rechts2g.PNG"></td>
</tr>
</table>
<?php
}
}
}
else
{
$query = "SELECT * FROM pb WHERE user='".$_SESSION['naam']."' && id='".htmlspecialchars($_GET['id'])."'";
$result=mysql_query($query) or die (mysql_error());
$mnr = mysql_num_rows($result);
$sql = mysql_fetch_assoc($result);
if ($mnr == "0")
{
echo '<table width="99%" border="0" align="center" cellspacing="0" cellpadding="0">
<tr>
<td class="Tekst">Dit bericht bestaat niet (meer) !</td>
</tr>
</table>';
echo '<table width="524" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="3" background="png/content_onder.PNG"></td>
</tr>
</table>';
}
else
{
echo '<table width="99%" border="0" align="center" cellspacing="0" cellpadding="0">
<tr>
<td class="Tekst">';
echo $sql['bericht'];
echo '</td>
</tr>
</table>';
echo '<table width="524" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="3" background="png/content_onder.PNG"></td>
</tr>
</table>';
}
}
}
}
?>
Mvg. Thomas
Gewijzigd op 01/01/1970 01:00:00 door Thomas
Er zijn nog geen reacties op dit bericht.