-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadmin.php
More file actions
1377 lines (1301 loc) · 58.5 KB
/
Copy pathadmin.php
File metadata and controls
1377 lines (1301 loc) · 58.5 KB
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
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
###################
// TinyBB 1.0 - www.TinyBB.net
// Jake Steele
###################
// Configuration include files
@include("./inc/tinybb-settings.php");
$aversion = "1.2.4";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php if (($user[admin] == "1") && ($user[username] != null)){ ?>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo "$bbsetting[tinybb_title]"; ?> Administration</title>
<script src="SpryAssets/SpryAccordion.js" type="text/javascript"></script>
<script type="text/javascript">
function insertit(myField, myValue) {
if (document.selection) {
myField.focus();
sel = document.selection.createRange();
sel.text = myValue;
} else if (myField.selectionStart || myField.selectionStart == '0') {
var startPos = myField.selectionStart;
var endPos = myField.selectionEnd;
myField.value = myField.value.substring(0, startPos)
+ myValue
+ myField.value.substring(endPos, myField.value.length);
} else {
myField.value += myValue;
}
}
</script>
<?php
$codes = array(
'[b]' => '<span style="font-weight:bold">',
'[B]' => '<span style="font-weight:bold">',
'[/b]' => '</span>',
'[/B]' => '</span>',
'[i]' => '<span style="font-style:italic">',
'[I]' => '<span style="font-style:italic">',
'[/i]' => '</span>',
'[/I]' => '</span>',
'[u]' => '<span style="text-decoration:underline">',
'[U]' => '<span style="text-decoration:underline">',
'[/u]' => '</span>',
'[/U]' => '</span>',
':)' => '<img src="icons/smile2.png" />',
':D' => '<img src="icons/bigsmile.png" />',
'(L)' => '<img src="icons/love.png" />',
';)' => '<img src="icons/wink.png" />',
':@' => '<img src="icons/angry.png" />',
':$' => '<img src="icons/blush.png" />',
':P' => '<img src="icons/tongue.png" />',
':sw:' => '<img src="icons/skywalker.png" />',
':tired:' => '<img src="icons/yawn.png" />',
':(' => '<img src="icons/frown.png" />',
'[youtube]' => '<iframe title="YouTube video player" class="youtube-player" type="text/html" width="480" height="390" src="http://www.youtube.com/embed/',
'[/youtube]' => '" frameborder="0"></iframe>'
);
function convertbb($t) {
$s = array_keys($GLOBALS['codes']);
$t = str_replace($s, $GLOBALS['codes'], $t);
return $t;
}
function nl2br_limit($string, $num){
$dirty = preg_replace('/\r/', '', $string);
$clean = preg_replace('/\n{4,}/', str_repeat('<br/>', $num), preg_replace('/\r/', '', $dirty));
return nl2br($clean);
}
?>
<style type="text/css">
<!--
body {
font: 12px Verdana, Arial, Helvetica, sans-serif;
background: #81B5E9;
background: #feffff url(images/bg.jpg) top repeat-x;
background-repeat:repeat-x;
margin: 0; /* it's good practice to zero the margin and padding of the body element to account for differing browser defaults */
padding: 0;
text-align: center; /* this centers the container in IE 5* browsers. The text is then set to the left aligned default in the #container selector */
color: #000000;
}
textarea
{
width:98%;
}
.twoColFixLt #container {
width: 80%; /* using 20px less than a full 800px width allows for browser chrome and avoids a horizontal scroll bar */
background: #FFFFFF;
margin: 0 auto; /* the auto margins (in conjunction with a width) center the page */
border: 1px solid #000000;
text-align: left; /* this overrides the text-align: center on the body element. */
}
.twoColFixLt #sidebar1 {
float: left; /* since this element is floated, a width must be given */
width: 200px; /* the actual width of this div, in standards-compliant browsers, or standards mode in Internet Explorer will include the padding and border in addition to the width */
background: #fff; /* the background color will be displayed for the length of the content in the column, but no further */
border-right:1px;
border-left:0px;
border-top:0px;
border-bottom:0px;
margin-top:5px;
border-color:#A4A4A4;
border-style:solid;
padding: 15px 10px 15px 20px;
}
.twoColFixLt #mainContent {
margin: 0 0 0 250px; /* the left margin on this div element creates the column down the left side of the page - no matter how much content the sidebar1 div contains, the column space will remain. You can remove this margin if you want the #mainContent div's text to fill the #sidebar1 space when the content in #sidebar1 ends. */
padding: 0 20px 20px; /* remember that padding is the space inside the div box and margin is the space outside the div box */
min-height:600px;
}
.fltrt { /* this class can be used to float an element right in your page. The floated element must precede the element it should be next to on the page. */
float: right;
margin-left: 8px;
}
.fltlft { /* this class can be used to float an element left in your page */
float: left;
margin-right: 8px;
}
.clearfloat { /* this class should be placed on a div or break element and should be the final element before the close of a container that should fully contain a float */
clear:both;
height:0;
font-size: 1px;
line-height: 0px;
}
body {
padding-bottom: 0;
margin-bottom: 0;
}
body, a, td, th, input, textarea, select {
font-family: Arial;
font-size: 12px;
color: #444;
text-decoration: none;
}
a {
font-weight: bold;
}
img {
border: 0;
}
form {
padding: 0;
margin: 0;
}
table {
margin-left:auto;
margin-right:auto;
width:600px;
}
.box {
background: #fff;
padding: 5px;
margin-bottom: 10px;
}
.box .content {
padding: 0px 5px 5px 5px;
}
.square {
padding: 5px;
margin-bottom: 5px;
}
.square strong {
font-size: 14px;
}
.square.menu {
color: #fff;
margin-bottom: 0px;
cursor: pointer;
}
.square.title {
background-color: #eee;
color: #444;
}
#pmbar {
margin:5px;
width:600px;
text-align:center;
padding-top:4px;
padding-bottom:4px;
}
.square.good {
background-color: #d9ffcf;
border-color: #ade5a3;
color: #1b801b;
}
.square.bad {
background-color: #ffcfcf;
border-color: #e5a3a3;
color: #801b1b;
}
input, textarea, select {
border: 1px #e0e0e0 solid;
border-bottom-width: 2px;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
padding: 5px;
font-size: 14px;
font-weight: bold;
}
input:focus {
border-color: #ccc;
background-color: #fafafa;
}
input[type=submit], input.button {
border: 1px #e0e0e0 solid;
border-bottom-width: 2px;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
padding: 5px;
font-size: 14px;
font-weight: bold;
}
input[type=submit], input.submit {
border: 1px #e0e0e0 solid;
border-bottom-width: 2px;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
padding: 5px;
font-size: 14px;
font-weight: bold;
}
input[type=submit], input.submit:hover {
border: 1px #e0e0e0 solid;
border-bottom-width: 2px;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
padding: 5px;
font-size: 14px;
font-weight: bold;
}
td.label {
width: 25%;
text-align: right;
}
td.field {
width: 200px;
text-align: right;
}
.tpaw {
background-color: #eee;
color: #333;
padding:5px;
border:#f2f2f2 thin solid;
}
.tpow {
background-color: #f8f8f8;
color:#333;
padding:5px;
border:#f2f2f2 thin solid;
}
.tpow:hover {
background-color: #f2f2f2;
color:#222;
padding:5px;
border:#eee thin solid;
}
.tpew {
background-color: #ccc;
font-size:16px;
color: #333;
padding:5px;
border:#f2f2f2 thin solid;
}
.tpiw {
background-color: #ccc;
font-size:16px;
color: #333;
padding:5px;
border:#f2f2f2 thin solid;
}
.read {
font-weight:normal;
}
.alert {
color: #ffffff;
background-color: #1C1C1C;
background-image: url('icons/alert.png');
padding:5px;
margin: 10px 0px;
padding:15px 10px 15px 50px;
background-repeat: no-repeat;
background-position: 10px center;
}
#forum
{
font-family:"Trebuchet MS", Arial, Helvetica, sans-serif;
width:75%;
border-collapse:collapse;
}
#forum td, #forum th
{
font-size:1em;
border:1px solid #000;
padding:3px 7px 2px 7px;
}
#forum th
{
font-size:13px;
text-align:left;
padding-top:5px;
padding-bottom:4px;
background-image:url('style/thread_header.png');
color:#ffffff;
}
#forum tr.alt td
{
color:#000000;
background-color:#EAF2D3;
}
.admin {
font-size:12px;
text-align:left;
padding:10px;
background-image:url('style/thread_header.png');
color:#ffffff;
}
.admin {
color: #ffffff;
background-image:url('style/thread_header.png');
}
.avatar {
max-width: 25px;
max-height: 25px;
}
.warning {
color: #ffffff;
background-color: #1C1C1C;
background-image: url('icons/alert.png');
padding:5px;
margin: 10px 0px;
padding:15px 10px 15px 50px;
background-repeat: no-repeat;
background-position: 10px center;
}
.error {
padding:10px;
color: #D8000C;
background-color: #FFBABA;
background-image: url('error.png');
}
.success {
color: #4F8A10;
padding:10px;
background-color: #DFF2BF;
background-image:url('success.png');
}
-->
</style>
<!--[if IE 5]>
<style type="text/css">
/* place css box model fixes for IE 5* in this conditional comment */
.twoColFixLt #sidebar1 { width: 230px; }
</style>
<![endif]--><!--[if IE]>
<style type="text/css">
/* place css fixes for all versions of IE in this conditional comment */
.twoColFixLt #sidebar1 { padding-top: 30px; }
.twoColFixLt #mainContent { zoom: 1; }
/* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */
</style>
<![endif]-->
<script src="SpryAssets/SpryCollapsiblePanel.js" type="text/javascript"></script>
<link href="SpryAssets/SpryCollapsiblePanel.css" rel="stylesheet" type="text/css" />
<link href="SpryAssets/SpryAccordion.css" rel="stylesheet" type="text/css" />
</head>
<body class="twoColFixLt">
<p> </p>
<div id="container">
<div class="admin"><strong><?php echo "$bbsetting[tinybb_title]"; ?> Administration Panel</strong> <a href="index.php?page=logout"><span style="float:right; color:#ffffff; font-weight:bold;">Logout</span></a></div>
<div id="sidebar1">
<?php $list = $_GET['list']; ?>
<h3>Manage Forum</h3>
<p><img src="icons/none.gif" alt="none" /> <a href="index.php">Forum Home</a><br />
<img src="icons/none.gif" alt="none" /> <a href="admin.php">Admin Home</a> </p>
<div id="CollapsiblePanel2" class="CollapsiblePanel" align="center">
<div class="CollapsiblePanelTab" tabindex="0"><img src="admin/settings.png" border="0" /> Forums </div>
<div class="CollapsiblePanelContent">
<p>
<a href="?list=settings">Forum Settings</a><br />
<a href="?list=categories">Categories</a><br />
<a href="?list=modcp">ModCP Settings</a><br />
<a href="?list=stats">Statistics</a><br /><br />
<br />
</p>
</div>
</div>
<div id="CollapsiblePanel1" class="CollapsiblePanel" align="center">
<div class="CollapsiblePanelTab" tabindex="0"><img src="admin/settings.png" border="0" /> Config </div>
<div class="CollapsiblePanelContent">
<p>
<a href="?list=accounts">List Accounts</a><br />
<a href="?list=addaccount">Add New Account</a><br />
<a href="?list=deleteaccount">Delete Account</a><br />
<a href="?list=ipsearch">Search IP's</a><br />
<a href="?list=awards">Profile Awards</a><br /><br />
</p>
</div>
</div>
<div id="CollapsiblePanel4" class="CollapsiblePanel" align="center">
<div class="CollapsiblePanelTab" tabindex="0"><img src="admin/news.png" border="0" /> TinyBB News CMS</div>
<div class="CollapsiblePanelContent">
<p><a href="?news=add">Add Article</a><br />
<a href="?news=list">List Articles</a><br />
<a href="index.php?page=news">News Page</a><br /><br />
</p>
</div>
</div>
<div id="CollapsiblePaneTBB" class="CollapsiblePanel" align="center">
<div class="CollapsiblePanelTab" tabindex="0"><img src="admin/tinybb.png" border="0" /> TinyBB</div>
<div class="CollapsiblePanelContent">
<p><a href="?tinybb=version">Version Information</a><br />
<a href="http://tinybb.net/forum/?page=downloads" target="_blank">Downloads Section</a><br />
<a href="http://tinybb.net/forum/?page=mods" target="_blank">Approved Modifications</a><br />
</p>
</div>
</div>
<p> </p>
<!-- end #sidebar1 --></div>
<div id="mainContent">
<?php if ($_GET[tinybb] == "version"){ ?>
<h2><img src="admin/tinybb.png" border="0"> Version Information</h2>
<hr>
Your bulletin board is running TinyBB 1.4.2 Stable
<br /><br />
This forum is powered by 1.4.2 Stable by the TinyBB team. Currently there are no exploits known to us.
<?php } elseif($list == "modcp"){ ?>
<h2><img src="icons/idea.gif" border="0"> Moderator Control Panel Settings</h2>
<?php if ($_GET['do'] == "update"){ ?>
<?php
$message = addslashes(htmlspecialchars($_POST[notice]));
$rules = addslashes(htmlspecialchars($_POST[rules]));
$update = mysqli_query($conn,"UPDATE `admin` SET
`admin_message` = '$message',
`rules` = '$rules'
") or die("<meta HTTP-EQUIV=\"REFRESH\" content=\"0; url=admin.php?list=modcp&m=2\">");
?>
<?php die("<meta HTTP-EQUIV=\"REFRESH\" content=\"0; url=admin.php?list=modcp&m=1\">"); ?>
<?php } else { ?>
<?php
$notes = mysqli_query($conn,"SELECT * FROM `admin`");
$notes = mysqli_fetch_array($notes);
?>
<?php
if ($_GET['m'] == "1"){ echo "<br /><div class='success'>Moderator Settings updated.</div>"; }
elseif ($_GET['m'] == "2"){ echo "<br /><div class='error'>The query couldn't complete, there was an error.</div>"; }
?>
<br /><br />
<form action="admin.php?list=modcp&do=update" method="POST">
Administrative Message (Displayed on moderator home)<br />
<textarea name="notice" rows="10" cols="10"><?php echo "$notes[admin_message]"; ?></textarea>
<br /><br />
Rules & Information for moderators (Displayed on rules page)<br />
<textarea name="rules" rows="10" cols="10"><?php echo "$notes[rules]"; ?></textarea>
<br /><br />
<input type="submit" value="Update">
</form>
<?php } ?>
<?php } elseif($list == "edit"){ ?>
<?php if ($_GET['m'] == "1"){ echo "<br /><div class='success'>Thread successfully updated.</div>"; }
elseif ($_GET['m'] == "2"){ echo "<br /><div class='error'>There was an SQL error while attempting to update the thread.</div>"; }
elseif ($_GET['m'] == "3"){ echo "<br /><div class='error'>Fields were left blank, unable to process the query without disrupting current threads.</div>"; } ?>
<?php if ($_GET['type'] == "thread"){ echo "<h2><img src=\"icons/idea.gif\" border=\"0\"> Edit Thread</h2>";
?>
<?php
$thread = $_GET['thread'];
$sql = mysqli_query($conn,"SELECT * FROM `tinybb_threads` WHERE `thread_key` = '$thread'");
$setting = mysqli_fetch_array($sql);
?>
<?php if ($_GET['do'] == "update"){ ?>
<?php
$title = addslashes(htmlspecialchars($_POST[title]));
$author = addslashes(htmlspecialchars($_POST[author]));
$content = addslashes(htmlspecialchars($_POST[content]));
$cat_id = addslashes(htmlspecialchars($_POST[category]));
$id = $_POST['id'];
if ((($title == "") || ($author == "") || ($content == ""))){ die("<meta HTTP-EQUIV=\"REFRESH\" content=\"0; url=admin.php?list=edit&m=3\">"); }
$update = mysqli_query($conn,"UPDATE `tinybb_threads` SET
`thread_title` = '$title',
`cat_id` = '$cat_id',
`thread_author` = '$author',
`thread_content` = '$content'
WHERE `thread_key` = '$id' ") or die("<meta HTTP-EQUIV=\"REFRESH\" content=\"0; url=admin.php?list=edit&m=2\">");
?>
<?php die("<meta HTTP-EQUIV=\"REFRESH\" content=\"0; url=admin.php?list=edit&type=thread&thread=$_POST[id]&m=1\">"); ?>
<?php } else { ?>
<form action="admin.php?list=edit&type=thread&do=update" method="POST">
<input type="hidden" name="id" value="<?php echo "$_GET[thread]"; ?>">
Thread Title<br />
<input type="text" name="title" value="<?php echo "$setting[thread_title]"; ?>" size="50">
<br /><br />
Thread Author<br />
<input type="text" name="author" value="<?php echo "$setting[thread_author]"; ?>" size="50">
<br /><br />
Thread Category<br />
<select name='category'>
<option value="<?php echo "$setting[cat_id]"; ?>"><strong><i>No Change</i></strong>
<?php
$query5 = "SELECT * FROM tinybb_categories";
$result5 = mysqli_query($conn,$query5);
while($row5 = mysqli_fetch_array($result5, MYSQL_ASSOC)){
echo "<option value='$row5[cat_id]'>$row5[cat_title]";
}
?>
</select>
<br /><br />
Thread Content<br />
<textarea name="content" rows="10" cols="10"><?php echo "$setting[thread_content]"; ?></textarea>
<br /><br />
<input type="submit" value="Update Thread">
</form>
<?php
} } elseif ($_GET['type'] == "reply"){ echo "<h2><img src=\"icons/idea.gif\" border=\"0\"> Edit Reply</h2>"; ?>
<?php
$thread = $_GET['reply'];
$sql = mysqli_query($conn,"SELECT * FROM `tinybb_replies` WHERE `reply_key` = '$thread'");
$setting = mysqli_fetch_array($sql);
?>
<?php if ($_GET['do'] == "update"){ ?>
<?php
$author2 = addslashes(htmlspecialchars($_POST[author]));
$content2 = addslashes(htmlspecialchars($_POST[content]));
$id = $_POST['id'];
$update = mysqli_query($conn,"UPDATE `tinybb_replies` SET
`reply_author` = '$author2',
`reply_content` = '$content2'
WHERE `reply_key` = '$id'") or die("<meta HTTP-EQUIV=\"REFRESH\" content=\"0; url=admin.php?list=edit&m=2\">");
?>
<?php die("<meta HTTP-EQUIV=\"REFRESH\" content=\"0; url=admin.php?list=edit&type=reply&reply=$_POST[id]&m=1\">"); ?>
<?php } else { ?>
<form action="admin.php?list=edit&type=reply&do=update" method="POST">
<input type="hidden" name="id" value="<?php echo "$_GET[reply]"; ?>">
Reply Author<br />
<input type="text" name="author" value="<?php echo "$setting[reply_author]"; ?>" size="50">
<br /><br />
Thread Content<br />
<textarea name="content" rows="10" cols="10"><?php echo "$setting[reply_content]"; ?></textarea>
<br /><br />
<input type="submit" value="Update Thread">
</form>
<?php } }
?>
<?php } elseif($list == "settings"){ ?>
<?php if ($_GET['do'] == "update"){ ?>
<h2><img src="icons/idea.gif" border="0"> Updating Settings</h2>
<?php
$title = addslashes(htmlspecialchars($_POST[bbtitle]));
$guests = addslashes(htmlspecialchars($_POST[guests]));
$categories = addslashes(htmlspecialchars($_POST[categories]));
$maintenance = addslashes(htmlspecialchars($_POST[maintenance]));
$stats = addslashes(htmlspecialchars($_POST[stats]));
$maintenance_message = addslashes(htmlspecialchars($_POST[maintenance_message]));
$registration = addslashes(htmlspecialchars($_POST[register]));
if ((((($title == "") || ($guests == "") || ($categories == "") || ($maintenance == "") || ($registration == ""))))){ die("<meta HTTP-EQUIV=\"REFRESH\" content=\"0; url=admin.php?list=settings&m=3\">"); }
$update = mysqli_query($conn,"UPDATE `tinybb_settings` SET
`tinybb_title` = '$title',
`tinybb_guest_access` = '$guests',
`tinybb_stats` = '$stats',
`tinybb_maintenance` = '$maintenance',
`tinybb_maintenance_message` = '$maintenance_message',
`tinybb_categories` = '$categories',
`tinybb_registration` = '$registration'
") or die("<meta HTTP-EQUIV=\"REFRESH\" content=\"0; url=admin.php?list=settings&m=2\">");
?>
<?php echo "<meta HTTP-EQUIV=\"REFRESH\" content=\"0; url=admin.php?list=settings&m=1\">"; ?>
<?php } else { ?>
<?php
$sql = mysqli_query($conn,"SELECT * FROM `tinybb_settings`");
$setting = mysqli_fetch_array($sql);
?>
<?php if ($_GET['m'] == "1"){ echo "<br /><div class='success'>Forum settings successfully updated.</div>"; }
elseif ($_GET['m'] == "2"){ echo "<br /><div class='error'>There was an SQL error while attempting to update the forum settings.</div>"; }
elseif ($_GET['m'] == "3"){ echo "<br /><div class='error'>Fields were left blank, unable to process the query without disrupting current settings.</div>"; } ?>
<h2><img src="icons/idea.gif" border="0"> General Settings</h2>
<form action="?list=settings&do=update" method="POST">
<strong>Bulletin Board Title</strong><br />
<input type="text" name="bbtitle" value="<?php echo "$setting[tinybb_title]"; ?>" size="50" autocomplete="off">
<br /><br />
<strong>Guests can access the forum?</strong><br />
<input type="radio" name="guests" value="1" <?php if ($setting[tinybb_guest_access] == "1"){ echo "CHECKED"; } ?>/> Yes<br />
<input type="radio" name="guests" value="0" <?php if (!$setting[tinybb_guest_access] == "1"){ echo "CHECKED"; } ?>/> No (Must login)
<br /><br />
<h2><img src="icons/idea.gif" border="0"> Member Settings</h2>
<strong>Registration</strong> (If disabled, the register page will show a disabled message)<br />
<input type="radio" name="register" value="1" <?php if ($setting[tinybb_registration] == "1"){ echo "CHECKED"; } ?>/> Enabled<br />
<input type="radio" name="register" value="0" <?php if (!$setting[tinybb_registration] == "1"){ echo "CHECKED"; } ?>/> Disabled
<br /><br />
<h2><img src="icons/schat.gif" border="0"> Category Settings</h2>
<strong>Categories Enabled?</strong> (If disabled, the forum home will be similar to the 1.0 - 1.3 series)<br />
<input type="radio" name="categories" value="1" <?php if ($setting[tinybb_categories] == "1"){ echo "CHECKED"; } ?>/> Enabled<br />
<input type="radio" name="categories" value="0" <?php if (!$setting[tinybb_categories] == "1"){ echo "CHECKED"; } ?>/> Disabled
<br /><br />
<h2><img src="icons/stats.gif" border="0"> Forum index Settings</h2>
<strong>Enable Statistics?</strong><br />
<input type="radio" name="stats" value="1" <?php if ($setting[tinybb_stats] == "1"){ echo "CHECKED"; } ?>/> Enabled<br />
<input type="radio" name="stats" value="0" <?php if (!$setting[tinybb_stats] == "1"){ echo "CHECKED"; } ?>/> Disabled
<br /><br />
<h2><img src="icons/reports.png" border="0"> Maintenance Settings</h2>
<strong>Board Setting</strong> (If disabled the maintenance message will be shown to all users not logged in)<br />
<input type="radio" name="maintenance" value="1" <?php if ($setting[tinybb_maintenance] == "1"){ echo "CHECKED"; } ?>/> Enabled<br />
<input type="radio" name="maintenance" value="0" <?php if (!$setting[tinybb_maintenance] == "1"){ echo "CHECKED"; } ?>/> Disabled
<br /><br />
<strong>Maintenance Message</strong><br />
<input type="text" name="maintenance_message" size="50" autocomplete="off" value="<?php echo "$setting[tinybb_maintenance_message]"; ?>">
<br /><br />
<input type="submit" value="Save Settings">
</form>
<?php } } elseif ($list == "categories"){ ?>
<?php if ($_GET['do'] == "delete"){ ?>
<?php
$catid = clean($_GET[cat]);
$sql = mysqli_query($conn,"SELECT * FROM `tinybb_categories` WHERE `cat_id` = '$catid'");
$checker = mysqli_fetch_array($sql);
?>
<h2><img src="icons/idea.gif" border="0"> Delete <?php echo "$checker[cat_title]"; ?></h2>
<div class="alert" style="font-size:13px; font-weight:bold;">Please use this feature carefully, deleting a category is permanent!</div>
<?php if (!$_GET['con'] == "1"){ ?>
<?php
$check_category = mysqli_query($conn,"SELECT * FROM `tinybb_categories` WHERE `cat_id` = '$catid'") or die(mysqli_error());
if(mysqli_num_rows($check_category) == 0){
die("<h2><img src='icons/idea.gif' border='0'> Error</h2>The category you're attempting to delete doesn't exist...");
}
?>
<br />
<form action="?list=categories&do=delete&con=1" method="POST">
<input type="hidden" name="idoc" value="<?php echo "$_GET[cat]"; ?>">
Confirm this deletion<br />
<select name="confirm">
<option value="0">Do not delete <?php echo "$checker[cat_title]"; ?>
<option value="1">Delete <?php echo "$checker[cat_title]"; ?>
</select>
<br /><br />
Move existing threads to (Enter ID of category)<br />
<input type="text" name="idtmt" size="50">
<br /><br />
<input type="submit" value="Delete Category">
</form>
<?php } else { ?>
<?php
$id = addslashes(htmlspecialchars($_POST[idoc]));
$confirm = addslashes(htmlspecialchars($_POST[confirm]));
$idtmt = addslashes(htmlspecialchars($_POST[idtmt]));
if (!$confirm == "1"){ die("<meta HTTP-EQUIV=\"REFRESH\" content=\"0; url=admin.php?list=categories&m=9\">"); }
if (empty($idtmt)){ die("You must choose a category to move existing threads to."); }
$check_category = mysqli_query($conn,"SELECT * FROM `tinybb_categories` WHERE `cat_id` = '$_POST[idtmt]'") or die(mysqli_error());
if(mysqli_num_rows($check_category) == 0){
die("<meta HTTP-EQUIV=\"REFRESH\" content=\"0; url=admin.php?list=categories&m=8\">");
}
?>
<?php mysqli_query($conn,"DELETE FROM tinybb_categories WHERE cat_id='$id'") or die("<meta HTTP-EQUIV=\"REFRESH\" content=\"0; url=admin.php?list=categories&m=7\">"); ?>
<?php $update = mysqli_query($conn,"UPDATE `tinybb_threads` SET `cat_id` = '$idtmt' WHERE `cat_id` = '$id'") or die("<meta HTTP-EQUIV=\"REFRESH\" content=\"0; url=admin.php?list=categories&m=6\">"); ?>
<?php die("<meta HTTP-EQUIV=\"REFRESH\" content=\"0; url=admin.php?list=categories&m=10\">"); ?>
<?php } ?>
<?php } elseif ($_GET['do'] == "settings"){ ?>
<h2><img src="icons/idea.gif" border="0"> Category Settings</h2>
<?php if ($_GET['s'] == "2"){ ?>
<?php
$amount = addslashes(htmlspecialchars($_POST[number]));
$update = mysqli_query($conn,"UPDATE `tinybb_settings` SET `tinybb_list_amount` = '$amount'") or die("<meta HTTP-EQUIV=\"REFRESH\" content=\"0; url=admin.php?list=categories&m=5\">");
?>
<?php die("<meta HTTP-EQUIV=\"REFRESH\" content=\"0; url=admin.php?list=categories&m=4\">"); ?>
<?php } else { ?>
<?php
$sql = mysqli_query($conn,"SELECT * FROM `tinybb_settings`");
$setting = mysqli_fetch_array($sql);
?>
To disable categories, please edit your <a href="admin.php?list=settings">bulletin board settings</a>.<br /><br />
<form action="?list=categories&do=settings&s=2" method="POST">
How many threads to show per page<br />
<input type="text" name="number" value="<?php echo "$setting[tinybb_list_amount]"; ?>" size="50" autocomplete="off">
<br /><br />
<input type="submit" value="Save Settings">
</form>
<?php } } elseif ($_GET['do'] == "add"){ ?>
<h2><img src="icons/idea.gif" border="0"> Add Category</h2>
<?php if ($_GET['s'] == "2"){ ?>
<?php
$title = addslashes(htmlspecialchars($_POST[title]));
$desc = addslashes(htmlspecialchars($_POST[desc]));
$icon = addslashes(htmlspecialchars($_POST[icon]));
$perm = addslashes(htmlspecialchars($_POST[perm]));
$order = addslashes(htmlspecialchars($_POST[order]));
if ((($title == null) || ($perm == null) || ($order == null))) { die("<meta HTTP-EQUIV=\"REFRESH\" content=\"0; url=admin.php?list=categories&m=2\">"); } else {
$sql = "INSERT INTO tinybb_categories
(
cat_title,
cat_desc,
cat_icon,
cat_admin,
cat_order
)
VALUES
(
'$title',
'$desc',
'$icon',
'$perm',
'$order'
)";
mysqli_query($conn,$sql) or die("<meta HTTP-EQUIV=\"REFRESH\" content=\"0; url=admin.php?list=categories&m=3\">");
}
?>
<?php die("<meta HTTP-EQUIV=\"REFRESH\" content=\"0; url=admin.php?list=categories&m=1\">"); ?>
<?php } else { ?>
<form action="?list=categories&do=add&s=2" method="POST">
Category Title<br />
<input type="text" name="title" size="50">
<br /><br />
Category Description (45 Characters Max)<br />
<input type="text" name="desc" size="50" maxlength="45">
<br /><br />
Category Icon (Leave blank for default)<br />
<input type="text" name="icon" size="50">
<br /><br />
Permission to create threads<br />
<input type="radio" name="perm" value="1" /> Staff<br />
<input type="radio" name="perm" value="0" /> All
<br /><br />
Category Order (Enter numbers only, categorys are decending, 1 at the top, 100 at the bottom ect..)<br />
<input type="text" name="order" size="50">
<br /><br />
<input type="submit" value="Add Category">
</form>
<?php } } elseif ($_GET['do'] == "edit"){ ?>
<?php
$catid = clean($_GET[cat]);
$sql = mysqli_query($conn,"SELECT * FROM `tinybb_categories` WHERE `cat_id` = '$catid'");
$checker = mysqli_fetch_array($sql);
?>
<h2><img src="icons/idea.gif" border="0"> Editing <?php echo "$checker[cat_title]"; ?></h2>
<?php if ($_GET['s'] == "2"){ ?>
<?php
$title = addslashes(htmlspecialchars($_POST[title]));
$desc = addslashes(htmlspecialchars($_POST[desc]));
$icon = addslashes(htmlspecialchars($_POST[icon]));
$perm = addslashes(htmlspecialchars($_POST[perm]));
$order = addslashes(htmlspecialchars($_POST[order]));
$update = mysqli_query($conn,"UPDATE `tinybb_categories` SET `cat_title` = '$title', `cat_desc` = '$desc', `cat_icon` = '$icon', `cat_admin` = '$perm', `cat_order` = '$order' WHERE `cat_id` = '$_POST[idoc]'") or die("Could not update category, MySQL error, query could not complete.");
?>
<?php die("<meta HTTP-EQUIV=\"REFRESH\" content=\"0; url=admin.php?list=categories&m=4\">"); ?>
<?php } else { ?>
<?php
$check_category = mysqli_query($conn,"SELECT * FROM `tinybb_categories` WHERE `cat_id` = '$catid'") or die(mysqli_error());
if(mysqli_num_rows($check_category) == 0){
die("<meta HTTP-EQUIV=\"REFRESH\" content=\"0; url=admin.php?list=categories&m=11\">");
}
?>
<form action="?list=categories&do=edit&s=2" method="POST">
<input type="hidden" name="idoc" value="<?php echo "$_GET[cat]"; ?>">
Category Title<br />
<input type="text" name="title" size="50" value="<?php echo "$checker[cat_title]"; ?>">
<br /><br />
Category Description (45 Characters Max)<br />
<input type="text" name="desc" size="50" maxlength="45" value="<?php echo "$checker[cat_desc]"; ?>">
<br /><br />
Category Icon (Leave blank for default)<br />
<input type="text" name="icon" size="50" value="<?php echo "$checker[cat_icon]"; ?>">
<br /><br />
Permission to create threads<br />
<input type="radio" name="perm" value="1" <?php if ($checker[cat_admin] == "1"){ echo "CHECKED"; } ?>/> Staff<br />
<input type="radio" name="perm" value="0" <?php if (!$checker[cat_admin] == "1"){ echo "CHECKED"; } ?>/> All
<br /><br />
Category Order (Enter numbers only, categorys are decending, 1 at the top, 100 at the bottom ect..)<br />
<input type="text" name="order" size="50" value="<?php echo "$checker[cat_order]"; ?>">
<br /><br />
<input type="submit" value="Edit Category">
</form>
<?php } } else { ?>
<h2><img src="icons/idea.gif" border="0"> Categories</h2>
<a href="admin.php?list=categories&do=add">Add Category</a> | <a href="admin.php?list=categories&do=settings">Settings</a>
<hr>
<?php if ($_GET['m'] == "1"){ echo "<br /><div class='success'>Success: Category successfully added.</div>"; }
elseif ($_GET['m'] == "2"){ echo "<br /><div class='error'>Permission Error: Field left blank!</div>"; }
elseif ($_GET['m'] == "3"){ echo "<br /><div class='error'>MySQL Query Error: Query could not complete!</div>"; }
elseif ($_GET['m'] == "4"){ echo "<br /><div class='success'>Success: Category settings updated.</div>"; }
elseif ($_GET['m'] == "5"){ echo "<br /><div class='error'>MySQL Query Error: Error updating category settings!</div>"; }
elseif ($_GET['m'] == "6"){ echo "<br /><div class='error'>MySQL Query Error: Couldn't update location of threads!</div>"; }
elseif ($_GET['m'] == "7"){ echo "<br /><div class='error'>MySQL Query Error: Couldn't delete the category!</div>"; }
elseif ($_GET['m'] == "8"){ echo "<br /><div class='error'>MySQL Query Error: Cannot move threads to an unknown category!</div>"; }
elseif ($_GET['m'] == "9"){ echo "<br /><div class='error'>Permission Error: Deletion must be confirmed!</div>"; }
elseif ($_GET['m'] == "10"){ echo "<br /><div class='success'>Success: Category deleted.</div>"; }
elseif ($_GET['m'] == "11"){ echo "<br /><div class='error'>MySQL Query Error: The category you're attempting to edit doesn't exist!</div>"; }
?>
<br />
<?php include("admin/categories.php"); ?>
<?php } } elseif ($list == "stats"){ ?>
<h2><img src="icons/idea.gif" /> Forum Statistics</h2>
<hr />
<?php
$sql = "SELECT * FROM tinybb_threads ORDER BY aid DESC LIMIT 1";
$res = mysqli_query($conn,$sql) or die (mysqli_error());
while($r=mysqli_fetch_assoc($res)){
echo "<strong>Latest Thread:</strong><a href=\"index.php?page=thread&post=".$r['thread_key']."\"> <span style='font-size:14px;'>".$r['thread_title']."</span></a><br>";
}
?>
<?php
$sql = "SELECT * FROM tinybb_replies ORDER BY aid DESC LIMIT 1";
$res = mysqli_query($conn,$sql) or die (mysqli_error());
while($r=mysqli_fetch_assoc($res)){
echo "<strong>Latest Reply:</strong><a href=\"index.php?page=thread&post=".$r['thread_key']."#last\"> <span style='font-size:14px;'>Here</span></a><br>";
}
?>
<?php
$sql = "SELECT * FROM members ORDER BY id DESC LIMIT 1";
$res = mysqli_query($conn,$sql) or die (mysqli_error());
while($r=mysqli_fetch_assoc($res)){
echo "<strong>Newest Member:</strong> <a href=\"index.php?page=profile&id=".$r['username']."\"> <span style='font-size:14px;'>".$r['username']."</span></a><br>";
}
?>
<?php
$date = date("d-m-Y");
$result2 = mysqli_query($conn,"SELECT * FROM tinybb_threads");
$threads = mysqli_num_rows($result2);
$result3 = mysqli_query($conn,"SELECT * FROM tinybb_replies");
$replies = mysqli_num_rows($result3);
$result4 = mysqli_query($conn,"SELECT * FROM members");
$users = mysqli_num_rows($result4);
$result5 = mysqli_query($conn,"SELECT * FROM members WHERE date='$date'");
$today = mysqli_num_rows($result5);
echo "<br /><h2><img src='admin/mail.png' border='0'> Private Message System</h2>$pm Private messages sent/received";
echo "<br /><h2><img src='admin/threads.png' border='0'> Threads/Replies</h2>$threads Threads created<br />$replies Replies created";
echo "<br /><h2><img src='admin/users.png' border='0'> Accounts</h2>$users Accounts Created<br />$today Accounts created today";
?>
<?php } elseif ($list == "awards"){ ?>
<h3><img src="icons/user.gif" /> Awards</h3>
<?php if ($_GET['do'] == "delete"){ ?>
<?php mysqli_query($conn,"DELETE FROM awards WHERE id='$_GET[id]'") or die("Couldn't delete the award, MySQL error."); ?>
Award successfully deleted! <a href="?list=awards">Back to awards list</a>.
<?php } elseif ($_GET['do'] == "add") { ?>
<a href="?list=awards">Cancel</a><br /><br />
<form action="?list=awards&do=savenew" method="POST">
Award Image URL<br />
<input type="text" name="image" size="50"><br /><br />
Give Award To (Member name)<br />
<input type="text" name="user" size="50"><br /><br />
Reason For Award<br />
<input type="text" name="desc" size="50">
<br /><br />
<input type="submit" value="Add Award">
</form>
<?php } elseif ($_GET['do'] == "savenew") { ?>
<?php
$user = addslashes(htmlspecialchars($_POST[user]));
$image = addslashes(htmlspecialchars($_POST[image]));
$desc = addslashes(htmlspecialchars($_POST[desc])); #
if (($user == null) || ($image == null)) { die("<meta HTTP-EQUIV=\"REFRESH\" content=\"0; url=admin.php?list=awards&m=3\">"); }
$sql = "INSERT INTO awards
(
award_user,
award_img,
award_desc
)
VALUES
(
'$user',
'$image',
'$desc'
)";
mysqli_query($conn,$sql) or die("<meta HTTP-EQUIV=\"REFRESH\" content=\"0; url=admin.php?list=awards&m=2\">");
?>
<?php die("<meta HTTP-EQUIV=\"REFRESH\" content=\"0; url=admin.php?list=awards&m=1\">"); ?>
<?php } else { ?>
<a href="?list=awards&do=add">Give New Award</a><br />
<hr />
<?php if ($_GET['m'] == "1"){ echo "<br /><div class='success'>Award successfully given.</div>"; }
elseif ($_GET['m'] == "2"){ echo "<br /><div class='error'>There was an SQL error while attempting to add the award.</div>"; }
elseif ($_GET['m'] == "3"){ echo "<br /><div class='error'>Fields were left blank, unable to process the query without disrupting current awards.</div>"; } ?>
<br />
<table id="forum">
<th>Award Image</th>
<th>Given to</th>
<th>Options</th>
<?php
// The below is calling data from the "data"base and listing it here in an array.
$result = mysqli_query($conn,"SELECT * FROM awards");
while($row = mysqli_fetch_array($result)) {
?>
<tr>
<td align="center"><img class="avatar" src="<?php echo "$row[award_img]"; ?>" border="0"></td>
<td align="center"><a href="index.php?page=profile&id=<?php echo "$row[award_user]"; ?>"><?php echo "$row[award_user]"; ?></a></td>
<td align="center"><a href="?list=awards&do=delete&id=<?php echo "$row[id]"; ?>"><img src="icons/delete.gif"></a></td>
</tr>
<?php } ?>
</table>
<!-- Developers Awards Mod End -->
<!-- --------------------------- -->
<?php } ?>
<?php } elseif ($_GET['news'] == "delete"){ ?>
<h3><img src="icons/news.gif" /> Deleting Article</h3>
<hr />
<?php mysqli_query($conn,"DELETE FROM tinybb_news WHERE news_id='$_GET[id]'") or die(mysqli_error()); ?>
Article deleted.
<?php } elseif ($_GET['news'] == "edit"){ ?>
<?php if ($_GET['do'] == "submit"){ ?>
<h3><img src="icons/news.gif" /> Article Saved</h3>
<hr />
<?php
$title = addslashes(htmlspecialchars($_POST[title]));
$content = addslashes(htmlspecialchars($_POST[content]));
$update = mysqli_query($conn,"UPDATE `tinybb_news` SET `news_content` = '$content', `news_title` = '$title' WHERE `news_id` = '$_POST[id]'");
echo "The article has been updated.";
?>
<?php } else { ?>
<?php
$sql2 = "SELECT * FROM tinybb_news WHERE news_id='$_GET[id]' LIMIT 1";
$tt = mysqli_query($conn,$sql2) or die (mysqli_error());
while($p=mysqli_fetch_assoc($tt)){ ?>
<h3><img src="icons/news.gif" /> Editing <?php echo "$p[news_title]"; ?></h3>
<hr />
<form action="?news=edit&do=submit" method="POST" name="compose">
<input type="hidden" name="id" value="<?php echo $_GET['id']; ?>" />
Article Title<br />
<input type="text" name="title" size="50" value="<?php echo "$p[news_title]"; ?>" /><br /><br />
Content<br />
<textarea cols=70 rows=5 maxlength='1000' name='content'><?php echo "$p[news_content]"; ?></textarea><br />
<img src="icons/smile2.png" onclick="insertit(document.compose.content, ':)');" />
<img src="icons/bigsmile.png" onclick="insertit(document.compose.content, ':D');" />
<img src="icons/frown.png" onclick="insertit(document.compose.content, ':(');" />
<img src="icons/wink.png" onclick="insertit(document.compose.content, ';)');" />
<img src="icons/blush.png" onclick="insertit(document.compose.content, ':$');" />
<img src="icons/skywalker.png" onclick="insertit(document.compose.content, ':sw:');" />
<img src="icons/yawn.png" onclick="insertit(document.compose.content, ':tired:');" />
<img src="icons/love.png" onclick="insertit(document.compose.content, '(L)');" />
<img src="icons/angry.png" onclick="insertit(document.compose.content, ':@');" />
<img src="icons/underline.png" onclick="insertit(document.compose.content, '[u][/u]');" />
<img src="icons/italic.png" onclick="insertit(document.compose.content, '[i][/i]');" />
<img src="icons/bold.png" onclick="insertit(document.compose.content, '[b][/b]');" />
<br /><br />
<input type="submit" value="Edit" />
</form>
<?php } } ?>
<?php } elseif ($_GET['news'] == "list"){ ?>
<h3><img src="icons/news.gif" /> List Articles</h3>
<hr />
<table id="forum">
<th>Title</th>
<th>Author</th>
<th>Options</th>
<?php
$sql2 = "SELECT * FROM tinybb_news ORDER BY news_id DESC";
$tt = mysqli_query($conn,$sql2) or die (mysqli_error());
while($p=mysqli_fetch_assoc($tt)){ ?>
<tr>