Script wordt niet goed uitgevoerd

Overzicht Reageren

Sponsored by: Vacatures door Monsterboard

Pagina: 1 2 volgende »

Yannick decock

yannick decock

03/09/2019 14:44:52
Quote Anchor link
de error is dat de pagina niet word weergegeven en dat men programma aantal lijnen zoals dit als fout weergeeft idd is dit een oude php code geweest dat we aan het debuggen zijn naar mysqli


Code (php)
PHP script in nieuw venster Selecteer het PHP script
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
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
<?php

error_reporting(E_ALL);

if(!isset($config['paths']))
{

    $config['paths']['includes'] = '../private_html/';
    $config['paths']['contents'] = '';
}


include($config['paths']['includes'] . "_include-config.php");
if(!check_login()) {
    header("Location: /login.php");
    exit;
}

include($config['paths']['includes'] . "_include-ubb-codes.php");

if($data->clanlevel > 0) {
    $crew_ranks                = query("SELECT crew_ranks FROM ea_crews WHERE name='".$data->clan."' LIMIT 1", "fetch_row");
    $crewranks                = split("\n", $crew_ranks[0]);
    $crew_ranks                = array();
    foreach($crewranks as $key => $value) {
        $row                    = split("::", $value);
        $crew_ranks[$row[0]]    = $row[2]; // ID = RIGHTS
        $crew_ranks_names[$row[0]]    = $row[1];
    }

    
    $data->clanlevel        = (isset($crew_ranks[$data->clanlevel])) ? $crew_ranks[$data->clanlevel] : 1;
}


$languages_a = array("EN", "NL");

$language        = (isset($data->lang) AND in_array($data->lang, $languages_a)) ? $data->lang : "EN";

if(!in_array($language, $languages_a))
    $language        = 'EN';

include("translations/".$language."/news.php");

if(isset($_GET['addreply']) AND is_numeric($_GET['addreply']))
    $head = "<script language=\"JavaScript\" type=\"text/javascript\" src=\"/reply.js\"></script>\n";
else
    $head = '';

$head .= "<script type=\"text/javascript\" src=\"/userinfo.js\"></script>";

$echo = "";

$data_1                = query("SELECT dateofbirth FROM ea_users_optional WHERE id=".$data->id." LIMIT 1", "fetch_row");
if($data_1) {
    $dateofbirth        = explode("-", $data_1[0]);
    
    if($dateofbirth[1] == myGMTtime($time, $data->GMT, "m") AND $dateofbirth[2] == myGMTtime($time, $data->GMT, "d"))
        echo "<div style=\"position: absolute; top: 0; left: 0; width: 100%; height: 100%; background-color: #202020; visibility: visible;\" id=\"hideThis\" onClick=\"document.getElementById('hideThis').style.visibility='hidden';\"><table width=\"100%\" height=\"100%\"><tr><td valign=\"middle\" align=\"center\"><img src=\"http://i161.photobucket.com/albums/t205/Inzult/EA-Birthday.gif\" alt=\"Happy birthday!\"></td></tr></table></div>";
}


if(isset($_GET['read'])) {
    top_layout("", $translations['title'], $head);
    if(is_numeric($_GET['read'])) {
        $read_article = query("SELECT id, login, date, title, text, votes_points, votes_amount, votes_users, change_by, change_date, crew FROM ea_area_off_topic WHERE id=".$_GET['read']." AND (crew='Any crew' OR crew='".$data->clan."') LIMIT 1", "fetch_assoc");
        if($read_article) {
            if(isset($_GET['delete_reply'])) {
                if($data->level >= 3 OR (checkpermissions($data->clanlevel, $config['crew_rights_reversed']['Moderate crew news']) AND $read_article['crew'] == $data->clan)) {
                    if(is_numeric($_GET['delete_reply'])) {
                        $excist                    = query("SELECT id FROM ea_area_off_topic_replies WHERE id=".htmlspecialchars($_GET['delete_reply'])." LIMIT 1", "num_rows");
                        if($excist == 1) {
                            query("DELETE FROM ea_area_off_topic_replies WHERE id=".htmlspecialchars($_GET['delete_reply'])." LIMIT 1");
                            echo $translations['reply_deleted'];
                        }
else
                            echo "<font color=red>".$translations['reply_deleted']."</font>";
                    }
else
                        echo "<font color=red>".$translations['invalid_id']."</font>";
                }
else
                    echo "<font color=red>".$translations['no_rights_delete_reply']."</font>";
            }


            $disabled        = (in_array($data->id, explode(",", $read_article['votes_users']))) ? " DISABLED" : "";

            if(isset($_POST['vote']) AND is_numeric($_POST['vote']) AND $_POST['vote'] >= 0 AND $_POST['vote'] <= 5) {
                if(isset($data, $data->id) AND is_numeric($data->id)) {
                    if(!in_array($data->id, explode(",", $read_article['votes_users']))) {
                        query("UPDATE ea_area_off_topic SET votes_amount=votes_amount+1, votes_points=votes_points+".$_POST['vote'].", votes_users='".$read_article['votes_users'].$data->id.",' WHERE id=".$_GET['read']." AND (crew='Any crew' OR crew='".$data->clan."') LIMIT 1");
                        $read_article['votes_points']    += $_POST['vote'];
                        $read_article['votes_amount']++;
                        $disabled                        = " DISABLED";
                    }
else
                        echo "<font color=red>".$translations['already_voted']."</font>";
                }
else
                    echo "<font color=red>".$translations['vote_login']."</font>";
            }


            $admin_tools    = ($data->level >= 3 OR (checkpermissions($data->rights, 4096) AND $read_article['login'] == $data->login) OR (checkpermissions($data->clanlevel, $config['crew_rights_reversed']['Moderate crew news']) AND $read_article['crew'] == $data->clan)) ? "<div style=\"float: right;\"><input type=\"button\" onClick=\"window.location='news.php?delete=".$read_article['id']."'\" value=\"".$translations['delete']."\" style=\"color: red;\"> - <input type=\"button\" onClick=\"window.location='news.php?action=edit&x=".$read_article['id']."'\" value=\"".$translations['edit']."\" style=\"color: red;\"></div>" : "";

            echo "<table width=\"80%\" align=\"center\" cellspacing=\"0\" cellPadding=\"2\" border=\"1\" borderColor=\"black\"><form method=\"post\">\n";
            echo "    <tr><td class=\"newSubTitle\"><b>".htmlspecialchars(stripslashes($read_article['title']), ENT_QUOTES)."</b></td></tr>\n";
            echo "    <tr><td class=\"mainTxt\">\n";
            $patterns[] = "/DO_NOT_TRANSLATE\[POSTED_BY\]/";
            $patterns[] = "/DO_NOT_TRANSLATE\[POSTED_AT\]/";
            $replacements[] = "<b><a href=\"/profile/".$read_article['login']."/\">".$read_article['login']."</a></b>";
            $replacements[] = "<b>".myGMTtime($read_article['date'], $data->GMT, $translations['date_format'], true)."</b>";
            echo "        <div style=\"float: left;\"><sub>".preg_replace($patterns, $replacements, $translations['posted_by_and_on'])."</sub></div>".$admin_tools."<br><br>\n";
            echo "        ".ubb_code($read_article['text'])."<br><br>\n";
            $patterns[] = "/DO_NOT_TRANSLATE\[AMOUNT\]/";
            $replacements[] = "<b>".$read_article['votes_amount']."</b>";
            echo "        <center><img src=\"stars.php?points=".$read_article['votes_points']."&votes=".$read_article['votes_amount']."\"> - ".preg_replace($patterns, $replacements, $translations['people_already_voted'])." <select name=\"vote\" onblur=\"this.form.submit();\"$disabled><option value=\"\">".$translations['please_rate']."</option><option value=\"0\">0 (".$translations['terrible'].")</option><option value=\"1\">1 (".$translations['very_bad'].")</option><option value=\"2\">2 (".$translations['bad'].")</option><option value=\"3\">3 (".$translations['all_right'].")</option><option value=\"4\">4 (".$translations['good'].")</option><option value=\"5\">5 (".$translations['very_good'].")</option></select> <noscript><input type=\"submit\" value=\"".$translations['rate']."\"".$disabled."></noscript><br></center>";
            if($read_article['change_by'] != '') {
                $patterns[] = "/DO_NOT_TRANSLATE\[EDITED_BY\]/";
                $patterns[] = "/DO_NOT_TRANSLATE\[EDITED_AT\]/";
                $replacements[] = "<b><a href=\"profile/".$read_article['change_by']."/\">".$read_article['change_by']."</a></b>";
                $replacements[] = "<b>".myGMTtime($read_article['change_date'], $data->GMT, $translations['date_format'], true)."</b>";
                echo "        <sub>".preg_replace($patterns, $replacements, $translations['edited_by_and_on'])."</sub>\n";
            }

            echo "    </td></tr>\n";
            echo "</form></table><br>\n";

            $j                = 0;
            $dbres            = query("SELECT id, login, message, date FROM ea_area_off_topic_replies WHERE article=".$_GET['read']." ORDER BY date ASC");
            while($reply = mysql_fetch_row($dbres)) {
                if($j == 0) {
                    echo "<table width=\"80%\" align=\"center\" cellspacing=\"0\" cellPadding=\"2\" border=\"1\" borderColor=\"black\">\n";
                    echo "    <tr><td class=\"newSubTitle\"><a name=\"replies\"><b>".$translations['replies']."</b></a></td></tr>\n";
                    $j = 1;
                }

                echo "    <tr><td class=\"mainTxt\">\n";
                $patterns    = array();
                $patterns[] = "/DO_NOT_TRANSLATE\[REPLY_POSTED_BY\]/";
                $patterns[] = "/DO_NOT_TRANSLATE\[REPLY_POSTED_AT\]/";
                $replacements    = array();
                $replacements[] = "<b><a href=\"profile/".$reply[1]."/\">".$reply[1]."</a></b>";
                $replacements[] = "<b>".myGMTtime($reply[3], $data->GMT, $translations['date_format'], true)."</b>";
                
                $admin_reply_tools            = ($data->level >= 3 OR (checkpermissions($data->clanlevel, $config['crew_rights_reversed']['Moderate crew news']) AND $read_article['crew'] == $data->clan)) ? "<div style=\"float: right;\"><input type=\"button\" onClick=\"window.location='news.php?read=".$_GET['read']."&delete_reply=".$reply[0]."'\" value=\"".$translations['delete']."\" style=\"color: red;\"></div>" : "";
                echo "        <div style=\"float: left;\"><a name=\"reply_".$reply[0]."\"><sub>".preg_replace($patterns, $replacements, $translations['reply_posted_by_and_on'])."</sub></a></div>".$admin_reply_tools."<br><br>\n";
                echo "        ".ubb_code($reply[2])."\n";
                echo "    </td></tr>\n";
            }


            if($j == 1)
                echo "</table><br>\n";

            echo "<table width=\"80%\" align=\"center\">\n";
            echo "    <tr><td align=\"center\"><a href=\"news.php?addreply=".$_GET['read']."\"><img src=\"/images/icons/page_add.png\" border=\"0\" width=\"11\" height=\"11\"> ".$translations['write_new_reply']."</a><br><br><a href=\"news.php\"><img src=\"/images/icons/application_view_list.png\" border=\"0\" width=\"13\" height=\"11\"> ".$translations['back_to_article_overview']."</a></td></tr>\n";
            echo "</table>\n";

        }
else
            echo "<font color=red>".$translations['invalid_id']."</font>";
    }
else
        echo "<font color=red>".$translations['invalid_id']."</font>";
}
elseif(isset($_GET['addreply'])) {
    if(is_numeric($_GET['addreply'])) {
        $article        = query("SELECT id, title, login FROM ea_area_off_topic WHERE id=".$_GET['addreply']." AND (crew='Any crew' OR crew='".$data->clan."') LIMIT 1", "fetch_row");
        if($article) {
            if(isset($_POST['message'])) {
                $message        = $_POST['message'];
                query("INSERT INTO ea_area_off_topic_replies (login, article, date, IP, message) VALUES('".$data->login."', '".$article[0]."', UNIX_TIMESTAMP(), '".$IP."', '".$message."')");
                $reply_id        = mysql_insert_id();
                header("Location: /news.php?read=".$article[0]."#reply_".$reply_id);
                top_layout("", $translations['title'], $head);
                echo $echo;
                echo "<a href=\"news.php?read=".$article[0]."#reply_".$reply_id."\">".$translations['being_redirected']."</a>";
                exit;
            }

            top_layout("", $translations['title'], $head);
            echo $echo;
            echo "                <DIV id=\"subcontent2\" style=\"position:absolute; display:none; border: 5px solid black; background-color: lightyellow; width: 200px; height: 100px; padding: 8px\">
                    <font color=black><center><sub><a href=\"javascript://\" onclick=\"replaceText(' :D ', document.form.message); return false;\"><img src=images/smilies/icon_biggrin.gif alt=\":D\" width=\"15\" height=\"15\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :lol: ', document.form.message); return false;\"><img src=images/smilies/icon_lol.gif alt=\":lol:\" width=\"15\" height=\"15\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :) ', document.form.message); return false;\"><img src=images/smilies/icon_smile.gif alt=\":)\" width=\"15\" height=\"15\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' ;) ', document.form.message); return false;\"><img src=images/smilies/icon_wink.gif alt=\";)\" width=\"15\" height=\"15\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :P ', document.form.message); return false;\"><img src=images/smilies/icon_razz.gif alt=\":P\" width=\"15\" height=\"15\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :strangegrin: ', document.form.message); return false;\"><img src=\"images/smilies/icon_strangegrin.gif\" alt=\":strangegrin:\" width=\"15\" height=\"15\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :tooth: ', document.form.message); return false;\"><img src=\"images/smilies/icon_tooth.gif\" alt=\":tooth:\" width=\"15\" height=\"15\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' 8) ', document.form.message); return false;\"><img src=images/smilies/icon_cool.gif alt=\"8)\" width=\"15\" height=\"15\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :o ', document.form.message); return false;\"><img src=images/smilies/icon_surprised.gif alt=\":o\" width=\"15\" height=\"15\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :rolleyes: ', document.form.message); return false;\"><img src=\"images/smilies/icon_rolleyes.gif\" alt=\":rolleyes:\" width=\"15\" height=\"15\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' 8| ', document.form.message); return false;\"><img src=\"images/smilies/icon_eek.gif\" alt=\"8|\" width=\"15\" height=\"15\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :| ', document.form.message); return false;\"><img src=images/smilies/icon_neutral.gif alt=\":|\" width=\"15\" height=\"15\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :S ', document.form.message); return false;\"><img src=images/smilies/icon_confused.gif alt=\":S\" width=\"15\" height=\"15\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :( ', document.form.message); return false;\"><img src=\"images/smilies/icon_frown.gif\" alt=\":(\" width=\"15\" height=\"15\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :\'( ', document.form.message); return false;\"><img src=\"images/smilies/icon_cry.gif\" alt=\":'(\" width=\"15\" height=\"15\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :mad: ', document.form.message); return false;\"><img src=\"images/smilies/icon_mad.gif\" alt=\":mad:\" width=\"15\" height=\"15\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :twisted: ', document.form.message); return false;\"><img src=\"images/smilies/icon_twisted.gif\" alt=\":twisted:\" width=\"15\" height=\"15\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :evil: ', document.form.message); return false;\"><img src=\"images/smilies/icon_evil.gif\" alt=\":evil:\" width=\"15\" height=\"15\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :redface: ', document.form.message); return false;\"><img src=\"images/smilies/icon_redface.gif\" alt=\":redface:\" width=\"15\" height=\"15\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :hand: ', document.form.message); return false;\"><img src=\"images/smilies/icon_hand.gif\" alt=\":hand:\" width=\"15\" height=\"15\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :sick: ', document.form.message); return false;\"><img src=\"images/smilies/icon_sick.gif\" alt=\":sick:\" width=\"15\" height=\"15\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :shhh: ', document.form.message); return false;\"><img src=\"images/smilies/icon_shhh.gif\" alt=\":shhh:\" width=\"15\" height=\"15\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :?: ', document.form.message); return false;\"><img src=\"images/smilies/icon_question.gif\" alt=\":?:\" width=\"15\" height=\"15\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :tdn: ', document.form.message); return false;\"><img src=\"images/smilies/icon_tdn.gif\" alt=\":tdn:\" width=\"15\" height=\"15\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :tup: ', document.form.message); return false;\"><img src=\"images/smilies/icon_tup.gif\" alt=\":tup:\" width=\"15\" height=\"15\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' ^o) ', document.form.message); return false;\"><img src=\"images/smilies/icon_yeah.gif\" alt=\"^o)\" width=\"15\" height=\"15\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :eh: ', document.form.message); return false;\"><img src=\"images/smilies/icon_eh.gif\" alt=\":eh:\" width=\"15\" height=\"15\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :grrr: ', document.form.message); return false;\"><img src=\"images/smilies/icon_grrr.gif\" alt=\":grrr:\" width=\"15\" height=\"15\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' -.- ', document.form.message); return false;\"><img src=\"images/smilies/icon_idiot.gif\" alt=\"-.-\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' (a) ', document.form.message); return false;\"><img src=\"images/smilies/icon_angel.gif\" alt=\"(a)\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :silence: ', document.form.message); return false;\"><img src=\"images/smilies/icon_silence.gif\" alt=\":silence:\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :coffee: ', document.form.message); return false;\"><img src=\"images/smilies/icon_coffee.gif\" alt=\":coffee:\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' +.+ ', document.form.message); return false;\"><img src=\"images/smilies/icon_hit.gif\" alt=\"+.+\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :box: ', document.form.message); return false;\"><img src=\"images/smilies/icon_boxing.gif\" alt=\":box:\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :dance: ', document.form.message); return false;\"><img src=\"images/smilies/icon_dance.gif\" alt=\":dance:\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :rambo: ', document.form.message); return false;\"><img src=\"images/smilies/icon_rambo.gif\" alt=\":rambo:\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :clap: ', document.form.message); return false;\"><img src=\"images/smilies/icon_clap.gif\" alt=\":clap:\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :liar: ', document.form.message); return false;\"><img src=\"images/smilies/icon_liar.gif\" alt=\":liar:\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :shifty: ', document.form.message); return false;\"><img src=\"images/smilies/icon_shifty.gif\" alt=\":shifty:\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :think: ', document.form.message); return false;\"><img src=\"images/smilies/icon_think.gif\" alt=\":think:\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :stupid: ', document.form.message); return false;\"><img src=\"images/smilies/icon_stupid.gif\" alt=\":stupid:\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :study: ', document.form.message); return false;\"><img src=\"images/smilies/icon_study.gif\" alt=\":study:\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :moustache: ', document.form.message); return false;\"><img src=\"images/smilies/icon_moustache.gif\" alt=\":moustache:\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :snooty: ', document.form.message); return false;\"><img src=\"images/smilies/icon_snooty.gif\" alt=\":snooty:\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :shhh: ', document.form.message); return false;\"><img src=\"images/smilies/icon_shhh.gif\" alt=\":shhh:\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :pray: ', document.form.message); return false;\"><img src=\"images/smilies/icon_pray.gif\" alt=\":pray:\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :idea: ', document.form.message); return false;\"><img src=\"images/smilies/icon_idea.gif\" alt=\":idea:\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :arrow: ', document.form.message); return false;\"><img src=\"images/smilies/icon_arrow.gif\" alt=\":arrow:\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :dancing: ', document.form.message); return false;\"><img src=\"images/smilies/icon_dancing.gif\" alt=\":dancing:\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :drool: ', document.form.message); return false;\"><img src=\"images/smilies/icon_drool.gif\" alt=\":drool:\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :whistle: ', document.form.message); return false;\"><img src=\"images/smilies/icon_whistle.gif\" alt=\":whistle:\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :wall: ', document.form.message); return false;\"><img src=\"images/smilies/icon_wall.gif\" alt=\":wall:\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :naughty: ', document.form.message); return false;\"><img src=\"images/smilies/icon_naughty.gif\" alt=\":naughty:\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :shoot: ', document.form.message); return false;\"><img src=\"images/smilies/icon_shoot.gif\" alt=\":shoot:\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :comp: ', document.form.message); return false;\"><img src=\"images/smilies/icon_comp.gif\" alt=\":comp:\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :censored: ', document.form.message); return false;\"><img src=\"images/smilies/icon_censored.gif\" alt=\":censored:\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' (h) ', document.form.message); return false;\"><img src=\"images/smilies/icon_hard.gif\" alt=\"(h)\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :party: ', document.form.message); return false;\"><img src=\"images/smilies/icon_party.gif\" alt=\":party:\" border=\"0\"></a><br></sub>
                    <a href=\"javascript:void(0);\" onclick=\"surroundText('[B]', '[/B]', document.form.message); return false;\" style=\"color: black\"><b>B</b></a>
                    <a href=\"javascript:void(0);\" onclick=\"surroundText('[I]', '[/I]', document.form.message); return false;\" style=\"color: black\"><i>I</i></a>
                    <a href=\"javascript:void(0);\" onclick=\"surroundText('[U]', '[/U]', document.form.message); return false;\" style=\"color: black\"><u>U</u></a>
                    <a href=\"javascript:void(0);\" onclick=\"surroundText('[S]', '[/S]', document.form.message); return false;\" style=\"color: black\"><s>S</s></a>
                    <a href=\"javascript:void(0);\" onclick=\"surroundText('[SCROLL]', '[/SCROLL]', document.form.message); return false;\" style=\"color: black\">SCROLL</a>
                    <a href=\"javascript:void(0);\" onclick=\"surroundText('[CENTER]', '[/CENTER]', document.form.message); return false;\" style=\"color: black\">CENTER</a>
                    <a href=\"javascript:void(0);\" onclick=\"surroundText('[IMG]', '[/IMG]', document.form.message); return false;\" style=\"color: black\">IMG</a>
                    <a href=\"javascript:void(0);\" onclick=\"surroundText('[URL]', '[/URL]', document.form.message); return false;\" style=\"color: black\">URL</a>
                    <a href=\"javascript:void(0);\" onclick=\"surroundText('[PRE]', '[/PRE]', document.form.message); return false;\" style=\"color: black\">PRE</a>
                    <a href=\"javascript:void(0);\" onclick=\"surroundText('[SUB]', '[/SUB]', document.form.message); return false;\" style=\"color: black\">SUB</a>
                    <a href=\"javascript:void(0);\" onclick=\"surroundText('[SUP]', '[/SUP]', document.form.message); return false;\" style=\"color: black\">SUP</a><br>
                    <a href=\"javascript://\" onclick=\"replaceText('Affirmative!', document.form.message); return false;\"><font color=\"green\">Affirmative!</font></a>
                    <a href=\"javascript://\" onclick=\"replaceText('Negative!', document.form.message); return false;\"><font color=\"red\">Negative!</font></a></center></font>
                    <div align=\"right\"><a href=\"#\" onClick=\"overlayclose('subcontent2'); return false\" style=\"color: black\"><b>"
.$translations['close_box']."</b></a></div>
                </DIV>\n"
;
            echo "<table width=\"80%\" align=\"center\" cellspacing=\"0\" cellPadding=\"2\" border=\"1\" borderColor=\"black\"><form name=\"form\" method=\"POST\" onsubmit=\"submitDis('submit')\">\n";
            $patterns[] = "/DO_NOT_TRANSLATE\[REPLY_AT\]/";
            $replacements[] = "<i>".$article[1]."</i>";
            echo "    <tr><td class=\"newSubTitle\" colspan=2><b>".preg_replace($patterns, $replacements, $translations['replying_at_'])."</b></td></tr>";
            echo "    <tr><td width=10% valign=\"top\" class=\"mainTxt\">".$translations['login'].":</td><td class=\"mainTxt\">".$data->login."</td></tr>\n";
            echo "    <tr><td width=10% valign=\"top\" class=\"mainTxt\">".$translations['reply_at'].":</td><td class=\"mainTxt\"><a href=\"news.php?read=".$article[0]."\"><b>".$article[1]."</b></a> ".$translations['by']." <a href=\"profile/".$article[2]."/\"><b>".$article[2]."</b></a>.</td></tr>\n";
            echo "    <tr><td width=10% valign=\"top\" class=\"mainTxt\">".$translations['message'].":</td><td class=\"mainTxt\" width=\"90%\" align=\"center\">\n";
            $message    = (isset($_POST['message'])) ? $_POST['message'] : '';
            echo "        <textarea onselect=\"storeCaret(this);\" onclick=\"storeCaret(this);\" onchange=\"storeCaret(this);\" name=\"message\" cols='' style='width: 100%; height: 150px'>".$message."</textarea><br>\n";
            echo "        <a onClick=\"return overlay(this, 'subcontent2', 'bottomcenter')\"><b>".$translations['show_or_hide_codes']."</b></a><br>\n";
            echo "    </td></tr>\n";
            echo "    <tr><td class=\"mainTxt\" colspan=\"2\" align=\"center\"><input type=\"submit\" name=\"submit\" style=\"width: 100px;\" value=\"".$translations['reply']."\"></td></tr>\n";
            echo "</table><br>\n";
            echo "<table width=\"80%\" align=\"center\" cellspacing=\"0\" cellPadding=\"2\" border=\"0\">\n";
            echo "    <tr><td align=\"center\"><a href=\"news.php?read=".$article[0]."\"><img src=\"/images/icons/page.png\" border=\"0\"> ".$translations['go_back_to_article']."</a><br><br><a href=\"news.php\"><img src=\"/images/icons/application_view_list.png\" border=\"0\" width=\"13\" height=\"11\"> ".$translations['back_to_article_overview']."</a></td></tr>";
            echo "</table>";
        }
else
            echo "<font color=red>".$translations['invalid_id']."</font>";
    }
else
        echo "<font color=red>".$translations['invalid_id']."</font>";
}
elseif(isset($_GET['action']) AND ($_GET['action'] == 'newarticle' OR $_GET['action'] == 'edit')) {
    if($data->level >= 3 OR checkpermissions($data->rights, 4096) OR checkpermissions($data->clanlevel, $config['crew_rights_reversed']['Moderate crew news'])) {
        $title            = '';
        $message        = '';
        $category        = '';
        if($_GET['action'] == 'edit')
        {

            if(isset($_GET['x']) && is_numeric($_GET['x']))
            {

                $edit_article        = query("SELECT title, text, crew, login, category FROM ea_area_off_topic WHERE id=".$_GET['x']." AND (crew='Any crew' OR crew='".$data->clan."') LIMIT 1", "fetch_assoc");
                if($edit_article && ($data->level >= 3 || (checkpermissions($data->rights, 4096) && $edit_article['login'] == $data->login) || (checkpermissions($data->clanlevel, $config['crew_rights_reversed']['Moderate crew news']) && $edit_article['crew'] == $data->clan)))
                {

                    $title            = $edit_article['title'];
                    $message        = $edit_article['text'];
                    $category        = $edit_article['category'];
                }

                else
                {
                    top_layout("", $translations['title'], $head);
                    echo $echo;
                    echo "<font color=red>".$translations['invalid_id']."</font><br><br><a href=\"news.php\">".$translations['back_to_article_overview']."</a>";
                    exit;
                }
            }

            else
            {
                top_layout("", $translations['title'], $head);
                echo $echo;
                echo "<font color=red>".$translations['invalid_id']."</font><br><br><a href=\"news.php\">".$translations['back_to_article_overview']."</a>";
                exit;
            }
        }

        if(isset($_POST['message'], $_POST['title'], $_POST['cat']) && (($_POST['cat'] == 'Staff' && $data->level >= 3) || ($_POST['cat'] == 'Elite Times' && checkpermissions($data->rights, 4096)) || $_POST['cat'] == 'Other')) {
            $title            = htmlspecialchars($_POST['title'], ENT_QUOTES);
            $message        = $_POST['message'];
            $category        = $_POST['cat'];
            if(!isset($_POST['submit'])) {
                if($_POST['title'] != '' AND $_POST['message'] != '') {
                        top_layout("", $translations['title'], $head);
                        echo $echo;

                        echo "<table width=\"80%\" align=\"center\" cellspacing=\"0\" cellPadding=\"2\" border=\"1\" borderColor=\"black\">\n";
                        echo "    <tr><td class=\"newSubTitle1\"><b>".stripslashes(stripslashes($title))."</b></td></tr>\n";
                        $patterns    = array();
                        $patterns[] = "/DO_NOT_TRANSLATE\[POSTED_BY\]/";
                        $patterns[] = "/DO_NOT_TRANSLATE\[POSTED_AT\]/";
                        $replacements    = array();
                        $replacements[] = "<a href=\"profile/".$data->login."/\"><b>".$data->login."</b></a>";
                        $replacements[] = "<b>".myGMTtime($time, $data->GMT, $translations['date_format'], true)."</b>";
                        echo "    <tr><td class=\"mainTxt\"><sub>".preg_replace($patterns, $replacements, $translations['posted_by_and_on'])."</sub><br><br>\n";
                        echo "        ".ubb_code(stripslashes($message))."<br><br>\n";
                        $patterns    = array();
                        $patterns[] = "/DO_NOT_TRANSLATE\[AMOUNT\]/";
                        $replacements    = array();
                        $replacements[] = "<b>1</b>";
                        echo "        <center><img src=\"stars.php?points=5&votes=1\"> - ".preg_replace("/DO_NOT_TRANSLATE\[AMOUNT\]/", "<b>0</b>", $translations['people_already_voted'])." <select name=\"vote\"><option value=\"\">".$translations['please_rate']."</option><option value=\"0\">0 (".$translations['terrible'].")</option><option value=\"1\">1 (".$translations['very_bad'].")</option><option value=\"2\">2 (".$translations['bad'].")</option><option value=\"3\">3 (".$translations['all_right'].")</option><option value=\"4\">4 (".$translations['good'].")</option><option value=\"5\">5 (".$translations['very_good'].")</option></select> <noscript><input type=\"submit\" value=\"".$translations['rate']."\"></noscript></center>\n";
                        if($_GET['action'] == 'edit') {
                            $patterns    = array();
                            $patterns[] = "/DO_NOT_TRANSLATE\[EDITED_BY\]/";
                            $patterns[] = "/DO_NOT_TRANSLATE\[EDITED_AT\]/";
                            $replacements    = array();
                            $replacements[] = "<b><a href=\"profile/".$data->login."/\">".$data->login."</a></b>";
                            $replacements[] = "<b>".myGMTtime($time, $data->GMT, $translations['date_format'], true).".</b>";
                            echo "        <sub>".preg_replace($patterns, $replacements, $translations['edited_by_and_on'])."</sub>\n";
                        }

                        echo "    </td></tr>\n";
                        echo "</table><br><br>\n";
                }
else {
                    top_layout("", $translations['title'], $head);
                    echo $echo;
                    echo "<font color=red>".$translations['invalid_title_image_message']."</font>";
                }
            }
else {
                if($_POST['title'] != '' && $_POST['message'] != '')
                {

                        if(isset($_GET['action'], $_GET['x']) && $_GET['action'] == 'edit' && is_numeric($_GET['x']))
                        {

                            $which_crew = ($data->level < 3 AND !checkpermissions($data->rights, 4096)) ? "crew='" . $data->clan . "'" : "crew='Any crew'";
                            query("UPDATE ea_area_off_topic SET title='" . $_POST['title'] . "', text='" . $_POST['message'] . "', change_by='" . $data->login . "', change_date=UNIX_TIMESTAMP(), category='" . $_POST['cat'] . "' WHERE id=" . $_GET['x'] . " AND " . $which_crew . " LIMIT 1");
                            header("Location: /news.php?read=" . $_GET['x']);
                            top_layout("", $translations['title'], $head);
                            echo $echo;
                            echo "<a href=\"news.php?read=".$_GET['x']."\">".$translations['being_redirected']."</a>";
                            exit;
                        }

                        else
                        {
                            if($data->level < 3 AND !checkpermissions($data->rights, 4096) AND $data->clan != "" AND checkpermissions($data->clanlevel, $config['crew_rights_reversed']['Moderate crew news']))
                                query("INSERT INTO ea_area_off_topic (login, date, IP, title, text, crew, category) VALUES('".$data->login."', UNIX_TIMESTAMP(), '".$IP."', '".$_POST['title']."', '".$_POST['message']."', '".$data->clan."', '" . $_POST['cat'] . "')");
                            elseif($data->level >= 3 OR checkpermissions($data->rights, 4096))
                                query("INSERT INTO ea_area_off_topic (login, date, IP, title, text, category) VALUES('".$data->login."', UNIX_TIMESTAMP(), '".$IP."', '".$_POST['title']."', '".$_POST['message']."', '" . $_POST['cat'] . "')");
                            $article_id        = mysql_insert_id();
                            header("Location: /news.php?read=".$article_id);
                            top_layout("", $translations['title'], $head);
                            echo $echo;
                            echo "<a href=\"news.php?read=".$article_id."\">".$translations['being_redirected']."</a>";
                            exit;
                        }
                }

                else
                {
                    top_layout("", $translations['title'], $head);
                    echo $echo;
                    echo "<font color=red>".$translations['invalid_title_image_message']."</font>";
                }
            }
        }
else
            top_layout("", $translations['title'], $head);
            echo "                <DIV id=\"subcontent2\" style=\"position:absolute; display:none; border: 5px solid black; background-color: lightyellow; width: 200px; height: 100px; padding: 8px\">
                    <font color=black><center><sub><a href=\"javascript://\" onclick=\"replaceText(' :D ', document.form.message); return false;\"><img src=images/smilies/icon_biggrin.gif alt=\":D\" width=\"15\" height=\"15\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :lol: ', document.form.message); return false;\"><img src=images/smilies/icon_lol.gif alt=\":lol:\" width=\"15\" height=\"15\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :) ', document.form.message); return false;\"><img src=images/smilies/icon_smile.gif alt=\":)\" width=\"15\" height=\"15\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' ;) ', document.form.message); return false;\"><img src=images/smilies/icon_wink.gif alt=\";)\" width=\"15\" height=\"15\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :P ', document.form.message); return false;\"><img src=images/smilies/icon_razz.gif alt=\":P\" width=\"15\" height=\"15\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :strangegrin: ', document.form.message); return false;\"><img src=\"images/smilies/icon_strangegrin.gif\" alt=\":strangegrin:\" width=\"15\" height=\"15\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :tooth: ', document.form.message); return false;\"><img src=\"images/smilies/icon_tooth.gif\" alt=\":tooth:\" width=\"15\" height=\"15\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' 8) ', document.form.message); return false;\"><img src=images/smilies/icon_cool.gif alt=\"8)\" width=\"15\" height=\"15\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :o ', document.form.message); return false;\"><img src=images/smilies/icon_surprised.gif alt=\":o\" width=\"15\" height=\"15\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :rolleyes: ', document.form.message); return false;\"><img src=\"images/smilies/icon_rolleyes.gif\" alt=\":rolleyes:\" width=\"15\" height=\"15\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' 8| ', document.form.message); return false;\"><img src=\"images/smilies/icon_eek.gif\" alt=\"8|\" width=\"15\" height=\"15\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :| ', document.form.message); return false;\"><img src=images/smilies/icon_neutral.gif alt=\":|\" width=\"15\" height=\"15\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :S ', document.form.message); return false;\"><img src=images/smilies/icon_confused.gif alt=\":S\" width=\"15\" height=\"15\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :( ', document.form.message); return false;\"><img src=\"images/smilies/icon_frown.gif\" alt=\":(\" width=\"15\" height=\"15\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :\'( ', document.form.message); return false;\"><img src=\"images/smilies/icon_cry.gif\" alt=\":'(\" width=\"15\" height=\"15\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :mad: ', document.form.message); return false;\"><img src=\"images/smilies/icon_mad.gif\" alt=\":mad:\" width=\"15\" height=\"15\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :twisted: ', document.form.message); return false;\"><img src=\"images/smilies/icon_twisted.gif\" alt=\":twisted:\" width=\"15\" height=\"15\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :evil: ', document.form.message); return false;\"><img src=\"images/smilies/icon_evil.gif\" alt=\":evil:\" width=\"15\" height=\"15\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :redface: ', document.form.message); return false;\"><img src=\"images/smilies/icon_redface.gif\" alt=\":redface:\" width=\"15\" height=\"15\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :hand: ', document.form.message); return false;\"><img src=\"images/smilies/icon_hand.gif\" alt=\":hand:\" width=\"15\" height=\"15\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :sick: ', document.form.message); return false;\"><img src=\"images/smilies/icon_sick.gif\" alt=\":sick:\" width=\"15\" height=\"15\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :shhh: ', document.form.message); return false;\"><img src=\"images/smilies/icon_shhh.gif\" alt=\":shhh:\" width=\"15\" height=\"15\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :?: ', document.form.message); return false;\"><img src=\"images/smilies/icon_question.gif\" alt=\":?:\" width=\"15\" height=\"15\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :tdn: ', document.form.message); return false;\"><img src=\"images/smilies/icon_tdn.gif\" alt=\":tdn:\" width=\"15\" height=\"15\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :tup: ', document.form.message); return false;\"><img src=\"images/smilies/icon_tup.gif\" alt=\":tup:\" width=\"15\" height=\"15\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' ^o) ', document.form.message); return false;\"><img src=\"images/smilies/icon_yeah.gif\" alt=\"^o)\" width=\"15\" height=\"15\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :eh: ', document.form.message); return false;\"><img src=\"images/smilies/icon_eh.gif\" alt=\":eh:\" width=\"15\" height=\"15\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :grrr: ', document.form.message); return false;\"><img src=\"images/smilies/icon_grrr.gif\" alt=\":grrr:\" width=\"15\" height=\"15\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' -.- ', document.form.message); return false;\"><img src=\"images/smilies/icon_idiot.gif\" alt=\"-.-\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' (a) ', document.form.message); return false;\"><img src=\"images/smilies/icon_angel.gif\" alt=\"(a)\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :silence: ', document.form.message); return false;\"><img src=\"images/smilies/icon_silence.gif\" alt=\":silence:\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :coffee: ', document.form.message); return false;\"><img src=\"images/smilies/icon_coffee.gif\" alt=\":coffee:\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' +.+ ', document.form.message); return false;\"><img src=\"images/smilies/icon_hit.gif\" alt=\"+.+\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :box: ', document.form.message); return false;\"><img src=\"images/smilies/icon_boxing.gif\" alt=\":box:\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :dance: ', document.form.message); return false;\"><img src=\"images/smilies/icon_dance.gif\" alt=\":dance:\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :rambo: ', document.form.message); return false;\"><img src=\"images/smilies/icon_rambo.gif\" alt=\":rambo:\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :clap: ', document.form.message); return false;\"><img src=\"images/smilies/icon_clap.gif\" alt=\":clap:\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :liar: ', document.form.message); return false;\"><img src=\"images/smilies/icon_liar.gif\" alt=\":liar:\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :shifty: ', document.form.message); return false;\"><img src=\"images/smilies/icon_shifty.gif\" alt=\":shifty:\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :think: ', document.form.message); return false;\"><img src=\"images/smilies/icon_think.gif\" alt=\":think:\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :stupid: ', document.form.message); return false;\"><img src=\"images/smilies/icon_stupid.gif\" alt=\":stupid:\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :study: ', document.form.message); return false;\"><img src=\"images/smilies/icon_study.gif\" alt=\":study:\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :moustache: ', document.form.message); return false;\"><img src=\"images/smilies/icon_moustache.gif\" alt=\":moustache:\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :snooty: ', document.form.message); return false;\"><img src=\"images/smilies/icon_snooty.gif\" alt=\":snooty:\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :shhh: ', document.form.message); return false;\"><img src=\"images/smilies/icon_shhh.gif\" alt=\":shhh:\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :pray: ', document.form.message); return false;\"><img src=\"images/smilies/icon_pray.gif\" alt=\":pray:\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :idea: ', document.form.message); return false;\"><img src=\"images/smilies/icon_idea.gif\" alt=\":idea:\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :arrow: ', document.form.message); return false;\"><img src=\"images/smilies/icon_arrow.gif\" alt=\":arrow:\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :dancing: ', document.form.message); return false;\"><img src=\"images/smilies/icon_dancing.gif\" alt=\":dancing:\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :drool: ', document.form.message); return false;\"><img src=\"images/smilies/icon_drool.gif\" alt=\":drool:\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :whistle: ', document.form.message); return false;\"><img src=\"images/smilies/icon_whistle.gif\" alt=\":whistle:\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :wall: ', document.form.message); return false;\"><img src=\"images/smilies/icon_wall.gif\" alt=\":wall:\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :naughty: ', document.form.message); return false;\"><img src=\"images/smilies/icon_naughty.gif\" alt=\":naughty:\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :shoot: ', document.form.message); return false;\"><img src=\"images/smilies/icon_shoot.gif\" alt=\":shoot:\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :comp: ', document.form.message); return false;\"><img src=\"images/smilies/icon_comp.gif\" alt=\":comp:\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :censored: ', document.form.message); return false;\"><img src=\"images/smilies/icon_censored.gif\" alt=\":censored:\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' (h) ', document.form.message); return false;\"><img src=\"images/smilies/icon_hard.gif\" alt=\"(h)\" border=\"0\"></a>
                    <a href=\"javascript://\" onclick=\"replaceText(' :party: ', document.form.message); return false;\"><img src=\"images/smilies/icon_party.gif\" alt=\":party:\" border=\"0\"></a><br></sub>
                    <a href=\"javascript:void(0);\" onclick=\"surroundText('[B]', '[/B]', document.form.message); return false;\" style=\"color: black\"><b>B</b></a>
                    <a href=\"javascript:void(0);\" onclick=\"surroundText('[I]', '[/I]', document.form.message); return false;\" style=\"color: black\"><i>I</i></a>
                    <a href=\"javascript:void(0);\" onclick=\"surroundText('[U]', '[/U]', document.form.message); return false;\" style=\"color: black\"><u>U</u></a>
                    <a href=\"javascript:void(0);\" onclick=\"surroundText('[S]', '[/S]', document.form.message); return false;\" style=\"color: black\"><s>S</s></a>
                    <a href=\"javascript:void(0);\" onclick=\"surroundText('[SCROLL]', '[/SCROLL]', document.form.message); return false;\" style=\"color: black\">SCROLL</a>
                    <a href=\"javascript:void(0);\" onclick=\"surroundText('[CENTER]', '[/CENTER]', document.form.message); return false;\" style=\"color: black\">CENTER</a>
                    <a href=\"javascript:void(0);\" onclick=\"surroundText('[IMG]', '[/IMG]', document.form.message); return false;\" style=\"color: black\">IMG</a>
                    <a href=\"javascript:void(0);\" onclick=\"surroundText('[URL]', '[/URL]', document.form.message); return false;\" style=\"color: black\">URL</a>
                    <a href=\"javascript:void(0);\" onclick=\"surroundText('[PRE]', '[/PRE]', document.form.message); return false;\" style=\"color: black\">PRE</a>
                    <a href=\"javascript:void(0);\" onclick=\"surroundText('[SUB]', '[/SUB]', document.form.message); return false;\" style=\"color: black\">SUB</a>
                    <a href=\"javascript:void(0);\" onclick=\"surroundText('[SUP]', '[/SUP]', document.form.message); return false;\" style=\"color: black\">SUP</a><br>
                    <a href=\"javascript://\" onclick=\"replaceText('Affirmative!', document.form.message); return false;\"><font color=\"green\">Affirmative!</font></a>
                    <a href=\"javascript://\" onclick=\"replaceText('Negative!', document.form.message); return false;\"><font color=\"red\">Negative!</font></a></center></font>
                    <div align=\"right\"><a href=\"#\" onClick=\"overlayclose('subcontent2'); return false\" style=\"color: black\"><b>"
.$translations['close_box']."</b></a></div>
                </DIV>\n"
;
            echo "<table width=\"80%\" align=\"center\" cellspacing=\"0\" cellPadding=\"2\" border=\"1\" borderColor=\"black\"><form name=\"form\" method=\"POST\" onsubmit=\"submitDis('submit')\">\n";
            if($_GET['action'] == 'edit')
                echo "    <tr><td class=\"newSubTitle\" colspan=2><b>".$translations['edit_article']."</b></td></tr>";
            else
                echo "    <tr><td class=\"newSubTitle\" colspan=2><b>".$translations['edit_article']."</b></td></tr>";
            echo "    <tr><td width=60 valign=\"top\" class=\"mainTxt\">Login:</td><td class=\"mainTxt\">".$data->login."</td></tr>\n";
            $writing_for_crew = ($data->level < 3 AND !checkpermissions($data->rights, 4096)) ? $data->clan : $translations['any_crew_HQ'];
            echo "    <tr><td width=60 valign=\"top\" class=\"mainTxt\">".$translations['crew'].":</td><td class=\"mainTxt\">".$writing_for_crew."</td></tr>\n";
            echo "<tr>";
                echo "<td width=60 valign=\"top\" class=\"mainTxt\">";
                    echo "Category:";
                echo "</td>";
                echo "<td class=\"mainTxt\">";
                    echo "<select name=\"cat\">";
                        if($data->level >= 3)
                        {

                            if(empty($category) || $category == 'Staff')
                                echo "<option value=\"Staff\" selected>Staff</option>";
                            else
                                echo "<option value=\"Staff\">Staff</option>";
                        }

                        if(checkpermissions($data->rights, 4096))
                        {

                            if((empty($category) && $data->level < 3) || $category == 'Elite Times')
                                echo "<option value=\"Elite Times\" selected>Elite Times</option>";
                            else
                                echo "<option value=\"Elite Times\">Elite Times</option>";
                        }

                        if(!empty($category) && $category == 'Other')
                            echo "<option value=\"Other\" selected>Other</option>";
                        else
                            echo "<option value=\"Other\">Other</option>";
                    echo "</select>";
                echo "</td>";
            echo "</tr>";
            echo "    <tr><td width=60 valign=\"top\" class=\"mainTxt\">".$translations['newtitle'].":</td><td class=\"mainTxt\"><input type=\"text\" name=\"title\" maxlength=\"255\" style=\"width: 540\" value=\"".stripslashes(stripslashes($title))."\"><br>".$translations['title_description']."</td></tr>\n";
            echo "    <tr><td width=60 valign=\"top\" class=\"mainTxt\">".$translations['message'].":</td><td class=\"mainTxt\" width=\"90%\" align=\"center\">\n";
            echo "        <textarea onselect=\"storeCaret(this);\" onclick=\"storeCaret(this);\" onkeyup=\"storeCaret(this);\" onchange=\"storeCaret(this);\" name=\"message\" cols='' style='width: 100%; height: 150px'>".htmlspecialchars(stripslashes(stripslashes($message)), ENT_QUOTES)."</textarea><br>\n";
            echo "        <a onClick=\"return overlay(this, 'subcontent2', 'bottomcenter')\"><b>".$translations['show_or_hide_codes']."</b></a><br>\n";
            echo "    </td></tr>\n";
            if($_GET['action'] == 'edit')
                $previewed            = (isset($_POST['preview'])) ? "<br><br><input type=\"submit\" name=\"submit\" style=\"width: 110px;\" value=\"".$translations['edit_article']."\">" : "";
            else
                $previewed            = (isset($_POST['preview'])) ? "<br><br><input type=\"submit\" name=\"submit\" style=\"width: 110px;\" value=\"".$translations['add_article']."\">" : "";
            echo "    <tr><td class=\"mainTxt\" colspan=\"2\" align=\"center\"><input type=\"submit\" name=\"preview\" style=\"width: 130px;\" value=\"".$translations['preview_article']."\">".$previewed."</td></tr>\n";
            echo "</table><br>\n";
            echo "<table width=\"80%\" align=\"center\" cellspacing=\"0\" cellPadding=\"2\" border=\"0\">\n";
            echo "    <tr><td align=\"center\"><a href=\"news.php\"><img src=\"/images/icons/application_view_list.png\" border=\"0\" width=\"13\" height=\"11\"> ".$translations['back_to_article_overview']."</a></td></tr>";
            echo "</table>";
    }
else {
        top_layout("", $translations['title'], $head);
        echo $echo;
        echo "<font color=red>".$translations['no_rights']."</font><br><br><a href=\"news.php\"><img src=\"/images/icons/application_view_list.png\" border=\"0\" width=\"13\" height=\"11\"> ".$translations['back_to_article_overview']."</a>";
    }
}
elseif(isset($_GET['showall'])) {
    top_layout("", $translations['title'], $head);
    echo $echo;
    echo "<table width=\"80%\" align=\"center\" cellspacing=\"0\" cellPadding=\"2\" border=\"1\" borderColor=\"black\">\n";
    echo "    <tr><td class=\"newSubTitle\"><b>".$translations['older_articles']."</b></td></tr>\n";
    $dbres = query("SELECT id, login, date, title FROM ea_area_off_topic WHERE (crew='Any crew' OR crew='".$data->clan."') ORDER BY id DESC LIMIT 0,50");
    while($article = mysql_fetch_assoc($dbres)) {
        echo "    <tr><td class=\"mainTxt\">".myGMTtime($article['date'], $data->GMT, "d/m")." - <a href=\"news.php?read=".$article['id']."\">".$article['title']."</a> ".$translations['by']." <a href=\"profile/".$article['login']."/\"><b>".$article['login']."</b></a>.</td></tr>\n";
    }

    echo "</table><br>";
    echo "<table width=\"80%\" align=\"center\" cellspacing=\"0\" cellPadding=\"2\" border=\"0\">\n";
    echo "    <tr><td align=\"center\"><a href=\"news.php\"><img src=\"/images/icons/application_view_list.png\" border=\"0\" width=\"13\" height=\"11\"> ".$translations['back_to_article_overview']."</a></td></tr>";
    echo "</table>";
}
else {
    top_layout("", $translations['title'], $head);
    
    if($data->level >= 4)
    {

        $errorLogLocation = ini_get("error_log");
        if(!empty($errorLogLocation))
        {
            function
ErrorColorCoding($str)
            {

                $str = trim($str);
                $str = str_replace("PHP Warning", "<font color=orange>WARNING</font>", $str);
                $str = str_replace("PHP Fatal error", "<font color=red>FATAL ERROR</font>", $str);
                $str = str_replace("PHP Parse error", "<font color=red><b>PARSE ERROR</b></font>", $str);
                $str = str_replace("PHP Notice", "<font color=yellow>NOTICE</font>", $str);
                $str = preg_replace("/in ([a-zA-Z\/\.\-\_]+?) on line/i", "in <i>\\1</i> on line", $str);
                $str = preg_replace("/in \<i\>\/home\/eliteaveng\/domains\/eliteavengers\.org\/public_html\/([a-zA-Z\/\.\-\_]+?)\<\/i\> on line/i", "in <a href=\"\\1\" style=\"color: yellow;\"><i>\\1</i></a> on line", $str);
                
                return $str;
            }

            
            echo "<table width=\"80%\" align=\"center\" cellspacing=0 cellpadding=0>";
                echo "<tr>";
                    echo "<td class=\"title\" style=\"padding: 2px;\">";
                        echo "<b>Error Log</b>";
                    echo "</td>";
                echo "</tr>";
                echo "<tr>";
                    echo "<td class=\"text\">";
                        echo "<table width=\"100%\" cellspacing=0 cellpadding=2>";
                            $errors = file($errorLogLocation);
                            $errors = array_reverse($errors);
                            
                            $start = (isset($_GET['errorstart']) && is_numeric($_GET['errorstart']) && $_GET['errorstart'] > 0) ? $_GET['errorstart'] : 0;
                            $limit = 20;
                            
                            for($i = $start; $i < ( $limit + $start ); $i++)
                            {

                                if(isset($errors[$i]) && preg_match("/^\[(.+?)\](.+?)$/", $errors[$i], $matches))
                                {

                                    if($i % 2 == 0)
                                        echo "<tr>";
                                    else
                                        echo "<tr style=\"background-color: #323232;\">";
                                        echo "<td width=\"150\">";
                                            echo myGMTtime($matches[1], $data->GMT, 'default');
                                        echo "</td>";
                                        echo "<td>";
                                            echo ErrorColorCoding($matches[2]);
                                        echo "</td>";
                                    echo "</tr>";
                                }
                            }

                        echo "</table>";
                        echo "<a href=\"?errorstart=" . ( $start + 20 ) . "\">View older errors...</a>";
                    echo "</td>";
                echo "</tr>";
            echo "</table><br/>";
        }
    }

    
    // Crew news
    echo "<table width=\"80%\" align=\"center\" cellspacing=\"0\" cellPadding=\"2\" border=\"1\" borderColor=\"black\">\n";
    echo "    <tr><td class=\"newSubTitle\" style=\"valign: top\">\n";
    echo "Crew news:";
    echo "    </td></tr>";
    echo "</table>";
    
    $i = 0;
    $dbres = query("SELECT SQL_CACHE id,subject,message,poster FROM ea_crew_news WHERE crew='{$data->clan}' ORDER BY time DESC");
    while($news = mysql_fetch_row($dbres))
    {

        $subject        = (!isset($news[1]) OR $news[1] == '') ? "(No Subject)" : $news[1];
        $message        = ubb_code($news[2]);
        echo "<table width=\"80%\" align=\"center\" cellspacing=\"0\" cellPadding=\"2\" border=\"1\" borderColor=\"black\">\n";
        echo "    <tr><td class=\"subTitle\" style=\"valign: top\">\n";
        echo $subject;
        echo "    </td></tr>";
        echo "    <tr><td class=\"mainTxt\" style=\"valign: top\">\n";
        echo $message;
        echo "    </td></tr>";
        echo "    <tr><td class=\"mainTxt\" style=\"text-align: right; valign: top\">\n";
        echo "~<a href=\"profile/".$news[3]."/\"><b>".$news[3]."</b></a>";
        echo "    </td></tr>";
        echo "</table><br />\n";
        $i++;
    }

    
    if($i == 0)
    {

        // No crew news
        echo "<table width=\"80%\" align=\"center\" cellspacing=\"0\" cellPadding=\"2\" border=\"1\" borderColor=\"black\">\n";
        echo "    <tr><td class=\"mainTxt\" style=\"valign: top; text-align: center; color: red;\">\n";
        echo "There is no crew news!";
        echo "    </td></tr>";
        echo "</table><br />";
    }

    // End crew news
    
    echo $echo;
    if(isset($_GET['delete'])) {
        if($data->level >= 3 OR checkpermissions($data->rights, 4096) OR checkpermissions($data->clanlevel, $config['crew_rights_reversed']['Moderate crew news'])) {
            if(is_numeric($_GET['delete'])) {
                $which_crew            = ($data->level < 3) ? "crew='".$data->clan."'" : "crew='Any crew'";
                $excist                = query("SELECT title, login FROM ea_area_off_topic WHERE id=".htmlspecialchars($_GET['delete'])." AND ".$which_crew." LIMIT 1", "fetch_row");
                if($excist) {
                    echo $translations['confirm_deletion']."<a href=\"news.php?read=".$_GET['delete']."\"><b>".htmlspecialchars($excist[0], ENT_QUOTES)."</b></a>".$translations['confirm_deletion_1']."<a href=\"profile/".$excist[1]."/\"><b>".$excist[1]."</b></a>?<br><br><a href=\"news.php?delete_confirmed=".htmlspecialchars($_GET['delete'])."\">".$translations['yes_delete_it']."</a>";
                }
else
                    echo "<font color=red>".$translations['invalid_id']."</font>";
            }
else
                echo "<font color=red>".$translations['invalid_id']."</font>";
        }
else
            echo "<font color=red>".$translations['no_deleting_rights']."</font>";
    }
elseif(isset($_GET['delete_confirmed'])) {
        if($data->level >= 3 OR checkpermissions($data->rights, 4096) OR checkpermissions($data->clanlevel, $config['crew_rights_reversed']['Moderate crew news'])) {
            if(is_numeric($_GET['delete_confirmed'])) {
                $which_crew            = ($data->level < 3 AND !checkpermissions($data->rights, 4096)) ? "crew='".$data->clan."'" : "crew='Any crew'";
                $which_user            = ($data->level < 3 AND checkpermissions($data->rights, 4096)) ? " AND login='".$data->login."'" : "";
                $excist                = query("SELECT id FROM ea_area_off_topic WHERE id=".htmlspecialchars($_GET['delete_confirmed'])." AND ".$which_crew.$which_user." LIMIT 1", "num_rows");
                if($excist == 1) {
                    query("DELETE FROM ea_area_off_topic WHERE id=".htmlspecialchars($_GET['delete_confirmed'])." AND (crew='Any crew' OR crew='".$data->clan."') LIMIT 1");
                    query("DELETE FROM ea_area_off_topic_replies WHERE article=".htmlspecialchars($_GET['delete_confirmed'])."");
                    echo $translations['article_deleted'];
                }
else
                    echo "<font color=red>".$translations['invalid_id']."</font>";
            }
else
                echo "<font color=red>".$translations['invalid_id']."</font>";
        }
else
            echo "<font color=red>".$translations['no_deleting_rights']."</font>";
    }


    $i = 0;
    $dbres = query("SELECT SQL_CACHE id, login, date, title, text, crew FROM ea_area_off_topic WHERE (crew='Any crew' OR crew='".$data->clan."') ORDER BY id DESC LIMIT 0,5");
    while($article = mysql_fetch_assoc($dbres)) {
        $align_at            = 1;
        $align_at1            = ($align_at) ? "right" : "left";
        $align_at2            = (!$align_at) ? "right" : "left";
        $align_at3            = ($align_at) ? "newSubTitle" : "newSubTitle1";
        $align_at4            = ($align_at) ? "" : "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
        $align_at5            = (!$align_at) ? "" : "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
        $admin_tools        = ($data->level >= 3 OR (checkpermissions($data->rights, 4096) AND $article['login'] == $data->login) OR (checkpermissions($data->clanlevel, $config['crew_rights_reversed']['Moderate crew news']) AND $article['crew'] == $data->clan)) ? "<div style=\"text-align: ".$align_at2."; float: ".$align_at2.";\"><input type=\"button\" onClick=\"window.location='news.php?delete=".$article['id']."'\" value=\"".$translations['delete']."\" style=\"color: red;\"> - <input type=\"button\" onClick=\"window.location='news.php?action=edit&x=".$article['id']."'\" value=\"".$translations['edit']."\" style=\"color: red;\"></div>" : "";
        echo "<table width=\"80%\" align=\"center\" cellspacing=\"0\" cellPadding=\"2\" border=\"1\" borderColor=\"black\">\n";
        echo "    <tr><td class=\"".$align_at3."\" colspan=\"2\" style=\"text-align: ".$align_at1."; valign: top\">\n";
        echo "        <div style=\"float: $align_at1;\"><b>".$align_at4.htmlspecialchars(stripslashes($article['title']), ENT_QUOTES).$align_at5."</b></div>".$admin_tools."\n";
        echo "    </td></tr>\n";
        echo "    <tr><td class=\"mainTxt\" valign=\"top\">\n";
        echo "        <table width=\"100%\" height=\"100%\">\n";
        echo "            <tr><td valign=\"top\">\n";
        echo "                ".ubb_code($article['text'])."<br style=\"clear: both;\">\n";
        echo "                <div style=\"text-align: right; font-size: 12px;\"><a href=\"news.php?read=".$article['id']."\" style=\"color: #aaaaaa\"><b>Comments &gt;&gt;</b></a></div>\n";
        echo "            </td></tr>\n";
        echo "            <tr><td valign=\"bottom\">\n";
        $patterns    = array();
        $patterns[] = "/DO_NOT_TRANSLATE\[POSTED_BY\]/";
        $patterns[] = "/DO_NOT_TRANSLATE\[POSTED_AT\]/";
        $replacements    = array();
        $replacements[] = "<a href=\"profile/".$article['login']."/\"><b>".$article['login']."</b></a>";
        $replacements[] = "<b>".myGMTtime($article['date'], $data->GMT, $translations['date_format'], true)."</b>";
        echo "                ".preg_replace($patterns, $replacements, $translations['posted_by_and_on'])."\n";
        echo "            </td></tr>\n";
        echo "        </table>";
        echo "    </td></tr>\n";
        echo "</table><br>\n\n";
        $i++;
    }


    echo "<table width=\"80%\" align=\"center\" cellspacing=\"0\" cellPadding=\"2\" border=\"1\" borderColor=\"black\">\n";
    echo "    <tr><td class=\"newSubTitle\"><b>".$translations['older_articles']."</b></td></tr>\n";
    $dbres = query("SELECT id, login, date, title FROM ea_area_off_topic WHERE (crew='Any crew' OR crew='".$data->clan."') ORDER BY id DESC LIMIT 5,25");
    while($article = mysql_fetch_assoc($dbres)) {
        echo "    <tr><td class=\"mainTxt\">".myGMTtime($article['date'], $data->GMT, "d/m")." - <a href=\"news.php?read=".$article['id']."\">".$article['title']."</a> by <a href=\"profile/".$article['login']."/\"><b>".$article['login']."</b></a>.</td></tr>\n";
    }

    echo "    <tr><td class=\"mainTxt\"><a href=\"news.php?showall=1\"><b>".$translations['show_all_articles']."</b></a></td></tr>\n";
    echo "</table>";
    if($data->level >= 3 OR checkpermissions($data->rights, 4096) OR checkpermissions($data->clanlevel, $config['crew_rights_reversed']['Moderate crew news']))
        echo "<center><br><a href=\"news.php?action=newarticle\"><img src=\"/images/icons/page_add.png\" border=\"0\" width=\"16\" height=\"16\"> ".$translations['write_new_article']."</a></center>";
}


bottom_layout(false);

?>


Edit:
Titel aangepast van 'enig idee wat ik fout doe' naar 'Script wordt niet goed uitgevoerd'
Gewijzigd op 04/09/2019 18:29:14 door - Ariën -
 
PHP hulp

PHP hulp

07/11/2024 19:49:47
 
- Ariën  -
Beheerder

- Ariën -

03/09/2019 14:55:13
Quote Anchor link
Zou je jouw bericht eigen aanpassen met een duidelijke titel die je probleem / vraagstelling duidelijk samenvat, en kan je in je bericht uitleggen wat er gebeurt?
Relevante code kan je tussen code-tags plaatsten (zie Veelgestelde Vragen).

Met enkel een lapje code kunnen we weinig.



Toevoeging op 03/09/2019 15:05:56:

Als je deze code in je browser ziet zal je blijkbaar <? gebruiken in plaats van <?php.

Anderzijds kan het ook zijn dat je geen .php extentie in je bestandsnaam hebt, of PHP staat uitgeschakeld op de server.

PS: Zoals ik net zei, toon a.u.b relevante code. 600 regels leest niemand graag door.

Verder is htmlspecialchars() geen oplossing tegen SQL-injection in queries. Gebruik mysqli_real_escape_string()
Gewijzigd op 03/09/2019 15:10:17 door - Ariën -
 
Thomas van den Heuvel

Thomas van den Heuvel

03/09/2019 15:39:26
Quote Anchor link
Voeg bovenaan je code het volgende toe:
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
<?php
error_reporting(E_ALL);
ini_set('display_startup_errors', true);
ini_set('display_errors', 'stdout');
?>


Heb je ook al je errorlogs geraadpleegd?

En man wat een spaghetticode...

echo echo echo echo echo. Je weet dat je een PHP-blok te allen tijde kunt opschorten en opnieuw kunt starten?

Het bovenstaande zou je sowieso in verschillende acties op moeten delen. Nu staat echt alles door elkaar. Wat een brei. Hoe oud is die code? 15+ jaar?
Gewijzigd op 03/09/2019 17:17:36 door Thomas van den Heuvel
 
- Ariën  -
Beheerder

- Ariën -

04/09/2019 10:56:53
Quote Anchor link
De HTML-code kan ook grondig op de schop. Tabellen zijn wel superhandig, maar door de uitgebreide set aan instellingen en eigenschappen voor stijlen enkel bedoeld voor tabulaire doeleinden, zoals overzichtjes en items-lijsten met kolommen.
Lees je eens in over HTML en CSS 3.0. ;-)

Enige onderverdeling in functies (of zelfs in classes) zou het al goed overzichtelijker maken. Herhalende code zoals je reeks aan smilies, die kan je prima uit een array halen met het foreach doorlopen. Dan kan je lap code van 50 regels minimaliseren tot enkele regels.
Gewijzigd op 04/09/2019 10:57:39 door - Ariën -
 
Sylvester vader

sylvester vader

04/09/2019 12:01:18
Quote Anchor link
lol even offtopic
ik vind manier van coding wel cool @yannick decock
ga ik even uitpluizen misschien leer ik er iets van

ik werk nogsteeds ouderwets met while enzo
dit ziet er in mijn ogen veel beter uit :)
 
- Ariën  -
Beheerder

- Ariën -

04/09/2019 13:02:18
Quote Anchor link
Persoonlijk vind ik dit (spaghetti)code van tien jaar geleden. Zo moet je tegenwoordig niet programmeren.

Bij voorkeur raad ik aan om HTML en PHP los te trekken, of minimaal HTML-structuren buiten PHP-blokken te plaatsen.

Verder is while() niet ouderwets. Het ligt eraan hoe je het gebruikt.
 
Sylvester vader

sylvester vader

04/09/2019 13:56:50
Quote Anchor link
haha, geef je ook les ?

ik ben echt nog van de tijd van if en else

in mijn codes zit html en php dwars door elkaar :S
 
Ozzie PHP

Ozzie PHP

04/09/2019 14:01:31
Quote Anchor link
"ik ben echt nog van de tijd van if en else"

Vreemde opmerking. If en else zijn gewoon nog steeds basis-functies in iedere programmeertaal.
 
- Ariën  -
Beheerder

- Ariën -

04/09/2019 14:17:53
Quote Anchor link
Sylvester vader op 04/09/2019 13:56:50:

in mijn codes zit html en php dwars door elkaar :S

Gelukkig gebruik ik tegenwoordig een templateparser (Smarty) om PHP en HTML gescheiden te houden in grote projecten.
Lees ook dit eens: https://php-programmer.nl/blog/vijf-redenen-om-te-werken-met-een-template-parser
Gewijzigd op 04/09/2019 14:27:30 door - Ariën -
 
Thomas van den Heuvel

Thomas van den Heuvel

04/09/2019 15:57:22
Quote Anchor link
Sylvester vader op 04/09/2019 12:01:18:
ik vind manier van coding wel cool @yannick decock
ga ik even uitpluizen misschien leer ik er iets van
ik werk nogsteeds ouderwets met while enzo
dit ziet er in mijn ogen veel beter uit :)

In wezen ben je met bovenstaande code in één groot if-statement allerlei acties aan het uitvoeren die eigenlijk beter programmatisch (of op een andere manier) gescheiden zouden moeten worden. Deze lap code wil simpelweg teveel dingen tegelijkertijd doen die eigenlijk in (grotere) afzondering behandeld zouden moeten worden. Zo schreef ik ca. ~14 jaar geleden ook code, maar op een gegeven moment kwam ik daar ook van terug omdat zulke if-statements op den duur steeds complexer worden als je hier acties bijmetselt. Het wordt op een gegeven moment een ware puzzel om na te gaan welke "toestand" er geldt in welke tak van het if-statement. Je wilt dan echt dingen anders en beter gaan splitsen.

Maar goed, misschien is dit voor jou nu "de volgende stap voorwaarts" en moet je hier gewoon zelf tegenaan lopen. Een gebrande hand is immers de beste leermeester.

- Ariën - op 04/09/2019 14:17:53:
Gelukkig gebruik ik tegenwoordig een templateparser (Smarty) om PHP en HTML gescheiden te houden in grote projecten.
Lees ook dit eens: https://php-programmer.nl/blog/vijf-redenen-om-te-werken-met-een-template-parser

Oh jee, weer een verkondiger van een <willekeurige template engine> evangelie. Okay, heel kort. Voor sommige zaken zijn templates handig, maar daarvoor heb je niet eens een aparte laag/library/whatever nodig. PHP kan dit prima zelf, PHP is namelijk ook een template engine! Ik durf te wedden dat ik vrij eenvoudig een Template class in elkaar kan stampen die precies hetzelfde doet, maar dan zonder het aanleren van een nieuwe syntax.

Daarnaast word ik een beetje moe van de notie dat een template engine een soort cure all is zou zijn voor van alles en nog wat. Templates engines kunnen bepaalde dingen ook gewoon niet *kuch*recursie*kuch*.

Template engines worden te vaak verward voor een doel, terwijl het slechts een middel is, en vaak is het helemaal niet nodig om dat middel te gebruiken om het doel te bereiken.
Gewijzigd op 04/09/2019 16:08:02 door Thomas van den Heuvel
 
- Ariën  -
Beheerder

- Ariën -

04/09/2019 16:22:40
Quote Anchor link
PHP kan inderdaad ook als parser dienen. Maar een class zoals Smarty kent ook weer caching, wat in sommige gevallen juist fijn is. En bovendien zorgt het er ook voor dat je geen PHP hoeft te gebruiken omdat het een eigen syntax heeft. Ideaal voor frontend-developers of webdesigners. Stel je voor dat je met PHP-templates een foute code in je templatebestanden plaatst. Dan breekt je website en met een bepaalde syntax hoeft niet zo te zijn omdat je daarmee dingen kan valideren.

Het is net wat je makkelijk en fijn vindt. Ikzelf gebruik het al 10 jaar en zie haast geen nadelen, op recursie na dan... maar daar is wel wat op te vinden.. :P
Gewijzigd op 04/09/2019 16:30:08 door - Ariën -
 
Sylvester vader

sylvester vader

04/09/2019 16:46:48
Quote Anchor link
Thomas van den Heuvel op 04/09/2019 15:57:22:
Maar goed, misschien is dit voor jou nu "de volgende stap voorwaarts" en moet je hier gewoon zelf tegenaan lopen. Een gebrande hand is immers de beste leermeester.


haha ja dat is zeker zo
en wat ik net zij over die if en else bedoel ik letterlijk

mijn code is echt nog van heel in het begin
ik heb een heel groot cms helemaal zelf gemaakt maar mijn codes zijn dus soms paginas met alleen maar if en else
of elseif

ik heb paginas waar misschien wel 50 keer een elseif instaat
ik heb dus bijna geen foreach in mijn scripting
ook functies gebruik ik bijna niet gewoon omdat mij dat nooit is geleerd
heel soms probeer ik paginas waar ik zeker van weet dat ze goed zijn en niet verandert hoeven worden, dan ga ik kijken of ik de code kan verbeteren en versnellen
ik heb scripts bv die van hun eigen al heel veel info opvragen en dan daarin via een while nog 3 extra queries opvragen en dat dan bv 15x30x12 om gegevens van een heel jaar te krijgen
elke dag heeft ongeveer 300 rijen die meegenomen worden
enz enz
geloof me mijn code is ouderwets
langzaam leer ik steeds iets bij en daarom vond ik dat zijn code voor mij er best wel netjes uitzag
en het mooiste is nog dat de belastingdienst zegt, dat met wat ik heb gemaakt ik goud in me handen heb
en het is nog niet eens klaar :P
maar volgens mij ga ik nu te ver offtopic

we zijn hier om topic schrijver te helpen
mijn problemen komen later wel :P
 
- Ariën  -
Beheerder

- Ariën -

04/09/2019 21:25:52
Quote Anchor link
Laten we inderdaad maar even op de topicstarter wachten.
Hopelijk heeft diegene zeker wat aan onze adviezen om zijn code op te schonen.
Want zeg nu zelf: Iedereen werkt toch graag in een schone omgeving? ;-)
 
Frank Nietbelangrijk

Frank Nietbelangrijk

05/09/2019 00:23:52
Quote Anchor link
Sylvester vader op 04/09/2019 13:56:50:
haha, geef je ook les ?

ik ben echt nog van de tijd van if en else

in mijn codes zit html en php dwars door elkaar :S


Oei oei oei hier begint het echt te jeuken. Ga me niet vertellen dat je die brei dan ook nog uit elkaar kunt houden na enige tijd. Ik denk dat het inderdaad tijd wordt (eigenlijk hoog tijd is) om weer eens achter de schoolbank te kruipen. Wat mij betreft is de tijd van if/else er ook nooit geweest. Immers bestaan functies al vanaf het jaar kruik. Het is enkel de hobbyist die in het wilde weg begonnen is met schrijven zonder ooit eens een boek te lezen of een cursus PROGRAMMEREN te volgen. Overigens is/was de (php) literatuur soms ook ver onder de maat. Hoe vaak zie je geen voorbeelden waarin er doodleuk met een blok HTML gestart wordt? En als je eens nadenkt: begin je dan dus met de output voordat je überhaupt weet wat je wilt gaan doen... Dat zou je immers eerst met je PHP applicatie moeten gaan beslissen. Je gaat toch ook niet autorijden voordat je weet waar je naar toe wil?
 
Sylvester vader

sylvester vader

05/09/2019 07:17:20
Quote Anchor link
Frank Nietbelangrijk op 05/09/2019 00:23:52:

Hoe vaak zie je geen voorbeelden waarin er doodleuk met een blok HTML gestart wordt?


haha zo ben ik vroeger inderdaad ook begonnen :P
mooi design maken dan slices en dan dat in html maken zodat het design werkte
en dan delen die ik bv in een database had dat erin krijgen
de rest van de html tussen echo '';
paginatje erbij met page= enz enz :P

goede oude tijd
 
Frank Nietbelangrijk

Frank Nietbelangrijk

05/09/2019 09:30:40
Quote Anchor link
Gelukkig gebruik je het woord 'vroeger' :p

Met eerst een design maken is overigens helemaal niets mis. Dat slicen (of in stukken hakken) is niet meer nodig als je een template engine gebruikt zoals Twig of Blade. Hierin overschrijf je gewoon hele blokken met andere content. Deze template engines zorgen er tevens voor dat je die data (al dan niet uit de database) van te voren verzameld waarmee we ons doel "Separation of concerns" ook direct benaderen...
 
Thomas van den Heuvel

Thomas van den Heuvel

05/09/2019 15:33:07
Quote Anchor link
Maar we dwalen af.

@yannick heb je al wat meldingen tevoorschijn kunnen toveren door bovenstaande ini_set() regels toe te voegen (zie mijn eerste reactie) of terug kunnen vinden in je errorlogs?

Sowieso is split() een alias die sinds PHP 7 is verwijderd.

Kijk ook uit, of nog beter, vermijd het gebruik van AND, gebruik in plaats hiervan &&. && werkt namelijk intuïtiever dan AND:
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
<?php
$test
= true && false;
echo 'true && false: '.($test ? 'TRUE' : 'FALSE'); // levert FALSE, zoals je zou verwachten
?>
<br><?php
$test
= false && true;
echo 'false && true: '.($test ? 'TRUE' : 'FALSE'); // levert FALSE, zoals je zou verwachten
?>
<br><?php
$test
= true AND false;
echo 'true AND false: '.($test ? 'TRUE' : 'FALSE'); // levert TRUE!
?>
<br><?php
$test
= false AND true;
echo 'false AND true: '.($test ? 'TRUE' : 'FALSE'); // levert FALSE, zoals je zou verwachten
?>

Gebruik op eenzelfde wijze || in plaats van OR.
Gewijzigd op 05/09/2019 15:34:32 door Thomas van den Heuvel
 
Willem vp

Willem vp

06/09/2019 01:04:31
Quote Anchor link
Thomas van den Heuvel op 05/09/2019 15:33:07:
Kijk ook uit, of nog beter, vermijd het gebruik van AND, gebruik in plaats hiervan &&. && werkt namelijk intuïtiever dan AND:

AND en OR zijn eigenlijk meer geschikt om iets flow control-achtigs mee te doen:
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
$fh = fopen("testfile.txt", "r") or show_error();

Omdat '=' een hogere precedentie heeft dan 'or' wordt eerst "$fh = fopen()" uitgevoerd en als die assignment een false-waarde oplevert, wordt de functie show_error() aangeroepen.

Zou je dit met een || doen, dan gebeurt er iets heel anders. '||' heeft namelijk een hogere precedentie dan '=', dus eerst wordt "fopen() || show_error()" uitgevoerd, en het resultaat daarvan wordt toegekend aan $fh. Het is dan afhankelijk van de return value van show_error() wat er misgaat in je code.

AND en OR zijn dus niet zozeer operators die je moet vermijden; het is meer een kwestie van weten waar ze geschikt voor zijn en ze in de juiste situatie toepassen. Zo vind ik het bovenstaande statement een stuk cleaner dan bijvoorbeeld:
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
if (($fh = fopen("testfile.txt", "r")) !== false) { show_error(); }
Gewijzigd op 06/09/2019 01:56:05 door Willem vp
 
Frank Nietbelangrijk

Frank Nietbelangrijk

06/09/2019 09:18:52
Quote Anchor link
Willem vp op 06/09/2019 01:04:31:
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
$fh = fopen("testfile.txt", "r") or show_error();

Zo vind ik het bovenstaande statement een stuk cleaner dan bijvoorbeeld:
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
if (($fh = fopen("testfile.txt", "r")) !== false) { show_error(); }


Mja of het dan voor iedereen direct duidelijk is betwijfel ik. En heb je dan ook nog zo een voorbeeld met de AND ?
 
Yannick decock

yannick decock

06/09/2019 10:41:01
Quote Anchor link
inderdaad deze code is een hele oude code maar zeker de moeite waard om deze opnieuw en mooi te schrijven
 
Willem vp

Willem vp

06/09/2019 11:21:07
Quote Anchor link
Frank Nietbelangrijk op 06/09/2019 09:18:52:
Mja of het dan voor iedereen direct duidelijk is betwijfel ik. En heb je dan ook nog zo een voorbeeld met de AND ?

Ik denk dat als je een dergelijke constructie drie keer hebt gezien, je wel weet wat het doet; zo ingewikkeld is het nu ook weer niet. En je elimineert een hoop ruis. Als je zoiets doet:
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
if (($fh = fopen("testfile.txt", "r")) !== false) { show_error(); }

dan staat je hoofd-statement (de fopen()) in een if-statement; dat is om meerdere redenen onhandig. Dat kun je uiteraard eenvoudig omzeilen:
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
$fh = fopen("testfile.txt", "r");
if (!fh) {
   show_error();
}

Maar op die manier wordt er heel veel focus gelegd op show_error(). Er wordt gesuggereerd dat die functie blijkbaar belangrijk genoeg is om een heel if-blok aan te wijden. Uiteraard is foutafhandeling heel belangrijk, maar in het verhaal dat je wilt vertellen met je code is het een insignificant detail. Met de 'or'-constructie:
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
$fh = fopen("testfile.txt", "r") or show_error();

staat het statement waar je de aandacht op wilt vestigen vooraan op de regel en wordt er minder nadruk gelegd op de bijzaak (de foutafhandeling). Dat vind ik het elegante aan deze constructie.

Voor de operator 'and' vind ik het lastiger een nuttig voorbeeld te bedenken.
 

Pagina: 1 2 volgende »



Overzicht Reageren

 
 

Om de gebruiksvriendelijkheid van onze website en diensten te optimaliseren maken wij gebruik van cookies. Deze cookies gebruiken wij voor functionaliteiten, analytische gegevens en marketing doeleinden. U vindt meer informatie in onze privacy statement.