-
Notifications
You must be signed in to change notification settings - Fork 87
/
admin.php
1106 lines (896 loc) · 42.1 KB
/
admin.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
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
include("includes/core.php");
$content .= "<h1>Admin</h1>";
if($_SESSION['admin']){
$AdminSessionKey = $_SESSION['admin'];
$UserDB = $mysqli->query("SELECT * FROM faucet_settings WHERE id = '12' LIMIT 1")->fetch_assoc()['value'];
$PwDB = $mysqli->query("SELECT * FROM faucet_settings WHERE id = '13' LIMIT 1")->fetch_assoc()['value'];
$DatabaseAdminKey = "Admin_".$UserDB."_Password_".$PwDB;
if($AdminSessionKey != $DatabaseAdminKey){ unset($_SESSION['admin']); header("Location: admin.php"); die; }
// Addon list - Start
$directories = array_diff(scandir('addons'), array('..', '.'));
$addonList = array();
foreach($directories AS $directoryName){
if(file_exists("addons/".$directoryName."/__acp.php") == true AND file_exists("addons/".$directoryName."/__page.php") == true){
$addonList[] = $directoryName;
$btnContent .= "<a class='btn btn-default' href='?p=".$directoryName."'>".ucfirst($directoryName)." settings</a><br />";
}
}
define('ADDON_ACTIVE', 1);
// Addon list - End
switch($_GET['p']){
case(""):
default:
// Total Stats
$TotalClaims = $mysqli->query("SELECT COUNT(id) FROM faucet_transactions WHERE type = 'Payout'")->fetch_row()[0];
$TotalClaimed = $mysqli->query("SELECT SUM(amount) FROM faucet_transactions WHERE type = 'Payout'")->fetch_row()[0];
$TotalClaimed = $TotalClaimed ? $TotalClaimed : 0;
// 24 Hours stats
$Last24Hours = time() - 86400;
$Last24HoursClaims = $mysqli->query("SELECT COUNT(id) FROM faucet_transactions WHERE type = 'Payout' AND timestamp > '$Last24Hours'")->fetch_row()[0];
$Last24HoursClaimed = $mysqli->query("SELECT SUM(amount) FROM faucet_transactions WHERE type = 'Payout' AND timestamp > '$Last24Hours'")->fetch_row()[0];
$Last24HoursClaimed = $Last24HoursClaimed ? $Last24HoursClaimed : 0;
// Referral
$TotalReferralPayout = $mysqli->query("SELECT SUM(amount) FROM faucet_transactions WHERE type = 'Referral'")->fetch_row()[0];
$TotalReferralPayout = $TotalReferralPayout ? $TotalReferralPayout : 0;
$Last24HoursReferralPayout = $mysqli->query("SELECT SUM(amount) FROM faucet_transactions WHERE type = 'Referral' AND timestamp > '$Last24Hours'")->fetch_row()[0];
$Last24HoursReferralPayout = $Last24HoursReferralPayout ? $Last24HoursReferralPayout : 0;
$content .= "<h2>Stats</h2>
<div class='row'>
<div class='col-md-12'>
<h3>All time</h3>
</div>
<div class='col-md-4'>
<h4>Total Claims</h4>
<b>".$TotalClaims."</b>
</div>
<div class='col-md-4'>
<h4>Total Claimed</h4>
<b>".toSatoshi($TotalClaimed)."</b><br />{$faucetCurrencies[$websiteCurrency][1]}
</div>
<div class='col-md-4'>
<h4>Total Referral Payout</h4>
<b>".toSatoshi($TotalReferralPayout)."</b><br />{$faucetCurrencies[$websiteCurrency][1]}
</div>
<div class='col-md-12'>
<h3>Last 24 Hours</h3>
</div>
<div class='col-md-4'>
<h4>Claims</h4>
<b>".$Last24HoursClaims."</b>
</div>
<div class='col-md-4'>
<h4>Claimed</h4>
<b>".toSatoshi($Last24HoursClaimed)."</b><br />{$faucetCurrencies[$websiteCurrency][1]}
</div>
<div class='col-md-4'>
<h4>Referral Payout</h4>
<b>".toSatoshi($Last24HoursReferralPayout)."</b><br />{$faucetCurrencies[$websiteCurrency][1]}
</div>
</div><br /><h2>Configuration</h2>
<a class='btn btn-default' href='?p=as'>Standard settings</a><br />
<a class='btn btn-default' href='?p=wds'>Withdrawal settings</a><br />
<a class='btn btn-default' href='?p=ps'>Page settings</a><br />
<a class='btn btn-default' href='?p=ads'>Advertising settings</a><br />
<a class='btn btn-default' href='?p=adds'>Addon settings</a><br />
".$btnContent."
<hr />
<a class='btn btn-info' href='?p=bip'>Ban IPs</a><br />
<a class='btn btn-info' href='?p=bad'>Ban Address</a><br />";
break;
case("as"):
$content .= "<a href='admin.php'>Back</a><br>
<h3>Admin Settings</h3><h4>Change Admin login datas</h4>";
$Username = $mysqli->query("SELECT value FROM faucet_settings WHERE id = '12' LIMIT 1")->fetch_assoc()['value'];
if($_GET['c'] == 1){
if(isset($_POST['username']) AND isset($_POST['password'])){
if($_POST['username'] AND $_POST['password']){
$username = $mysqli->real_escape_string($_POST['username']);
$password = $mysqli->real_escape_string(hash("sha256", $_POST['password']));
$mysqli->query("UPDATE faucet_settings Set value = '$username' WHERE id = '12'");
$mysqli->query("UPDATE faucet_settings Set value = '$password' WHERE id = '13'");
$content .= alert("success", "Username and Password was changed successfully.");
} else if($_POST['username']){
$content .= alert("danger", "Please fill all forms.");
}
}
}
$content .= "<form method='post' action='?p=as&c=1'>
<div class='form-group'>
<label>Username</label>
<center><input class='form-control' type='text' name='username' style='width: 225px;' value='$Username' placeholder='Username ...'></center>
</div>
<div class='form-group'>
<label>Password</label>
<center><input class='form-control' type='password' name='password' style='width: 225px;' placeholder='Password ...'></center>
<span class='help-block'>Can't be shown because it's encoded.</span>
</div>
<button type='submit' class='btn btn-primary'>Change</button>
</form><br />";
$content .= "<h3>Faucet settings</h3><h4>Change Faucet name</h4>";
$Faucetname = $mysqli->query("SELECT value FROM faucet_settings WHERE id = '1' LIMIT 1")->fetch_assoc()['value'];
if($_GET['c'] == 2){
if(!$_POST['faucetname']){
$content .= alert("danger", "Faucetname can't be blank.");
} else {
$Faucetname = $mysqli->real_escape_string($_POST['faucetname']);
$mysqli->query("UPDATE faucet_settings Set value = '$Faucetname' WHERE id = '1'");
$content .= alert("success", "Faucetname was changed successfully.");
}
}
$content .= "<form method='post' action='?p=as&c=2'>
<div class='form-group'>
<label>Faucetname</label>
<center><input class='form-control' type='text' name='faucetname' style='width: 225px;' value='$Faucetname' placeholder='Faucetname ...'></center>
</div>
<button type='submit' class='btn btn-primary'>Change</button>
</form><br />";
$content .= "<h4>Change Currency</h4>";
if($_GET['c'] == 25){
if(!$_POST['faucetCurrency']){
$content .= alert("danger", "Please choose a faucet currenc.");
} else if(!in_array($_POST['faucetCurrency'], array_keys($faucetCurrencies))){
$content .= alert("danger", "Invalid Faucet Currency");
} else {
$faucetCurrency = $mysqli->real_escape_string($_POST['faucetCurrency']);
$mysqli->query("UPDATE faucet_settings Set value = '$faucetCurrency' WHERE name = 'faucet_currency'");
$content .= alert("success", "Faucet currency was changed successfully.");
}
}
$faucetCurrency = $mysqli->query("SELECT value FROM faucet_settings WHERE name = 'faucet_currency' LIMIT 1")->fetch_assoc()['value'];
$selectContent = "<select class='form-control' name='faucetCurrency' style='width: 225px;'>";
foreach(array_keys($faucetCurrencies) as $itFaucetCurrency) {
$selectContent .= "<option value='{$itFaucetCurrency}' ".($itFaucetCurrency == $faucetCurrency ? 'selected' : '').">{$itFaucetCurrency}</option>";
}
$selectContent .= "</select>";
$content .= "<form method='post' action='?p=as&c=25'>
<div class='form-group'>
<label>Faucet Currency</label>
<center>{$selectContent}</center>
</div>
<button type='submit' class='btn btn-primary'>Change</button>
</form><br />";
$content .= "<h4>Change Rewards</h4>";
$minReward = $mysqli->query("SELECT value FROM faucet_settings WHERE id = '6' LIMIT 1")->fetch_assoc()['value'];
$maxReward = $mysqli->query("SELECT value FROM faucet_settings WHERE id = '7' LIMIT 1")->fetch_assoc()['value'];
if($_GET['c'] == 3){
if(!$_POST['minreward'] OR !$_POST['maxreward']){
$content .= alert("danger", "Mininum and Maximum reward can't be blank.");
} else {
if(!is_numeric($_POST['minreward']) OR !is_numeric($_POST['maxreward'])){
$content .= alert("danger", "Reward must be numeric.");
} else {
$minreward5 = $mysqli->real_escape_string($_POST['minreward']);
$maxreward5 = $mysqli->real_escape_string($_POST['maxreward']);
$mysqli->query("UPDATE faucet_settings Set value = '$minreward5' WHERE id = '6'");
$mysqli->query("UPDATE faucet_settings Set value = '$maxreward5' WHERE id = '7'");
$content .= alert("success", "Rewards was changed successfully.");
$minReward = $minreward5;
$maxReward = $maxreward5;
}
}
}
$content .= "<form method='post' action='?p=as&c=3'>
<div class='form-group'>
<label>Mininum Reward (".$faucetCurrencies[$websiteCurrency][1].")</label>
<center><input class='form-control' type='number' name='minreward' style='width: 225px;' value='$minReward' placeholder='Mininum Reward'></center>
</div>
<div class='form-group'>
<label>Maximum Reward (".$faucetCurrencies[$websiteCurrency][1].")</label>
<center><input class='form-control' type='number' name='maxreward' style='width: 225px;' value='$maxReward' placeholder='Maximum Reward'></center>
</div>
<button type='submit' class='btn btn-primary'>Change</button>
</form><br />";
$content .= "<h4>Timer</h4>";
$timer = $mysqli->query("SELECT * FROM faucet_settings WHERE id = '5' LIMIT 1")->fetch_assoc()['value'];
if($_GET['c'] == 4){
if(!$_POST['timer']){
$content .= alert("danger", "Timer can't be blank.");
} else {
if(!is_numeric($_POST['timer'])){
$content .= alert("danger", "Timer must be numeric.");
} else {
$timer5 = $mysqli->real_escape_string($_POST['timer']);
$mysqli->query("UPDATE faucet_settings Set value = '$timer5' WHERE id = '5'");
$content .= alert("success", "Timer was changed successfully.");
}
}
}
$content .= "<form method='post' action='?p=as&c=4'>
<div class='form-group'>
<label>Timer (minutes)</label>
<center><input class='form-control' type='number' name='timer' style='width: 225px;' value='$timer' placeholder='Timer'></center>
</div>
<button type='submit' class='btn btn-primary'>Change</button>
</form><br />";
$content .= "<h4>Referral Program</h4>";
$referralPercent = $mysqli->query("SELECT * FROM faucet_settings WHERE id = '15' LIMIT 1")->fetch_assoc()['value'];
if($_GET['c'] == "r"){
if(!$_POST['referral']){
$content .= alert("danger", "Commission can't be blank.");
} else {
if(!is_numeric($_POST['referral'])){
$content .= alert("danger", "Commission must be numeric");
} else {
$referralPercent = $mysqli->real_escape_string($_POST['referral']);
$mysqli->query("UPDATE faucet_settings Set value = '$referralPercent' WHERE id = '15'");
$content .= alert("success", "Referral Program Commission was changed successfully.");
}
}
}
$content .= "<form method='post' action='?p=as&c=r'>
<div class='form-group'>
<label>Commission in %</label>
<center><input class='form-control' type='number' name='referral' style='width: 225px;' value='$referralPercent' placeholder='25'></center>
<span class='help-block'>Enter without percent. Example: 10<br />To disable Referral Program enter 0
</div>
<button type='submit' class='btn btn-primary'>Change</button>
</form><br />";
$content .= "<h3>Style Settings</h3><h4>Bootswatch</h4>";
$selectedTheme = $mysqli->query("SELECT value FROM faucet_settings WHERE id = '25' LIMIT 1")->fetch_assoc()['value'];
if($_GET['c'] == "st"){
if($_POST['selected_style']){
if($_POST['selected_style'] == "Default"){
$mysqli->query("UPDATE faucet_settings Set value = '' WHERE id = '25'");
$content .= alert("success", "Theme changed to Default.");
$selectedTheme = "";
} else {
$pSelectedStyle = $_POST['selected_style'];
if(in_array($pSelectedStyle, $bootsWatchStyles) == false){
$content .= alert("danger", "Invalid Bootswatch theme.");
} else {
$mysqli->query("UPDATE faucet_settings Set value = '$pSelectedStyle' WHERE id = '25'");
$content .= alert("success", "Theme changed to ".$pSelectedStyle.".");
$selectedTheme = $pSelectedStyle;
}
}
}
}
foreach ($bootsWatchStyles as $themeName) {
$optionsBootsWatch .= "<option ".(($themeName == $selectedTheme) ? 'selected' : '').">".$themeName."</option>";
}
$content .= "<form method='post' action='?p=as&c=st'>
<div class='form-group'>
<label class='control-label'>Bootswatch Theme</label>
<center>
<select style='width: 150px;' name='selected_style' class='form-control bootswatchInput'>
<option>Default</option>
".$optionsBootsWatch."
</select>
<span class='help-block demoBootsWatch'><a target='_blank' href='".(($selectedTheme != "Default") ? 'https://bootswatch.com/3/'.(strtolower($selectedTheme)).'/' : '#')."'>Demo</a></span>
<script>
$(document).ready(function(){
$('.bootswatchInput').change(function(){
var selectedTheme = $(this).val();
selectedTheme = selectedTheme.toLowerCase();
if(selectedTheme == 'default'){
$('.demoBootsWatch').html('<a target=\"_blank\" href=\"\">Demo</a>');
} else {
$('.demoBootsWatch').html('<a target=\"_blank\" href=\"https://bootswatch.com/3/' + selectedTheme + '/\">Demo</a>');
}
});
});
</script>
</center>
</div>
<button type='submit' class='btn btn-primary'>Change</button>
</form><br />";
$content .= "<h3>Keys settings</h3><h4>reCaptcha Keys</h4>";
$reCaptcha_privkey = $mysqli->query("SELECT * FROM faucet_settings WHERE id = '8' LIMIT 1")->fetch_assoc()['value'];
$reCaptcha_pubkey = $mysqli->query("SELECT * FROM faucet_settings WHERE id = '9' LIMIT 1")->fetch_assoc()['value'];
if($_GET['c'] == 6){
if(!$_POST['recaptcha_pubkey'] OR !$_POST['recaptcha_privkey']){
$content .= alert("danger", "reCaptcha Keys can't be blank.");
} else {
$reCaptcha_privkey5 = $mysqli->real_escape_string($_POST['recaptcha_privkey']);
$reCaptcha_pubkey5 = $mysqli->real_escape_string($_POST['recaptcha_pubkey']);
$mysqli->query("UPDATE faucet_settings Set value = '$reCaptcha_privkey5' WHERE id = '8'");
$mysqli->query("UPDATE faucet_settings Set value = '$reCaptcha_pubkey5' WHERE id = '9'");
$content .= alert("success", "reCaptcha Keys have been changed successfully.");
$reCaptcha_privkey = $mysqli->real_escape_string($_POST['recaptcha_privkey']);
$reCaptcha_pubkey = $mysqli->real_escape_string($_POST['recaptcha_pubkey']);
}
}
$content .= "<form method='post' action='?p=as&c=6'>
<div class='form-group'>
<label>reCaptcha Public Key</label>
<center><input class='form-control' type='text' value='".$reCaptcha_pubkey."' name='recaptcha_pubkey' style='width: 375px;' placeholder='reCaptcha Public Key'></center>
</div>
<div class='form-group'>
<label>reCaptcha Private Key</label>
<center><input class='form-control' type='text' value='".$reCaptcha_privkey."' name='recaptcha_privkey' style='width: 375px;' placeholder='reCaptcha Private Key'></center>
</div>
<button type='submit' class='btn btn-primary'>Change</button>
</form><br />";
$content .= "<h4>SolveMedia Keys</h4>";
$solvemedia_ckey = $mysqli->query("SELECT * FROM faucet_settings WHERE id = '2' LIMIT 1")->fetch_assoc()['value'];
$solvemedia_vkey = $mysqli->query("SELECT * FROM faucet_settings WHERE id = '3' LIMIT 1")->fetch_assoc()['value'];
$solvemedia_hkey = $mysqli->query("SELECT * FROM faucet_settings WHERE id = '4' LIMIT 1")->fetch_assoc()['value'];
if($_GET['c'] == 7){
if(!$_POST['solvemedia_ckey'] OR !$_POST['solvemedia_vkey'] OR !$_POST['solvemedia_hkey']){
$content .= alert("danger", "SolveMedia Keys can't be blank.");
} else {
$solvemedia_ckey = $mysqli->real_escape_string($_POST['solvemedia_ckey']);
$solvemedia_vkey = $mysqli->real_escape_string($_POST['solvemedia_vkey']);
$solvemedia_hkey = $mysqli->real_escape_string($_POST['solvemedia_hkey']);
$mysqli->query("UPDATE faucet_settings Set value = '$solvemedia_ckey' WHERE id = '2'");
$mysqli->query("UPDATE faucet_settings Set value = '$solvemedia_vkey' WHERE id = '3'");
$mysqli->query("UPDATE faucet_settings Set value = '$solvemedia_hkey' WHERE id = '4'");
$content .= alert("success", "SolveMedia Keys have been changed successfully.");
}
}
$content .= "<form method='post' action='?p=as&c=7'>
<div class='form-group'>
<label>SolveMedia Challenge Key (C-Key)</label>
<center><input class='form-control' type='text' value='".$solvemedia_ckey."' name='solvemedia_ckey' style='width: 375px;' placeholder='SolveMedia C-Key'></center>
</div>
<div class='form-group'>
<label>SolveMedia Verification Key (V-Key)</label>
<center><input class='form-control' type='text' value='".$solvemedia_vkey."' name='solvemedia_vkey' style='width: 375px;' placeholder='SolveMedia V-Key'></center>
</div>
<div class='form-group'>
<label>SolveMedia Authentication Hash Key (H-Key)</label>
<center><input class='form-control' type='text' value='".$solvemedia_hkey."' name='solvemedia_hkey' style='width: 375px;' placeholder='SolveMedia H-Key'></center>
</div>
<button type='submit' class='btn btn-primary'>Change</button>
</form><br />";
$content .= "<h4>hCaptcha Keys</h4>";
$hCaptchaPublic = $mysqli->query("SELECT * FROM faucet_settings WHERE name = 'hcaptcha_pub_key' LIMIT 1")->fetch_assoc()['value'];
$hCaptchaSecret = $mysqli->query("SELECT * FROM faucet_settings WHERE name = 'hcaptcha_sec_key' LIMIT 1")->fetch_assoc()['value'];
if($_GET['c'] == 8){
if(!$_POST['hcaptcha_pub_key'] OR !$_POST['hcaptcha_sec_key']){
$content .= alert("danger", "hCaptcha Keys Keys can't be blank.");
} else {
$hCaptchaPublic = $mysqli->real_escape_string($_POST['hcaptcha_pub_key']);
$hCaptchaSecret = $mysqli->real_escape_string($_POST['hcaptcha_sec_key']);
$mysqli->query("UPDATE faucet_settings Set value = '$hCaptchaPublic' WHERE name = 'hcaptcha_pub_key'");
$mysqli->query("UPDATE faucet_settings Set value = '$hCaptchaSecret' WHERE name = 'hcaptcha_sec_key'");
$content .= alert("success", "hCaptcha Keys have been changed successfully.");
}
}
$content .= "<form method='post' action='?p=as&c=8'>
<div class='form-group'>
<label>hCaptcha Public Key</label>
<center><input class='form-control' type='text' value='".$hCaptchaPublic."' name='hcaptcha_pub_key' style='width: 375px;' placeholder='hCaptcha Public Key'></center>
</div>
<div class='form-group'>
<label>hCaptcha Secret Key</label>
<center><input class='form-control' type='text' value='".$hCaptchaSecret."' name='hcaptcha_sec_key' style='width: 375px;' placeholder='hCaptcha Secret Key'></center>
</div>
<button type='submit' class='btn btn-primary'>Change</button>
</form><br />";
$content .= "<h3>Claim settings</h3><h4>Claim</h4>";
$claimStatus = $mysqli->query("SELECT * FROM faucet_settings WHERE id = '11' LIMIT 1")->fetch_assoc()['value'];
if($claimStatus == "yes"){
if($_GET['eb'] == "n"){
$mysqli->query("UPDATE faucet_settings Set value = 'no' WHERE id = '11'");
$content .= alert("success", "Claiming from Faucet is disabled.");
$content .= "<a href='?p=as&eb=y' class='btn btn-default'>Enable claim</a>";
} else {
$content .= "<a href='?p=as&eb=n' class='btn btn-default'>Disable claim</a>";
}
} else if($claimStatus == "no"){
if($_GET['eb'] == "y"){
$mysqli->query("UPDATE faucet_settings Set value = 'yes' WHERE id = '11'");
$content .= alert("success", "Claiming from Faucet is enabled.");
$content .= "<a href='?p=as&eb=n' class='btn btn-default'>Disable claim</a>";
} else {
$content .= "<a href='?p=as&eb=y' class='btn btn-default'>Enable claim</a>";
}
}
$content .= "<br /><br /><h4>VPN/Proxy</h4>
<p>Enable or disable claiming from faucet using VPN or Proxy</p>";
$shieldStatus = $mysqli->query("SELECT * FROM faucet_settings WHERE id = '14' LIMIT 1")->fetch_assoc()['value'];
$iphubApiKey = $mysqli->query("SELECT * FROM faucet_settings WHERE id = '22' LIMIT 1")->fetch_assoc()['value'];
if($shieldStatus == "yes"){
if($_GET['sp'] == "n"){
$mysqli->query("UPDATE faucet_settings Set value = 'no' WHERE id = '14'");
$content .= alert("success", "VPN/Proxy Shield is disabled.");
$content .= "<a href='?p=as&sp=y' class='btn btn-default'>Enable Shield</a>";
} else {
$content .= "<a href='?p=as&sp=n' class='btn btn-default'>Disable Shield</a>";
}
} else if($shieldStatus == "no"){
if($_GET['sp'] == "y"){
if(!$iphubApiKey){
$content .= alert("warning", "Please enter firstly the IPHub API Key below.");
} else {
$mysqli->query("UPDATE faucet_settings Set value = 'yes' WHERE id = '14'");
$content .= alert("success", "VPN/Proxy Shield is enabled.");
$content .= "<a href='?p=as&sp=n' class='btn btn-default'>Disable Shield</a>";
}
} else {
$content .= "<a href='?p=as&sp=y' class='btn btn-default'>Enable Shield</a>";
}
}
if($_GET['c'] == 9){
if(isset($_POST['iphub_apikey'])){
$iphubApiKey = $mysqli->real_escape_string($_POST['iphub_apikey']);
$mysqli->query("UPDATE faucet_settings Set value = '$iphubApiKey' WHERE id = '22'");
$content .= alert("success", "The API has been changed successfully.");
}
}
$content .= "<br /><p>The VPN/Proxy shield requires an API Key of IPHub.info.</p><br /><form method='post' action='?p=as&c=9'>
<div class='form-group'>
<label>IPHub API Key</label>
<center><input class='form-control' type='text' value='".$iphubApiKey."' name='iphub_apikey' style='width: 375px;' placeholder='IPHub API Key'></center>
</div>
<button type='submit' class='btn btn-primary'>Change</button>
</form><br />";
// Reverse proxy
$content .= "<h4>Reverse Proxy</h4>
<p>If you have CloudFlare enabled, you need to activate this feature</p>";
$reverseProxyStatus = $mysqli->query("SELECT * FROM faucet_settings WHERE id = '16' LIMIT 1")->fetch_assoc()['value'];
if($reverseProxyStatus == "yes"){
if($_GET['rvp'] == "n"){
$mysqli->query("UPDATE faucet_settings Set value = 'no' WHERE id = '16'");
$content .= alert("success", "Reverse Proxy is disabled.");
$content .= "<a href='?p=as&rvp=y' class='btn btn-default'>Enable Reverse Proxy Feature</a>";
} else {
$content .= "<a href='?p=as&rvp=n' class='btn btn-default'>Disable Reverse Proxy Feature</a>";
}
} else if($reverseProxyStatus == "no"){
if($_GET['rvp'] == "y"){
$mysqli->query("UPDATE faucet_settings Set value = 'yes' WHERE id = '16'");
$content .= alert("success", "Reverse Proxy is enabled.");
$content .= "<a href='?p=as&rvp=n' class='btn btn-default'>Disable Reverse Proxy Feature</a>";
} else {
$content .= "<a href='?p=as&rvp=y' class='btn btn-default'>Enable Reverse Proxy Feature</a>";
}
}
break;
case("ps"):
$content .= "<a href='admin.php'>Back</a><br><h3>Page settings</h3><h4>Create new Page</h4>";
if($_GET['cr'] == "y"){
if(!$_POST['name']){
$content .= alert("danger", "Pagename can't be blank.");
} else {
$name = $mysqli->real_escape_string($_POST['name']);
$timestamp = time();
$mysqli->query("INSERT INTO faucet_pages (name, content, timestamp_created) VALUES ('$name', '', '$timestamp')");
$content .= alert("success", "Page was successfully created.");
}
}
$content .= "<form method='post' action='?p=ps&cr=y'>
<div class='form-group'>
<label>Name</label>
<center><input type='text' name='name' style='width:225px;' class='form-control' placeholder='Name ...'></center>
</div>
<button type='submit' class='btn btn-primary'>Add Page</button>
</form><br /><h4>Change Pages</h4>";
$content .= "<script type='text/javascript'>
$('#myTabs a').click(function (e) {
e.preventDefault()
$(this).tab('show')
});
</script>";
if(isset($_GET['ch'])){
if(!$_GET['ch'] OR !is_numeric($_GET['ch']) OR !$_POST['content']){
$content .= alert("danger", "Please fill all forms.");
} else {
$pageContent = $mysqli->real_escape_string($_POST['content']);
$pageID = $mysqli->real_escape_string($_GET['ch']);
$mysqli->query("UPDATE faucet_pages Set content = '$pageContent' WHERE id = '$pageID'");
$content .= alert("success", "Content was changed successfully.");
}
}
if(isset($_GET['del'])){
if(!$_GET['del'] OR !is_numeric($_GET['del'])){
$content .= alert("danger", "Please fill all forms.");
} else {
$delid = $mysqli->real_escape_string($_GET['del']);
$mysqli->query("DELETE FROM faucet_pages WHERE id = '$delid'");
$content .= alert("success", "Page was deleted successfully.");
}
}
$Navtabs = "";
$PageNameTabs = $mysqli->query("SELECT id, name FROM faucet_pages");
while($Tab = $PageNameTabs->fetch_assoc()){
$Navtabs .= "<li role=\"presentation\"><a href=\"#pn".$Tab['id']."\" aria-controls=\"pn".$Tab['id']."\" role=\"tab\" data-toggle=\"tab\">".$Tab['name']."</a></li>";
}
$PageConf = "";
$PageConf1 = $mysqli->query("SELECT id, name, content FROM faucet_pages");
while($PageConf2 = $PageConf1->fetch_assoc()){
$PageConf .= "<div role=\"tabpanel\" class=\"tab-pane\" id=\"pn".$PageConf2['id']."\">
<form method='post' action='?p=ps&ch=".$PageConf2['id']."'>
<textarea class='form-control' cols='65' rows='10' name='content'>".$PageConf2['content']."</textarea><br />
<button type='submit' class='btn btn-success btn-lg'>Change</button>
</form><br />
<hr />
<a href='?p=ps&del=".$PageConf2['id']."' class='btn btn-danger'>Delete Page</a>
</div>";
}
$content .= "
<div>
<!-- Nav tabs -->
<ul class=\"nav nav-tabs\" role=\"tablist\">
$Navtabs
</ul><br />
<!-- Tab panes -->
<div class=\"tab-content\">
$PageConf
</div>
</div>";
break;
case("wds"):
$content .= "<a href='admin.php'>Back</a><br>
<h3>Withdrawal settings</h3><br /><p><strong>Note:</strong> If you leave the fields blank for a particular withdrawal method, then that option won't appear on the Account page.</p><br />
<script type='text/javascript'>
$('#myTabs a').click(function (e) {
e.preventDefault()
$(this).tab('show')
});
</script>";
$faucetpayApiToken = $mysqli->query("SELECT value FROM faucet_settings WHERE id = '19'")->fetch_assoc()['value'];
$blockioApiKey = $mysqli->query("SELECT value FROM faucet_settings WHERE id = '20'")->fetch_assoc()['value'];
$blockioPin = $mysqli->query("SELECT value FROM faucet_settings WHERE id = '21'")->fetch_assoc()['value'];
if($_POST['withdrawal_method']){
if($_POST['withdrawal_method'] == 1){
if($_POST['api_key'] != $faucetpayApiToken){
$faucetpayApiToken = $mysqli->real_escape_string($_POST['api_key']);
$mysqli->query("UPDATE faucet_settings Set value = '$faucetpayApiToken' WHERE id = '19'");
$alertForm .= alert("success", "FaucetPay API Key has been changed.");
}
} else if($_POST['withdrawal_method'] == 2){
if($_POST['api_key'] != $blockioApiKey){
$blockioApiKey = $mysqli->real_escape_string($_POST['api_key']);
$mysqli->query("UPDATE faucet_settings Set value = '$blockioApiKey' WHERE id = '20'");
$alertForm .= alert("success", "Block.io API Key has been changed.");
}
if($_POST['pin'] != $blockioPin){
$blockioPin = $mysqli->real_escape_string($_POST['pin']);
$mysqli->query("UPDATE faucet_settings Set value = '$blockioPin' WHERE id = '21'");
$alertForm .= alert("success", "Block.io PIN has been changed.");
}
}
}
$thresholdGateway = $mysqli->query("SELECT value FROM faucet_settings WHERE id = '23'")->fetch_assoc()['value'];
$thresholdDirect = $mysqli->query("SELECT value FROM faucet_settings WHERE id = '24'")->fetch_assoc()['value'];
if($_POST['threshold_gateway']){
if($_POST['threshold_gateway'] != $thresholdGateway OR $_POST['threshold_direct'] != $thresholdDirect){
$pThreSholdGateway = $mysqli->real_escape_string($_POST['threshold_gateway']);
$pThreSholdDirect = $mysqli->real_escape_string($_POST['threshold_direct']);
if(!is_numeric($pThreSholdGateway) OR !is_numeric($pThreSholdDirect)){
$alertFormThreshold = alert("danger", "Please enter numeric values.");
} else {
$mysqli->query("UPDATE faucet_settings Set value = '$pThreSholdGateway' WHERE id = '23'");
$mysqli->query("UPDATE faucet_settings Set value = '$pThreSholdDirect' WHERE id = '24'");
$alertFormThreshold = alert("success", "Withdrawal threshold saved.");
$thresholdGateway = $pThreSholdGateway;
$thresholdDirect = $pThreSholdDirect;
}
}
}
$content .= $alertForm."
<div>
<!-- Nav tabs -->
<ul class=\"nav nav-tabs\" role=\"tablist\">
<li role=\"presentation\"><a href=\"#faucetpaytab\" aria-controls=\"faucetpaytab\" role=\"tab\" data-toggle=\"tab\">FaucetPay</a></li>
<li role=\"presentation\"><a href=\"#blockiotab\" aria-controls=\"blockiotab\" role=\"tab\" data-toggle=\"tab\">Block.io</a></li>
</ul><br />
<!-- Tab panes -->
<div class=\"tab-content\">
<div role=\"tabpanel\" class=\"tab-pane\" id=\"faucetpaytab\">
<form method='post' class='form-horizontal' action='?p=wds'>
<div class='form-group'>
<label class='col-md-3 control-label'>API Key</label>
<div class='col-md-8'>
<input type='text' class='form-control' name='api_key' value='".$faucetpayApiToken."' placeholder='API Key ...' />
</div>
</div><br />
<p>You can generate an API Key at <a href='https://faucetpay.io/' target='_blank'>Faucetpay.io</a>.</p><br />
<input type='hidden' name='withdrawal_method' value='1' />
<button type='submit' class='btn btn-success'>Save</button>
</form>
</div>
<div role=\"tabpanel\" class=\"tab-pane\" id=\"blockiotab\">
<form method='post' class='form-horizontal' action='?p=wds'>
<div class='form-group'>
<label class='col-md-3 control-label'>API Key</label>
<div class='col-md-8'>
<input type='text' class='form-control' name='api_key' value='".$blockioApiKey."' placeholder='API Key ...' />
</div>
</div><br />
<div class='form-group'>
<label class='col-md-3 control-label'>PIN</label>
<div class='col-md-8'>
<input type='text' class='form-control' name='pin' value='".$blockioPin."' placeholder='PIN ...' />
</div>
</div><br />
<p>You can generate an API Key at <a href='https://block.io/' target='_blank'>Block.io</a>.</p><br />
<input type='hidden' name='withdrawal_method' value='2' />
<button type='submit' class='btn btn-success'>Save</button>
</form>
</div><br /><br />
<h4>Withdrawal Thresholds</h4><br />
".$alertFormThreshold."<br />
<form method='post' class='form-horizontal' action='?p=wds'>
<div class='form-group'>
<label class='col-md-5 control-label'>Withdrawal Threshold (Payment Provider)</label>
<div class='col-md-6'>
<input type='number' class='form-control' name='threshold_gateway' value='".$thresholdGateway."' placeholder='...' />
<span class='help-block'>Withdrawal thresholds for payments over ExpressCrypto and FaucetPay</span>
</div>
</div><br />
<div class='form-group'>
<label class='col-md-5 control-label'>Withdrawal Threshold (Direct)</label>
<div class='col-md-6'>
<input type='number' class='form-control' name='threshold_direct' value='".$thresholdDirect."' placeholder='...' />
<span class='help-block'>Withdrawal thresholds for direct payments using Block.io</span>
</div>
</div><br />
<button type='submit' class='btn btn-success'>Save</button><br /><br />
<span class='help-block'>Above values refer to the smallest unit (Satoshi, Litoshi, Gwei, etc...)</span>
</form>
</div>
</div>";
break;
case("ads"):
$content .= "<a href='admin.php'>Back</a><br>
<h3>Advertising settings</h3>";
$content .= "<h3>Space top</h4>";
$Spacetop = $mysqli->query("SELECT space FROM faucet_spaces WHERE id = '1' LIMIT 1")->fetch_assoc()['space'];
if($_GET['c'] == 1){
if(!isset($_POST['spacetop'])){
$content .= alert("danger", "Error.");
} else {
$Spacetop = $mysqli->real_escape_string($_POST['spacetop']);
$mysqli->query("UPDATE faucet_spaces Set space = '$Spacetop' WHERE id = '1'");
$content .= alert("success", "HTML Code 'Space top' changed successfully. Change will take in effect on reload.");
$Spacetop = $_POST['spacetop'];
}
}
$content .= "<form method='post' action='?p=ads&c=1'>
<textarea class='form-control' cols='65' rows='10' name='spacetop'>".$Spacetop."</textarea><br />
<button type='submit' class='btn btn-success btn-lg'>Change</button>
</form><br />";
$content .= "<h3>Space left</h4>";
$Spaceleft = $mysqli->query("SELECT space FROM faucet_spaces WHERE id = '2' LIMIT 1")->fetch_assoc()['space'];
if($_GET['c'] == 2){
if(!isset($_POST['spaceleft'])){
$content .= alert("danger", "Error.");
} else {
$Spaceleft = $mysqli->real_escape_string($_POST['spaceleft']);
$mysqli->query("UPDATE faucet_spaces Set space = '$Spaceleft' WHERE id = '2'");
$content .= alert("success", "HTML Code 'Space left' changed successfully. Change will take in effect on reload.");
$Spaceleft = $_POST['spaceleft'];
}
}
$content .= "<form method='post' action='?p=ads&c=2'>
<textarea class='form-control' cols='65' rows='10' name='spaceleft'>".$Spaceleft."</textarea><br />
<button type='submit' class='btn btn-success btn-lg'>Change</button>
</form><br />";
$content .= "<h3>Space right</h4>";
$Spaceright = $mysqli->query("SELECT space FROM faucet_spaces WHERE id = '3' LIMIT 1")->fetch_assoc()['space'];
if($_GET['c'] == 3){
if(!isset($_POST['spaceright'])){
$content .= alert("danger", "Error.");
} else {
$Spaceright = $mysqli->real_escape_string($_POST['spaceright']);
$mysqli->query("UPDATE faucet_spaces Set space = '$Spaceright' WHERE id = '3'");
$content .= alert("success", "HTML Code 'Space right' changed successfully. Change will take in effect on reload.");
$Spaceright = $_POST['spaceright'];
}
}
$content .= "<form method='post' action='?p=ads&c=3'>
<textarea class='form-control' cols='65' rows='10' name='spaceright'>".$Spaceright."</textarea><br />
<button type='submit' class='btn btn-success btn-lg'>Change</button>
</form><br />";
break;
case("bip"):
$content .= "<a href='admin.php'>Back</a><br>
<h3>Admin Settings</h3><h4>Ban IPs</h4>
<p>Bots that drains your faucet is always hard to refuse.<br />
With this feature you can ban IPs like known bots or VPN.</p><br />
<h3>Add IPs to ban</h3>
<p>Please enter for each line a IP address.</p>";
if($_GET['c'] == 1){
if(!$_POST['ips']){
$content .= alert("danger", "Can't find IP Address.");
} else {
$ips = explode("\r\n", $_POST['ips']);
foreach($ips as $banips) {
$banips2 = $mysqli->real_escape_string($banips);
$mysqli->query("INSERT INTO faucet_banned_ip (ip_address) VALUES ('$banips2')");
}
$content .= alert("success", "IP address added to the blacklist.");
}
}
$content .= "<form method='post' action='?p=bip&c=1'>
<textarea class='form-control' cols='65' rows='10' name='ips'></textarea><br />
<button type='submit' class='btn btn-success btn-lg'>Add to the blacklist</button>
</form><br />";
$content .= "<h3>Show banned IPs/Remove IPs</h3>";
if($_GET['delip']){
$Ipid = $mysqli->real_escape_string($_GET['delip']);
$Ip = $mysqli->query("SELECT * FROM faucet_banned_ip WHERE id = '$Ipid'");
if($Ip->num_rows == 1){
$mysqli->query("DELETE FROM faucet_banned_ip WHERE id = '$Ipid'");
$content .= alert("success", "IP Address was removed from banlist.");
$scroll = true;
} else {
$content .= alert("danger", "The IP Address/ID can't be found in the banlist.");
$scroll = true;
}
}
$headTable = "<table class='table' style='text-align: left; width: 100%;' cellpadding='2' cellspacing='2'>
<thead>
<tr>
<td>#</td>
<td>IP Address</td>
<td>Actions</td>
</tr>
</thead>";
$bodyTable = "<tbody>";
$BannedIPs = $mysqli->query("SELECT * FROM faucet_banned_ip");
while($ShowBIP = $BannedIPs->fetch_assoc()){
$bodyTable .= "<tr>
<td>".$ShowBIP['id']."</td>
<td>".$ShowBIP['ip_address']."</td>
<td><a href='?p=bip&delip=".$ShowBIP['id']."'>Delete</a></td>
</tr>";
}
$footerTable = "</tbody></table>";
$Table = $headTable.$bodyTable.$footerTable;
$content .= "<div id='banlist'>
$Table
</div>";
if($scroll){
$content .= "<script type='text/javascript'>document.getElementById('banlist').scrollIntoView();</script>";
}
break;
case("bad"):
$content .= "<a href='admin.php'>Back</a><br>
<h3>Admin Settings</h3><h4>Ban Address</h4>
<p>Bots that drains your faucet is always hard to refuse.<br />
With this feature you can ban Address.</p><br />
<h3>Add Address to ban</h3>
<p>Please enter for each line a Bitcoin Address or EC-UserID.</p>";
if($_GET['c'] == 1){
if(!$_POST['addy']){
$content .= alert("danger", "Can't find Bitcoin Address or EC-UserID.");
} else {
$addy = explode("\r\n", $_POST['addy']);
foreach($addy as $addy2) {
$banaddy = $mysqli->real_escape_string($addy2);
$mysqli->query("INSERT INTO faucet_banned_address (address) VALUES ('$banaddy')");
}
$content .= alert("success", "Bitcoin Address added to the blacklist.");
}
}
$content .= "<form method='post' action='?p=bad&c=1'>
<textarea class='form-control' cols='65' rows='10' name='addy'></textarea><br />
<button type='submit' class='btn btn-success btn-lg'>Add to the blacklist</button>
</form><br />";
$content .= "<h3>Show banned Address/Remove Address</h3>";
if($_GET['deladdy']){
$Addyid = $mysqli->real_escape_string($_GET['deladdy']);
$Addy = $mysqli->query("SELECT * FROM faucet_banned_address WHERE id = '$Addyid'");
if($Ip->num_rows == 1){
$mysqli->query("DELETE FROM faucet_banned_address WHERE id = '$Addyid'");
$content .= alert("success", "Bitcoin Address was removed from banlist.");
$scroll = true;
} else {
$content .= alert("danger", "The Bitcoin Address/EC-UserID can't be found in the banlist.");
$scroll = true;
}
}
$headTable = "<table class='table' style='text-align: left; width: 100%;' cellpadding='2' cellspacing='2'>
<thead>
<tr>
<td>#</td>
<td>Bitcoin Address/EC-ID</td>
<td>Actions</td>
</tr>
</thead>";
$bodyTable = "<tbody>";
$BannedAddy = $mysqli->query("SELECT * FROM faucet_banned_address");
while($ShowBAD = $BannedAddy->fetch_assoc()){
$bodyTable .= "<tr>
<td>".$ShowBAD['id']."</td>
<td>".$ShowBAD['address']."</td>
<td><a href='?p=bad&deladdy=".$ShowBAD['id']."'>Delete</a></td>
</tr>";
}
$footerTable = "</tbody></table>";
$Table = $headTable.$bodyTable.$footerTable;
$content .= "<div id='banlist'>
$Table
</div>";
if($scroll){
$content .= "<script type='text/javascript'>document.getElementById('banlist').scrollIntoView();</script>";
}
break;
case("adds"):
$content .= "<a href='admin.php'>Back</a><br>
<h3>Addon Settings</h3>
<p>Enable or disable installed Addons below. Disabled addons will disappear for the users.</p>";
if(isset($_GET['sw'])){
$pSWID = $mysqli->real_escape_string($_GET['sw']);
$checkAddon = $mysqli->query("SELECT * FROM faucet_addon_list WHERE id = '$pSWID'");
if($checkAddon->num_rows == 1){