Enters
Ik heb een <textarea> om de berichten te lezen.
Maar als de tekst.
TEST
TEST
TEST
is dan staat er gewoon TEST TEST TEST.
Dus zonder enters.
Kan iemand mij daar mee helpen?
Mvg,
Tim Kampherbeek
nl2br() om de output goed weer te geven...
Gebruik Waar moet ik dat neerzetten?
Ik neem aan dat je wel weet hoe een form e.d. werkt. $_POST['textarea'] is een voorbeeld.
Gewijzigd op 01/01/1970 01:00:00 door W W
Dit is het 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
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
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
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
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
<?php
include("config.php");
$dbres = mysql_query("SELECT *,UNIX_TIMESTAMP(`pc`) AS `pc`,UNIX_TIMESTAMP(`transport`) AS `transport`,UNIX_TIMESTAMP(`bc`) AS `bc`,UNIX_TIMESTAMP(`slaap`) AS `slaap`,UNIX_TIMESTAMP(`kc`) AS `kc`,UNIX_TIMESTAMP(`start`) AS `start`,UNIX_TIMESTAMP(`crime`) AS `crime`,UNIX_TIMESTAMP(`ac`) AS `ac` FROM `users` WHERE `login`='{$_SESSION['login']}'");
$data = mysql_fetch_object($dbres);
if (!check_login()) {
header("Location: login.php");
exit;
}
?>
<html>
<head>
<title>Drugsworld</title>
<link rel="stylesheet" type="text/css" href="style.php">
<meta name="keywords" content="Drugsworld">
<meta name="language" content="english">
<META name="description" lang="nl" content="Drugsworld crimegame met pit.">
<style type='text/css'>
td {
text-align: left;
}
img {
margin-right: 4px;
}
</style>
<script language="javascript">
var checked = 0;
function checkAll() {
checked = !checked;
for(i=0; i<document.form1.elements.length; i++)
document.form1.elements[i].checked = checked;
}
</script>
</head>
<body>
<table width="100%" cellspacing="0" cellpadding="1">
<?php
$pp = 10;
$start = ($_GET['n'] >= 0) ? $_GET['n']*$pp : 0;
$page = $_GET['p'];
if($_GET['p']=="inbox"){
$title = ucfirst($_GET['p']);
}
elseif($_GET['p']=="new"){
$title = "Nieuw";
}
elseif($_GET['p']=="send"){
$title = "Verzonden";
}
elseif($_GET['p']=="saved"){
$title = "Opgeslagen";
}
elseif($_GET['p']=="read"){
$title = "Lezen";
}
else{
$title = "Berichten";
}
print <<<ENDHTML
<tr>
<tr><td align=center colspan=4 class=subtitle><b>$title</b></td></tr>
<tr><td class=mainTxt width=25%><a href="?p=inbox">Inbox</a></td><td class=mainTxt width=25%><a href="?p=new">Nieuw bericht</a></td>
<td class=mainTxt width=25%><a href="?p=saved">Opgeslagen</a></td><td class=mainTxt width=25%><a href="?p=send">Verzonden</a></td></tr>
</table>
<table width=100% cellspacing=0 cellpadding=1>
ENDHTML;
if($_GET['p'] == "inbox") {
print "<td class=mainTxt><form name=form1 method=post action=?p=del><table width= 100% cellspacing=0 cellpadding=1><td class=mainTxt>\n";
print "<tr><td width=10 style='padding-left: 5px;'><input type='checkbox' onClick='checkAll()' style='padding: 0px;' /></td> <td class='ag2'><b>Afzender</b></td><td class='ag2' width=225><b>Onderwerp</b></td> <td class='ag2' width=175><b>Datum</b></td><td class='ag2'><b>Actie</b></td></tr>\n";
$dbres = mysql_query("SELECT *,UNIX_TIMESTAMP(`time`) AS `time` FROM `messages` WHERE `to`='{$data->login}' AND `save`='0' ORDER BY `time` DESC LIMIT $start,$pp") or die(mysql_error());
$aantal_berichten = mysql_num_rows($dbres);
if ($aantal_berichten == 0) {
echo "<tr><td class='ag' colspan='5'>Je hebt op dit moment <i>geen</i> berichten.</td></tr>";
}
else {
while ($message = mysql_fetch_object($dbres)) {
if (preg_match('/^\s*$/',$message->subject)) {
$message->subject = "Geen";
}
$from = $message->from;
$time = date('H:i:s d/m/Y',$message->time);
if ($message->read == 1) {
print "<tr><td width=10 class='ag'><input type=checkbox name=id[] value={$message->id}></td> <td class='ag'><a href=\"user.php?x={$message->from}\"><font color=#FFFFFF>{$from}</font></a></td> <td class='ag'><a href=?p=read&id={$message->id}><font color=#FFFFFF>{$message->subject}</font></a></td> <td class='ag'><font color=#FFFFFF>{$time}</font></td> <td class='ag'><a href='?p=del&id[]={$message->id}'><img src=images/img_delete.gif border=0></a><a href='?p=save&id={$message->id}'><img src=images/img_save.gif border=0></a></td></tr>\n";
}
else {
print "<tr><td width=10 class='ag'><input type=checkbox name=id[] value={$message->id}></td> <td class='ag'><b><a href=\"user.php?x={$message->from}\"><font color=#FFFFFF>{$from}</font></a></b></td> <td class='ag'><b><a href=?p=read&id={$message->id}><font color=#FFFFFF>{$message->subject}</font></a></b></td> <td class='ag'><font color=#FFFFFF>{$time}</font></td><td><a href='?p=del&id[]={$message->id}'><img src=images/img_delete.gif border=0></a><a href='?p=save&id={$message->id}'><img src=images/img_save.gif border=0></a></td></tr>\n";
}
}
}
print "</table><input type=submit value=Delete style=\"font-size: 10pt\"></form></td></tr>\n";
$sql = mysql_query("SELECT * FROM `messages` WHERE `to`='{$data->login}' AND `save`='0'");
$rows = mysql_num_rows($sql);
print "</table><tr><td><center>";
if($rows <= $pp){
print "<< < 1 > >>";
}
else {
if($start/$pp == 0){
print "<< < ";
}
else{
print "<a href=\"?p=$page&n=0\"><<</a> <a href=\"?p=$page&n=". ($start/$pp-1) ."\"><</a> ";
}
for($i=0; $i<$rows/$pp; $i++) {
if($i == $start/$pp){
print "<u>". ($i+1) ."</u> ";
}
else{
print "<a href=\"?p=$page&n=$i\">". ($i+1) ."</a> ";
}
}
if($start+$pp >= $rows){
print " > >> ";
}
else{
print "<a href=\"?p=$page&n=". ($start/$pp+1) ."\">></a> <a href=\"?p=$page&n=". (ceil($rows/$pp)-1) ."\">>></a>";
}
}
}
elseif($_GET['p'] == "send") {
print "<td class=mainTxt><table width=100% cellspacing=0 cellpadding=1>\n";
print "<tr><td class='ag2'>Naar</td> <td class='ag2' width=225>Onderwerp</td> <td class='ag2' width=175>Datum</td></tr>\n";
$dbres = mysql_query("SELECT *,UNIX_TIMESTAMP(`time`) AS `time` FROM `messages` WHERE `from`='{$data->login}' AND `save`='0' ORDER BY `time` DESC LIMIT $start,$pp") or die(mysql_error());
while($message = mysql_fetch_object($dbres)) {
if(preg_match('/^\s*$/',$message->subject)){
$message->subject = "Geen";
}
$to = $message->to;
$time = date('H:i:s d/m/Y',$message->time);
if($message->read == 1){
print "<tr><td class='ag'><a href=\"user.php?x={$message->to}\"><font color=#FFFFFF>{$to}</font></a></td> <td class='ag'><a href=?p=read&id={$message->id}><font color=#FFFFFF>{$message->subject}</font></a></td> <td class='ag'><font color=#FFFFFF>{$time}</font></td></tr>\n";
}
else{
print "<tr><td class='ag'><b><a href=\"user.php?x={$message->to}\"><font color=#FFFFFF>{$to}</font></a></b></td> <td class='ag'><b><a href=?p=read&id={$message->id}><font color=#FFFFFF>{$message->subject}</font></a></b></td> <td class='ag'><font color=#FFFFFF>{$time}</font></td></tr>\n";
}
}
print "</table></td></tr>\n";
$sql = mysql_query("SELECT * FROM `messages` WHERE `from`='{$data->login}' AND `save`='0'");
$rows = mysql_num_rows($sql);
print "</table><tr><center>";
if($rows <= $pp){
print "<< < 1 > >>";
}
else {
if($start/$pp == 0){
print "<< < ";
}
else{
print "<a href=\"?p=$page&n=0\"><<</a> <a href=\"?p=$page&n=". ($start/$pp-1) ."\"><</a> ";
}
for($i=0; $i<$rows/$pp; $i++) {
if($i == $start/$pp){
print "<u>". ($i+1) ."</u> ";
}
else{
print "<a href=\"?p=$page&n=$i\">". ($i+1) ."</a> ";
}
}
if($start+$pp >= $rows){
print " > >> ";
}
else{
print "<a href=\"?p=$page&n=". ($start/$pp+1) ."\">></a> <a href=\"?p=$page&n=". (ceil($rows/$pp)-1) ."\">>></a>";
}
}
}
if($_GET['p'] == "saved") {
print "<td class=mainTxt><table width= 100% cellspacing=0 cellpadding=1>\n";
print "<tr><td class='ag2'>Afzender</td> <td class='ag2' width=225>Onderwerp:</td> <td class='ag2' width=175>Datum</td><td class='ag2'>Actie</td></tr>\n";
$dbres = mysql_query("SELECT *,UNIX_TIMESTAMP(`time`) AS `time` FROM `messages` WHERE `to`='{$data->login}' AND `save`='1' ORDER BY `time` DESC LIMIT $start,$pp") or die(mysql_error());
while($message = mysql_fetch_object($dbres)) {
if(preg_match('/^\s*$/',$message->subject)){
$message->subject = "Geen";
}
$from = $message->from;
$time = date('H:i:s d/m/Y',$message->time);
print "<tr><td class='ag'><a href=\"user.php?x={$message->from}\"><font color=#FFFFFF>{$from}</font></a></td> <td class='ag'><a href=?p=read&id={$message->id}><font color=#FFFFFF>{$message->subject}</font></a></td> <td class='ag'><font color=#FFFFFF>{$time}</font></td><td class='ag'><a href='?p=unsave&id={$message->id}'><img src=images/img_unsave.gif border=0></a></td></tr>\n";
}
print "</table></td></tr>\n";
$sql = mysql_query("SELECT * FROM `messages` WHERE `to`='{$data->login}' AND `save`='1'");
$rows = mysql_num_rows($sql);
print "</table><tr><center>";
if($rows <= $pp){
print "<< < 1 > >>";
}
else {
if($start/$pp == 0){
print "<< < ";
}
else{
print "<a href=\"?p=$page&n=0\"><<</a> <a href=\"?p=$page&n=". ($start/$pp-1) ."\"><</a> ";
}
for($i=0; $i<$rows/$pp; $i++) {
if($i == $start/$pp){
print "<u>". ($i+1) ."</u> ";
}
else{
print "<a href=\"?p=$page&n=$i\">". ($i+1) ."</a> ";
}
}
if($start+$pp >= $rows){
print " > >> ";
}
else{
print "<a href=\"?p=$page&n=". ($start/$pp+1) ."\">></a> <a href=\"?p=$page&n=". (ceil($rows/$pp)-1) ."\">>></a>";
}
}
}
elseif($_GET['p'] == "read" && is_numeric($_GET['id'])) {
$dbres = mysql_query("SELECT *,UNIX_TIMESTAMP(`time`) AS `time` FROM `messages` WHERE `id`='{$_GET['id']}' AND (`to`='{$data->login}' OR `from`='{$data->login}')") or die("The message couldn't be opened.");
if($message = mysql_fetch_object($dbres)) {
if($message->to == $data->login)
mysql_query("UPDATE `messages` SET `read`='1' WHERE `id`='{$_GET['id']}'") or die("Couldn't update message status.");
}
$message->message = preg_replace('/(http:\/\/\S+)/','<a href="$1" target=\"_blank\">$1</a>',$message->message);
$message->message = preg_replace("/\[invite](.*?)\[\/invite]/","<a href=invite.php?fam=$1>Accepteren/Weigeren</a>",$message->message);
$message->message = preg_replace("/\[ws](.*?)\[\/ws]/","<a href=ws.php?sell=$1>[x]</a>",$message->message);
$message->message = preg_replace("/\[inc](.*?)\[\/inc]/","<iframe src=\\1>",$message->message);
$message->message = eregi_replace("\\[url=([^\\[]*)\]([^\\[]*)\\[/url\\]","<a href=\"\\1\" target=_blank>\\2</a>",$message->message);
$message->message = eregi_replace("\[b\]","<b>",$message->message);
$message->message = eregi_replace("\[/b\]","</b>",$message->message);
$message->message = eregi_replace("\[i\]","<i>",$message->message);
$message->message = eregi_replace("\[/i\]","</i>",$message->message);
$message->message = eregi_replace("\[s\]","<s>",$message->message);
$message->message = eregi_replace("\[/s\]","</s>",$message->message);
$message->message = eregi_replace("\[u\]","<u>",$message->message);
$message->message = eregi_replace("\[/u\]","</u>",$message->message);
$message->message = eregi_replace("\[move\]","<marquee>",$message->message);
$message->message = eregi_replace("\[/move\]","</marquee>",$message->message);
$message->message = eregi_replace("\[list\]","<UL>",$message->message);
$message->message = eregi_replace("\[/list\]","</UL>",$message->message);
$message->message = eregi_replace("\[\*\]","<LI>",$message->message);
$message->message = eregi_replace("\[small\]","<font size=1>",$message->message);
$message->message = eregi_replace("\[/small\]","</font>",$message->message);
$message->message = eregi_replace("\\[color=([^\\[]*)\]([^\\[]*)\\[/color\\]","<font color=\\1>\\2</font>",$message->message);
$message->message = eregi_replace("\(b\)","<img src=img/biere.gif>",$message->message);
$message->message = eregi_replace("\\[face=([^\\[]*)\]([^\\[]*)\\[/face\\]","<font face=\\1>\\2</font>",$message->message);
$message->message = eregi_replace("\\[size=([^\\[]*)\]([^\\[]*)\\[/size\\]","<font size=\\1>\\2</font>",$message->message);
$message->message = eregi_replace("\(B\)","<img src=img/biere.gif>",$message->message);
$message->message = eregi_replace(":\)","<img src=img/sourire.gif>",$message->message);
$message->message = eregi_replace(":-\)","<img src=img/sourire.gif>",$message->message);
$message->message = eregi_replace(":d","<img src=img/content.gif>",$message->message);
$message->message = eregi_replace(":-D","<img src=img/content.gif>",$message->message);
$message->message = eregi_replace(":-O","<img src=img/OH-2.gif>",$message->message);
$message->message = eregi_replace(":o","<img src=img/OH-1.gif>",$message->message);
$message->message = eregi_replace(":p","<img src=img/langue.gif>",$message->message);
$message->message = eregi_replace(":-P","<img src=img/langue.gif>",$message->message);
$message->message = eregi_replace("\;\)","<img src=img/clin-oeuil.gif>",$message->message);
$message->message = eregi_replace("\;-\)","<img src=img/clin-oeuil.gif>",$message->message);
$message->message = eregi_replace(":\(","<img src=img/triste.gif>",$message->message);
$message->message = eregi_replace(":-\(","<img src=img/triste.gif>",$message->message);
$message->message = eregi_replace(":\|","<img src=img/OH-3.gif>",$message->message);
$message->message = eregi_replace(":-\|","<img src=img/OH-3.gif>",$message->message);
$message->message = eregi_replace(":\'\(","<img src=img/pleure.gif>",$message->message);
$message->message = eregi_replace("\(h\)","<img src=img/cool.gif>",$message->message);
$message->message = eregi_replace("\(H\)","<img src=img/cool.gif>",$message->message);
$message->message = eregi_replace(":-@","<img src=img/enerve1.gif>",$message->message);
$message->message = eregi_replace(":@","<img src=img/enerve2.gif>",$message->message);
$message->message = eregi_replace(":s","<img src=img/roll-eyes.gif>",$message->message);
$message->message = eregi_replace(":-S","<img src=img/roll-eyes.gif>",$message->message);
$message->message = eregi_replace("\(k\)","<img src=img/bouche.gif>",$message->message);
$message->message = eregi_replace("\(K\)","<img src=img/bouche.gif>",$message->message);
$message->message = eregi_replace("\(l\)","<img src=img/coeur.gif>",$message->message);
$message->message = eregi_replace("\(L\)","<img src=img/coeur.gif>",$message->message);
$message->message = eregi_replace("\(u\)","<img src=img/coeur-brise.gif>",$message->message);
$message->message = eregi_replace("\(U\)","<img src=img/coeur-brise.gif>",$message->message);
$message->message = eregi_replace("\;-P","<img src=img/clin-oeuil-langue.gif>",$message->message);
$message->message = eregi_replace("\;p","<img src=img/clin-oeuil-langue.gif>",$message->message);
$message->message = eregi_replace("\(y\)","<img src=img/pouce-oui.gif>",$message->message);
$message->message = eregi_replace("\(Y\)","<img src=img/pouce-oui.gif>",$message->message);
$message->message = eregi_replace("\(n\)","<img src=img/pouce-non.gif>",$message->message);
$message->message = eregi_replace("\(N\)","<img src=img/pouce-non.gif>",$message->message);
$message->message = eregi_replace("\(6\)","<img src=img/diable.gif>",$message->message);
$message->message = eregi_replace("\(d\)","<img src=img/drink.gif>",$message->message);
$message->message = eregi_replace("\(D\)","<img src=img/drink.gif>",$message->message);
$message->message = eregi_replace("_o_","<img src=img/worship.gif>",$message->message);
$message->message = eregi_replace("\(g\)","<img src=img/gun.gif>",$message->message);
$message->message = eregi_replace("\(G\)","<img src=img/guns.gif>",$message->message);
$message->message = str_replace(".nl","",$message->message);
//$message->message = str_replace(".com","",$message->message);
$message->message = str_replace(".net","",$message->message);
$message->message = str_replace(".be","",$message->message);
$message->message = str_replace(".tr","",$message->message);
$message->message = str_replace("pwntyou","",$message->message);
$message->message = str_replace("rapout","",$message->message);
$message->message = str_replace(".lycos","",$message->message);
$message->message = str_replace(".tk","",$message->message);
$message->message = str_replace(".eu","",$message->message);
$message->message = str_replace(".org","",$message->message);
$message->message = str_replace(".biz","",$message->message);
$message->message = str_replace(".de","",$message->message);
$message->message = str_replace(".funpic","",$message->message);
$message->message = str_replace("gamevendetta","",$message->message);
$message->message = str_replace("kanker","******",$message->message);
$message->message = str_replace("tering","******",$message->message);
$message->message = str_replace("tyfus","*****",$message->message);
$message->message = str_replace("drugsworldmemberss","$data->login",$message->message);
$messages = $message->message;
$from = $message->from;
$to = $message->to;
$time = date('H:i:s d/m/Y',$message->time);
echo"
<tr><td class=mainTxt width=100>Tijd: <td class=mainTxt>{$time}</td></tr>
<tr><td class=mainTxt width=100>Van:</td> <td class=mainTxt>{$from}</td></tr>
<tr><td class=mainTxt width=100>Naar:</td> <td class=mainTxt>{$to}</td></tr>
<tr><td class=mainTxt width=100>Onderwerp:</td> <td class=mainTxt>{$message->subject} </td></tr>
<tr><td class=mainTxt width=100>Inhoud:</td> <td class=mainTxt> </td></tr>
<tr><td class=mainTxt colspan=2 width=100%>{$messages}</td></tr>
</table></td></tr>
<tr><td align=\"right\"><table width= 100% cellspacing=0 cellpadding=1>
";
if($message->from != $data->login){
print "<td class=mainTxt align=center width=100><a href='?p=new&to={$message->from}&subject=Re: ". str_replace('Re:','',$message->subject) ."'>Antwoord</a></td> ";
}
else{
print "<tr>";
}
if($message->from != $data->login){
print "<td class=mainTxt align=center width=100><a href='?p=del&id[]={$message->id}'>Delete</a></td></tr>\n";
}
}
elseif($_GET['p'] == "del") {
if(isset($_GET['id'])){
$_POST['id'] = $_GET['id'];
}
foreach($_POST['id'] as $msgid) {
$dbres = mysql_query("SELECT * FROM `messages` WHERE `id`='$msgid' AND (`from`='{$data->login}' OR `to`='{$data->login}')") or die(mysql_error());
if($message = mysql_fetch_object($dbres)) {
if($message->save != 1){
mysql_query("DELETE FROM `messages` WHERE `id`='$msgid'") or die(mysql_error());
}
else{
echo"<td class=mainTxt>Dit bericht staat in je opgeslagen berichtenlijst.</td>";
exit;
}
}
}
echo"<td class=mainTxt>Bericht(en) verwijderd.</td>";
}
elseif($_GET['p'] == "save") {
if(isset($_GET['id'])){
$dbres = mysql_query("SELECT * FROM `messages` WHERE `id`='{$_GET['id']}' AND (`from`='{$data->login}' OR `to`='{$data->login}')") or die(mysql_error());
if($message = mysql_fetch_object($dbres)) {
if($message->save != 1){
mysql_query("UPDATE `messages` SET `save`='1' WHERE `id`='{$_GET['id']}'") or die("Couldn't update message status.");
}
else{
echo"<td class=mainTxt>Dit bericht is reeds opgeslagen.</td>";
exit;
}
echo"<td class=mainTxt>Bericht opgeslagen.</td>";
}
}
}
elseif($_GET['p'] == "unsave") {
if(isset($_GET['id'])){
$dbres = mysql_query("SELECT * FROM `messages` WHERE `id`='{$_GET['id']}' AND (`from`='{$data->login}' OR `to`='{$data->login}')") or die(mysql_error());
if($message = mysql_fetch_object($dbres)) {
if($message->save != 0){
mysql_query("UPDATE `messages` SET `save`='0' WHERE `id`='{$_GET['id']}'") or die("Couldn't update message status.");
}
else{
echo"<td class=mainTxt>Dit bericht is niet opgeslagen.</td>";
exit;
}
echo"<td class=mainTxt>Bericht verwijderd uit opgeslagen berichtenlijst.</td>";
}
}
}
elseif($_GET['p'] == "new") {
if(isset($_POST['to'],$_POST['message'])) {
if($_POST['to'] != $data->login) {
$dbres = mysql_query("SELECT * FROM `users` WHERE `login`='{$_POST['to']}'") or die("Kon de gegevens niet uit de database halen. Sorry voor het ongemak.");
$info = mysql_fetch_object($dbres);
if($info == false){
print "<td class=mainTxt>'{$_POST['to']}' bestaat niet.</td>";
}
elseif($info->activated == 0){
print "<tr><td class=mainTxt>'{$_POST['to']}' heeft zijn account niet geactiveerd.</td></tr>";
}
elseif($_POST['verify'] != $_SESSION['verify']){
echo "<tr><td class=mainTxt>De code die je hebt ingevoerd komt niet overeen met het plaatje.</td></tr>";
}
else {
$subject = preg_replace('/</','<',$_POST['subject']);
$message = preg_replace('/</','<',$_POST['message']);
$dbres = mysql_query("SELECT `id` FROM `users` WHERE `login`='{$_POST['to']}'") or die(mysql_error());
if($recp = mysql_fetch_object($dbres)) {
mysql_query("INSERT INTO `messages`(`time`,`from`,`to`,`subject`,`message`) values(NOW(),'{$data->login}','{$_POST['to']}','{$subject}','{$message}')") or die("Het bericht kon niet verzonden worden.");
print "<td class=mainTxt>Bericht verzonden.</td>"; exit ;
}
}
}
else{
print "<tr><td class=mainTxt>Je kan geen bericht naar jezelf sturen.</td></tr>";
}
}
$_REQUEST['message'] = stripslashes($_REQUEST['message']);
echo"
<td class=mainTxt><table width=100% cellspacing=0 cellpadding=1><tr>
<td>
<form name=\"form1\" method=\"POST\" action=\"?p=new\">
<tr><td width=100>Naar:</td> <td><input type=\"text\" name=\"to\" value=\"{$_REQUEST['to']}\" maxlength=16></td></tr>
<tr><td width=100>Onderwerp:</td> <td><input type=\"text\" name=\"subject\" value=\"{$_REQUEST['subject']}\" maxlength=25></td></tr>
<tr><td width=100 valign=\"top\">Bericht:<br><br>
</td><td><textarea name=\"message\" cols=40 rows=10>{$_REQUEST['message']}</textarea></td></tr>
<tr><td width=100>Je code is:</td> <td><img src=img.php></td></tr>
<tr><td align=100>Typ hier de code in:</td> <td><input type=text name=verify></td></tr>
<tr><td width=100></td><td><input type=\"submit\" name=\"submit\" value=\"Verzenden\"></td></tr>
";
}
?>
include("config.php");
$dbres = mysql_query("SELECT *,UNIX_TIMESTAMP(`pc`) AS `pc`,UNIX_TIMESTAMP(`transport`) AS `transport`,UNIX_TIMESTAMP(`bc`) AS `bc`,UNIX_TIMESTAMP(`slaap`) AS `slaap`,UNIX_TIMESTAMP(`kc`) AS `kc`,UNIX_TIMESTAMP(`start`) AS `start`,UNIX_TIMESTAMP(`crime`) AS `crime`,UNIX_TIMESTAMP(`ac`) AS `ac` FROM `users` WHERE `login`='{$_SESSION['login']}'");
$data = mysql_fetch_object($dbres);
if (!check_login()) {
header("Location: login.php");
exit;
}
?>
<html>
<head>
<title>Drugsworld</title>
<link rel="stylesheet" type="text/css" href="style.php">
<meta name="keywords" content="Drugsworld">
<meta name="language" content="english">
<META name="description" lang="nl" content="Drugsworld crimegame met pit.">
<style type='text/css'>
td {
text-align: left;
}
img {
margin-right: 4px;
}
</style>
<script language="javascript">
var checked = 0;
function checkAll() {
checked = !checked;
for(i=0; i<document.form1.elements.length; i++)
document.form1.elements[i].checked = checked;
}
</script>
</head>
<body>
<table width="100%" cellspacing="0" cellpadding="1">
<?php
$pp = 10;
$start = ($_GET['n'] >= 0) ? $_GET['n']*$pp : 0;
$page = $_GET['p'];
if($_GET['p']=="inbox"){
$title = ucfirst($_GET['p']);
}
elseif($_GET['p']=="new"){
$title = "Nieuw";
}
elseif($_GET['p']=="send"){
$title = "Verzonden";
}
elseif($_GET['p']=="saved"){
$title = "Opgeslagen";
}
elseif($_GET['p']=="read"){
$title = "Lezen";
}
else{
$title = "Berichten";
}
print <<<ENDHTML
<tr>
<tr><td align=center colspan=4 class=subtitle><b>$title</b></td></tr>
<tr><td class=mainTxt width=25%><a href="?p=inbox">Inbox</a></td><td class=mainTxt width=25%><a href="?p=new">Nieuw bericht</a></td>
<td class=mainTxt width=25%><a href="?p=saved">Opgeslagen</a></td><td class=mainTxt width=25%><a href="?p=send">Verzonden</a></td></tr>
</table>
<table width=100% cellspacing=0 cellpadding=1>
ENDHTML;
if($_GET['p'] == "inbox") {
print "<td class=mainTxt><form name=form1 method=post action=?p=del><table width= 100% cellspacing=0 cellpadding=1><td class=mainTxt>\n";
print "<tr><td width=10 style='padding-left: 5px;'><input type='checkbox' onClick='checkAll()' style='padding: 0px;' /></td> <td class='ag2'><b>Afzender</b></td><td class='ag2' width=225><b>Onderwerp</b></td> <td class='ag2' width=175><b>Datum</b></td><td class='ag2'><b>Actie</b></td></tr>\n";
$dbres = mysql_query("SELECT *,UNIX_TIMESTAMP(`time`) AS `time` FROM `messages` WHERE `to`='{$data->login}' AND `save`='0' ORDER BY `time` DESC LIMIT $start,$pp") or die(mysql_error());
$aantal_berichten = mysql_num_rows($dbres);
if ($aantal_berichten == 0) {
echo "<tr><td class='ag' colspan='5'>Je hebt op dit moment <i>geen</i> berichten.</td></tr>";
}
else {
while ($message = mysql_fetch_object($dbres)) {
if (preg_match('/^\s*$/',$message->subject)) {
$message->subject = "Geen";
}
$from = $message->from;
$time = date('H:i:s d/m/Y',$message->time);
if ($message->read == 1) {
print "<tr><td width=10 class='ag'><input type=checkbox name=id[] value={$message->id}></td> <td class='ag'><a href=\"user.php?x={$message->from}\"><font color=#FFFFFF>{$from}</font></a></td> <td class='ag'><a href=?p=read&id={$message->id}><font color=#FFFFFF>{$message->subject}</font></a></td> <td class='ag'><font color=#FFFFFF>{$time}</font></td> <td class='ag'><a href='?p=del&id[]={$message->id}'><img src=images/img_delete.gif border=0></a><a href='?p=save&id={$message->id}'><img src=images/img_save.gif border=0></a></td></tr>\n";
}
else {
print "<tr><td width=10 class='ag'><input type=checkbox name=id[] value={$message->id}></td> <td class='ag'><b><a href=\"user.php?x={$message->from}\"><font color=#FFFFFF>{$from}</font></a></b></td> <td class='ag'><b><a href=?p=read&id={$message->id}><font color=#FFFFFF>{$message->subject}</font></a></b></td> <td class='ag'><font color=#FFFFFF>{$time}</font></td><td><a href='?p=del&id[]={$message->id}'><img src=images/img_delete.gif border=0></a><a href='?p=save&id={$message->id}'><img src=images/img_save.gif border=0></a></td></tr>\n";
}
}
}
print "</table><input type=submit value=Delete style=\"font-size: 10pt\"></form></td></tr>\n";
$sql = mysql_query("SELECT * FROM `messages` WHERE `to`='{$data->login}' AND `save`='0'");
$rows = mysql_num_rows($sql);
print "</table><tr><td><center>";
if($rows <= $pp){
print "<< < 1 > >>";
}
else {
if($start/$pp == 0){
print "<< < ";
}
else{
print "<a href=\"?p=$page&n=0\"><<</a> <a href=\"?p=$page&n=". ($start/$pp-1) ."\"><</a> ";
}
for($i=0; $i<$rows/$pp; $i++) {
if($i == $start/$pp){
print "<u>". ($i+1) ."</u> ";
}
else{
print "<a href=\"?p=$page&n=$i\">". ($i+1) ."</a> ";
}
}
if($start+$pp >= $rows){
print " > >> ";
}
else{
print "<a href=\"?p=$page&n=". ($start/$pp+1) ."\">></a> <a href=\"?p=$page&n=". (ceil($rows/$pp)-1) ."\">>></a>";
}
}
}
elseif($_GET['p'] == "send") {
print "<td class=mainTxt><table width=100% cellspacing=0 cellpadding=1>\n";
print "<tr><td class='ag2'>Naar</td> <td class='ag2' width=225>Onderwerp</td> <td class='ag2' width=175>Datum</td></tr>\n";
$dbres = mysql_query("SELECT *,UNIX_TIMESTAMP(`time`) AS `time` FROM `messages` WHERE `from`='{$data->login}' AND `save`='0' ORDER BY `time` DESC LIMIT $start,$pp") or die(mysql_error());
while($message = mysql_fetch_object($dbres)) {
if(preg_match('/^\s*$/',$message->subject)){
$message->subject = "Geen";
}
$to = $message->to;
$time = date('H:i:s d/m/Y',$message->time);
if($message->read == 1){
print "<tr><td class='ag'><a href=\"user.php?x={$message->to}\"><font color=#FFFFFF>{$to}</font></a></td> <td class='ag'><a href=?p=read&id={$message->id}><font color=#FFFFFF>{$message->subject}</font></a></td> <td class='ag'><font color=#FFFFFF>{$time}</font></td></tr>\n";
}
else{
print "<tr><td class='ag'><b><a href=\"user.php?x={$message->to}\"><font color=#FFFFFF>{$to}</font></a></b></td> <td class='ag'><b><a href=?p=read&id={$message->id}><font color=#FFFFFF>{$message->subject}</font></a></b></td> <td class='ag'><font color=#FFFFFF>{$time}</font></td></tr>\n";
}
}
print "</table></td></tr>\n";
$sql = mysql_query("SELECT * FROM `messages` WHERE `from`='{$data->login}' AND `save`='0'");
$rows = mysql_num_rows($sql);
print "</table><tr><center>";
if($rows <= $pp){
print "<< < 1 > >>";
}
else {
if($start/$pp == 0){
print "<< < ";
}
else{
print "<a href=\"?p=$page&n=0\"><<</a> <a href=\"?p=$page&n=". ($start/$pp-1) ."\"><</a> ";
}
for($i=0; $i<$rows/$pp; $i++) {
if($i == $start/$pp){
print "<u>". ($i+1) ."</u> ";
}
else{
print "<a href=\"?p=$page&n=$i\">". ($i+1) ."</a> ";
}
}
if($start+$pp >= $rows){
print " > >> ";
}
else{
print "<a href=\"?p=$page&n=". ($start/$pp+1) ."\">></a> <a href=\"?p=$page&n=". (ceil($rows/$pp)-1) ."\">>></a>";
}
}
}
if($_GET['p'] == "saved") {
print "<td class=mainTxt><table width= 100% cellspacing=0 cellpadding=1>\n";
print "<tr><td class='ag2'>Afzender</td> <td class='ag2' width=225>Onderwerp:</td> <td class='ag2' width=175>Datum</td><td class='ag2'>Actie</td></tr>\n";
$dbres = mysql_query("SELECT *,UNIX_TIMESTAMP(`time`) AS `time` FROM `messages` WHERE `to`='{$data->login}' AND `save`='1' ORDER BY `time` DESC LIMIT $start,$pp") or die(mysql_error());
while($message = mysql_fetch_object($dbres)) {
if(preg_match('/^\s*$/',$message->subject)){
$message->subject = "Geen";
}
$from = $message->from;
$time = date('H:i:s d/m/Y',$message->time);
print "<tr><td class='ag'><a href=\"user.php?x={$message->from}\"><font color=#FFFFFF>{$from}</font></a></td> <td class='ag'><a href=?p=read&id={$message->id}><font color=#FFFFFF>{$message->subject}</font></a></td> <td class='ag'><font color=#FFFFFF>{$time}</font></td><td class='ag'><a href='?p=unsave&id={$message->id}'><img src=images/img_unsave.gif border=0></a></td></tr>\n";
}
print "</table></td></tr>\n";
$sql = mysql_query("SELECT * FROM `messages` WHERE `to`='{$data->login}' AND `save`='1'");
$rows = mysql_num_rows($sql);
print "</table><tr><center>";
if($rows <= $pp){
print "<< < 1 > >>";
}
else {
if($start/$pp == 0){
print "<< < ";
}
else{
print "<a href=\"?p=$page&n=0\"><<</a> <a href=\"?p=$page&n=". ($start/$pp-1) ."\"><</a> ";
}
for($i=0; $i<$rows/$pp; $i++) {
if($i == $start/$pp){
print "<u>". ($i+1) ."</u> ";
}
else{
print "<a href=\"?p=$page&n=$i\">". ($i+1) ."</a> ";
}
}
if($start+$pp >= $rows){
print " > >> ";
}
else{
print "<a href=\"?p=$page&n=". ($start/$pp+1) ."\">></a> <a href=\"?p=$page&n=". (ceil($rows/$pp)-1) ."\">>></a>";
}
}
}
elseif($_GET['p'] == "read" && is_numeric($_GET['id'])) {
$dbres = mysql_query("SELECT *,UNIX_TIMESTAMP(`time`) AS `time` FROM `messages` WHERE `id`='{$_GET['id']}' AND (`to`='{$data->login}' OR `from`='{$data->login}')") or die("The message couldn't be opened.");
if($message = mysql_fetch_object($dbres)) {
if($message->to == $data->login)
mysql_query("UPDATE `messages` SET `read`='1' WHERE `id`='{$_GET['id']}'") or die("Couldn't update message status.");
}
$message->message = preg_replace('/(http:\/\/\S+)/','<a href="$1" target=\"_blank\">$1</a>',$message->message);
$message->message = preg_replace("/\[invite](.*?)\[\/invite]/","<a href=invite.php?fam=$1>Accepteren/Weigeren</a>",$message->message);
$message->message = preg_replace("/\[ws](.*?)\[\/ws]/","<a href=ws.php?sell=$1>[x]</a>",$message->message);
$message->message = preg_replace("/\[inc](.*?)\[\/inc]/","<iframe src=\\1>",$message->message);
$message->message = eregi_replace("\\[url=([^\\[]*)\]([^\\[]*)\\[/url\\]","<a href=\"\\1\" target=_blank>\\2</a>",$message->message);
$message->message = eregi_replace("\[b\]","<b>",$message->message);
$message->message = eregi_replace("\[/b\]","</b>",$message->message);
$message->message = eregi_replace("\[i\]","<i>",$message->message);
$message->message = eregi_replace("\[/i\]","</i>",$message->message);
$message->message = eregi_replace("\[s\]","<s>",$message->message);
$message->message = eregi_replace("\[/s\]","</s>",$message->message);
$message->message = eregi_replace("\[u\]","<u>",$message->message);
$message->message = eregi_replace("\[/u\]","</u>",$message->message);
$message->message = eregi_replace("\[move\]","<marquee>",$message->message);
$message->message = eregi_replace("\[/move\]","</marquee>",$message->message);
$message->message = eregi_replace("\[list\]","<UL>",$message->message);
$message->message = eregi_replace("\[/list\]","</UL>",$message->message);
$message->message = eregi_replace("\[\*\]","<LI>",$message->message);
$message->message = eregi_replace("\[small\]","<font size=1>",$message->message);
$message->message = eregi_replace("\[/small\]","</font>",$message->message);
$message->message = eregi_replace("\\[color=([^\\[]*)\]([^\\[]*)\\[/color\\]","<font color=\\1>\\2</font>",$message->message);
$message->message = eregi_replace("\(b\)","<img src=img/biere.gif>",$message->message);
$message->message = eregi_replace("\\[face=([^\\[]*)\]([^\\[]*)\\[/face\\]","<font face=\\1>\\2</font>",$message->message);
$message->message = eregi_replace("\\[size=([^\\[]*)\]([^\\[]*)\\[/size\\]","<font size=\\1>\\2</font>",$message->message);
$message->message = eregi_replace("\(B\)","<img src=img/biere.gif>",$message->message);
$message->message = eregi_replace(":\)","<img src=img/sourire.gif>",$message->message);
$message->message = eregi_replace(":-\)","<img src=img/sourire.gif>",$message->message);
$message->message = eregi_replace(":d","<img src=img/content.gif>",$message->message);
$message->message = eregi_replace(":-D","<img src=img/content.gif>",$message->message);
$message->message = eregi_replace(":-O","<img src=img/OH-2.gif>",$message->message);
$message->message = eregi_replace(":o","<img src=img/OH-1.gif>",$message->message);
$message->message = eregi_replace(":p","<img src=img/langue.gif>",$message->message);
$message->message = eregi_replace(":-P","<img src=img/langue.gif>",$message->message);
$message->message = eregi_replace("\;\)","<img src=img/clin-oeuil.gif>",$message->message);
$message->message = eregi_replace("\;-\)","<img src=img/clin-oeuil.gif>",$message->message);
$message->message = eregi_replace(":\(","<img src=img/triste.gif>",$message->message);
$message->message = eregi_replace(":-\(","<img src=img/triste.gif>",$message->message);
$message->message = eregi_replace(":\|","<img src=img/OH-3.gif>",$message->message);
$message->message = eregi_replace(":-\|","<img src=img/OH-3.gif>",$message->message);
$message->message = eregi_replace(":\'\(","<img src=img/pleure.gif>",$message->message);
$message->message = eregi_replace("\(h\)","<img src=img/cool.gif>",$message->message);
$message->message = eregi_replace("\(H\)","<img src=img/cool.gif>",$message->message);
$message->message = eregi_replace(":-@","<img src=img/enerve1.gif>",$message->message);
$message->message = eregi_replace(":@","<img src=img/enerve2.gif>",$message->message);
$message->message = eregi_replace(":s","<img src=img/roll-eyes.gif>",$message->message);
$message->message = eregi_replace(":-S","<img src=img/roll-eyes.gif>",$message->message);
$message->message = eregi_replace("\(k\)","<img src=img/bouche.gif>",$message->message);
$message->message = eregi_replace("\(K\)","<img src=img/bouche.gif>",$message->message);
$message->message = eregi_replace("\(l\)","<img src=img/coeur.gif>",$message->message);
$message->message = eregi_replace("\(L\)","<img src=img/coeur.gif>",$message->message);
$message->message = eregi_replace("\(u\)","<img src=img/coeur-brise.gif>",$message->message);
$message->message = eregi_replace("\(U\)","<img src=img/coeur-brise.gif>",$message->message);
$message->message = eregi_replace("\;-P","<img src=img/clin-oeuil-langue.gif>",$message->message);
$message->message = eregi_replace("\;p","<img src=img/clin-oeuil-langue.gif>",$message->message);
$message->message = eregi_replace("\(y\)","<img src=img/pouce-oui.gif>",$message->message);
$message->message = eregi_replace("\(Y\)","<img src=img/pouce-oui.gif>",$message->message);
$message->message = eregi_replace("\(n\)","<img src=img/pouce-non.gif>",$message->message);
$message->message = eregi_replace("\(N\)","<img src=img/pouce-non.gif>",$message->message);
$message->message = eregi_replace("\(6\)","<img src=img/diable.gif>",$message->message);
$message->message = eregi_replace("\(d\)","<img src=img/drink.gif>",$message->message);
$message->message = eregi_replace("\(D\)","<img src=img/drink.gif>",$message->message);
$message->message = eregi_replace("_o_","<img src=img/worship.gif>",$message->message);
$message->message = eregi_replace("\(g\)","<img src=img/gun.gif>",$message->message);
$message->message = eregi_replace("\(G\)","<img src=img/guns.gif>",$message->message);
$message->message = str_replace(".nl","",$message->message);
//$message->message = str_replace(".com","",$message->message);
$message->message = str_replace(".net","",$message->message);
$message->message = str_replace(".be","",$message->message);
$message->message = str_replace(".tr","",$message->message);
$message->message = str_replace("pwntyou","",$message->message);
$message->message = str_replace("rapout","",$message->message);
$message->message = str_replace(".lycos","",$message->message);
$message->message = str_replace(".tk","",$message->message);
$message->message = str_replace(".eu","",$message->message);
$message->message = str_replace(".org","",$message->message);
$message->message = str_replace(".biz","",$message->message);
$message->message = str_replace(".de","",$message->message);
$message->message = str_replace(".funpic","",$message->message);
$message->message = str_replace("gamevendetta","",$message->message);
$message->message = str_replace("kanker","******",$message->message);
$message->message = str_replace("tering","******",$message->message);
$message->message = str_replace("tyfus","*****",$message->message);
$message->message = str_replace("drugsworldmemberss","$data->login",$message->message);
$messages = $message->message;
$from = $message->from;
$to = $message->to;
$time = date('H:i:s d/m/Y',$message->time);
echo"
<tr><td class=mainTxt width=100>Tijd: <td class=mainTxt>{$time}</td></tr>
<tr><td class=mainTxt width=100>Van:</td> <td class=mainTxt>{$from}</td></tr>
<tr><td class=mainTxt width=100>Naar:</td> <td class=mainTxt>{$to}</td></tr>
<tr><td class=mainTxt width=100>Onderwerp:</td> <td class=mainTxt>{$message->subject} </td></tr>
<tr><td class=mainTxt width=100>Inhoud:</td> <td class=mainTxt> </td></tr>
<tr><td class=mainTxt colspan=2 width=100%>{$messages}</td></tr>
</table></td></tr>
<tr><td align=\"right\"><table width= 100% cellspacing=0 cellpadding=1>
";
if($message->from != $data->login){
print "<td class=mainTxt align=center width=100><a href='?p=new&to={$message->from}&subject=Re: ". str_replace('Re:','',$message->subject) ."'>Antwoord</a></td> ";
}
else{
print "<tr>";
}
if($message->from != $data->login){
print "<td class=mainTxt align=center width=100><a href='?p=del&id[]={$message->id}'>Delete</a></td></tr>\n";
}
}
elseif($_GET['p'] == "del") {
if(isset($_GET['id'])){
$_POST['id'] = $_GET['id'];
}
foreach($_POST['id'] as $msgid) {
$dbres = mysql_query("SELECT * FROM `messages` WHERE `id`='$msgid' AND (`from`='{$data->login}' OR `to`='{$data->login}')") or die(mysql_error());
if($message = mysql_fetch_object($dbres)) {
if($message->save != 1){
mysql_query("DELETE FROM `messages` WHERE `id`='$msgid'") or die(mysql_error());
}
else{
echo"<td class=mainTxt>Dit bericht staat in je opgeslagen berichtenlijst.</td>";
exit;
}
}
}
echo"<td class=mainTxt>Bericht(en) verwijderd.</td>";
}
elseif($_GET['p'] == "save") {
if(isset($_GET['id'])){
$dbres = mysql_query("SELECT * FROM `messages` WHERE `id`='{$_GET['id']}' AND (`from`='{$data->login}' OR `to`='{$data->login}')") or die(mysql_error());
if($message = mysql_fetch_object($dbres)) {
if($message->save != 1){
mysql_query("UPDATE `messages` SET `save`='1' WHERE `id`='{$_GET['id']}'") or die("Couldn't update message status.");
}
else{
echo"<td class=mainTxt>Dit bericht is reeds opgeslagen.</td>";
exit;
}
echo"<td class=mainTxt>Bericht opgeslagen.</td>";
}
}
}
elseif($_GET['p'] == "unsave") {
if(isset($_GET['id'])){
$dbres = mysql_query("SELECT * FROM `messages` WHERE `id`='{$_GET['id']}' AND (`from`='{$data->login}' OR `to`='{$data->login}')") or die(mysql_error());
if($message = mysql_fetch_object($dbres)) {
if($message->save != 0){
mysql_query("UPDATE `messages` SET `save`='0' WHERE `id`='{$_GET['id']}'") or die("Couldn't update message status.");
}
else{
echo"<td class=mainTxt>Dit bericht is niet opgeslagen.</td>";
exit;
}
echo"<td class=mainTxt>Bericht verwijderd uit opgeslagen berichtenlijst.</td>";
}
}
}
elseif($_GET['p'] == "new") {
if(isset($_POST['to'],$_POST['message'])) {
if($_POST['to'] != $data->login) {
$dbres = mysql_query("SELECT * FROM `users` WHERE `login`='{$_POST['to']}'") or die("Kon de gegevens niet uit de database halen. Sorry voor het ongemak.");
$info = mysql_fetch_object($dbres);
if($info == false){
print "<td class=mainTxt>'{$_POST['to']}' bestaat niet.</td>";
}
elseif($info->activated == 0){
print "<tr><td class=mainTxt>'{$_POST['to']}' heeft zijn account niet geactiveerd.</td></tr>";
}
elseif($_POST['verify'] != $_SESSION['verify']){
echo "<tr><td class=mainTxt>De code die je hebt ingevoerd komt niet overeen met het plaatje.</td></tr>";
}
else {
$subject = preg_replace('/</','<',$_POST['subject']);
$message = preg_replace('/</','<',$_POST['message']);
$dbres = mysql_query("SELECT `id` FROM `users` WHERE `login`='{$_POST['to']}'") or die(mysql_error());
if($recp = mysql_fetch_object($dbres)) {
mysql_query("INSERT INTO `messages`(`time`,`from`,`to`,`subject`,`message`) values(NOW(),'{$data->login}','{$_POST['to']}','{$subject}','{$message}')") or die("Het bericht kon niet verzonden worden.");
print "<td class=mainTxt>Bericht verzonden.</td>"; exit ;
}
}
}
else{
print "<tr><td class=mainTxt>Je kan geen bericht naar jezelf sturen.</td></tr>";
}
}
$_REQUEST['message'] = stripslashes($_REQUEST['message']);
echo"
<td class=mainTxt><table width=100% cellspacing=0 cellpadding=1><tr>
<td>
<form name=\"form1\" method=\"POST\" action=\"?p=new\">
<tr><td width=100>Naar:</td> <td><input type=\"text\" name=\"to\" value=\"{$_REQUEST['to']}\" maxlength=16></td></tr>
<tr><td width=100>Onderwerp:</td> <td><input type=\"text\" name=\"subject\" value=\"{$_REQUEST['subject']}\" maxlength=25></td></tr>
<tr><td width=100 valign=\"top\">Bericht:<br><br>
</td><td><textarea name=\"message\" cols=40 rows=10>{$_REQUEST['message']}</textarea></td></tr>
<tr><td width=100>Je code is:</td> <td><img src=img.php></td></tr>
<tr><td align=100>Typ hier de code in:</td> <td><input type=text name=verify></td></tr>
<tr><td width=100></td><td><input type=\"submit\" name=\"submit\" value=\"Verzenden\"></td></tr>
";
}
?>
Op rij 315 zie je de code {$messages} staan.. Die geeft de tekst uit de database maar dan zonder enters.
Gewijzigd op 01/01/1970 01:00:00 door Tim Kampherbeek
Als je code plaatst, plaats dan relevante code! Dus bijvoorbeeld alleen het stukje waar je de tekst echot waar het probleem in zit...
ps.
Quote:
Variabelen buiten quotes halen en nl2br() toepassen. Dus iets als:Op rij 315 zie je de code {$messages} staan..
Gewijzigd op 01/01/1970 01:00:00 door Joren de Wit
Je zegt "Het lukt niet". Wat heb je al geprobeerd? En heb je dit zelf gescript?
Hartelijk bedankt.
Code (php)
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
<?php
echo '<tr><td class=mainTxt width=100>Tijd: <td class=mainTxt>'.$time.'</td></tr>
<tr><td class=mainTxt width=100>Van:</td> <td class=mainTxt>'.$from.'</td></tr>
<tr><td class=mainTxt width=100>Naar:</td> <td class=mainTxt>'.$to.'</td></tr>
<tr><td class=mainTxt width=100>Onderwerp:</td> <td class=mainTxt>'.$message->subject.' </td></tr>
<tr><td class=mainTxt width=100>Inhoud:</td> <td class=mainTxt> </td></tr>
<tr><td class=mainTxt colspan=2 width=100%>'.nl2br($messages).'</td></tr>
</table></td></tr>
<tr><td align="right"><table width= 100% cellspacing=0 cellpadding=1>';
?>
echo '<tr><td class=mainTxt width=100>Tijd: <td class=mainTxt>'.$time.'</td></tr>
<tr><td class=mainTxt width=100>Van:</td> <td class=mainTxt>'.$from.'</td></tr>
<tr><td class=mainTxt width=100>Naar:</td> <td class=mainTxt>'.$to.'</td></tr>
<tr><td class=mainTxt width=100>Onderwerp:</td> <td class=mainTxt>'.$message->subject.' </td></tr>
<tr><td class=mainTxt width=100>Inhoud:</td> <td class=mainTxt> </td></tr>
<tr><td class=mainTxt colspan=2 width=100%>'.nl2br($messages).'</td></tr>
</table></td></tr>
<tr><td align="right"><table width= 100% cellspacing=0 cellpadding=1>';
?>
ps. Kijk ook eens hoe ik de enkele en dubbele quotes gebruik, en hoe ik de variabele buiten quotes haal...
Gewijzigd op 01/01/1970 01:00:00 door Joren de Wit
Tim Kampherbeek schreef op 27.12.2007 22:21:
maar ik snap er niks van...
Ik wil je best helpen, maar je moet zelf ook laten zien wat je geprobeerd hebt. Daarnaast zijn er regels over posten op het forum. Ik adviseer je deze te lezen.
Blanche THNX man echt Thnx.. Toppie hij doet het:D