This repository has been archived by the owner on Jan 6, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtokenGenerationTool.php
701 lines (569 loc) · 20.9 KB
/
tokenGenerationTool.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
<?php
/*
RLPanel v2.0 | Coypright $CURRENT_YEAR, George Tsatsis.
RLPanel contains hardcoded locations and is specifically made to work with RLAPI and RLME's database ONLY. We will not provide support.
*/
/* Start the PHP Session */
session_start();
if($_POST['sessionaction'] == 'logout'){
session_destroy();
}
/* Is this a development environment? */
$testEnv = false; // Used to toggle test options on/off
/* Session Debugging */
if($testEnv == true){
$_SESSION['discordUserName'] = "Test";
$_SESSION['discordAvatar'] = "https://cdn.discordapp.com/avatars/367747734373007362/cd38202282ba4a7335d10ce2bb75ca99.png?size=128";
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="description" content="RATELIMITED Token Generation Panel" />
<meta name="author" content="" />
<meta content="The RATELIMITED User Dashboard allows for editing the meta tags of your images, managing your account on RATELIMITED and more!" property="og:description">
<meta content="RATELIMITED · Token Generation Panel" property="og:title">
<meta content="RATELIMITED Dashboard" property="og:site_name">
<link rel="icon" href="https://ratelimited.me/logo_dark.png" />
<meta content='https://ratelimited.me/logo_dark.png' property='og:image'>
<meta content='image/png' property='og:image:type'>
<meta content='1821' property='og:image:width'>
<meta content='2082' property='og:image:height'>
<meta name="theme-color" content="#2c3e50">
<link rel="icon" href="assets/images/favicon.ico">
<title>RLPanel | Token Generation Panel</title>
<link rel="stylesheet" href="assets/js/jquery-ui/css/no-theme/jquery-ui-1.10.3.custom.min.css">
<link rel="stylesheet" href="assets/css/font-icons/entypo/css/entypo.css">
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Noto+Sans:400,700,400italic">
<link rel="stylesheet" href="assets/css/bootstrap.css">
<link rel="stylesheet" href="assets/css/neon-core.css">
<link rel="stylesheet" href="assets/css/neon-theme.css">
<link rel="stylesheet" href="assets/css/neon-forms.css">
<link rel="stylesheet" href="assets/css/custom.css">
<script src="assets/js/jquery-1.11.3.min.js"></script>
<!--[if lt IE 9]><script src="assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<?php
/* Load up Composer */
require 'vendor/autoload.php';
if($_SERVER['HTTP_USER_AGENT'] == "Mozilla/5.0 (compatible; Discordbot/2.0; +https://discordapp.com)"){
die();
}
/* Force Authentication */
if(!isset($_SESSION['loggedInAs']) || empty($_SESSION['loggedInAs']) || !array_key_exists('loggedInAs', $_SESSION)){
require 'libs/discordAuth.inc.php';
}
/* Requirements */
require 'api/statsDetails.inc.php';
require 'libs/authLib.inc.php';
require 'api/getAllPendingSignups.inc.php';
include_once (dirname(__FILE__) . '/__AntiAdBlock.php');
if($userIsAdmin == false){
die('You won\'t stop, will ya?');
}
?>
<body class="page-body" data-url="http://neon.dev">
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-103855982-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-103855982-1');
</script>
<script>
function logoutFunc() {
$.ajax({
type: "POST",
url: 'https://panel.ratelimited.me/index.php',
data:{sessionaction:'logout'},
success:function(html) {
console.log(html);
window.location.href = 'https://panel.ratelimited.me';
}
});
}
</script>
<div class="page-container"><!-- add class "sidebar-collapsed" to close sidebar by default, "chat-visible" to make chat appear always -->
<div class="sidebar-menu">
<div class="sidebar-menu-inner">
<header class="logo-env">
<!-- logo -->
<div class="logo">
<a href="https://panel.ratelimited.me">
<img src="https://cdn.ratelimited.me/1a7ef8.png" width="120" alt="" />
</a>
</div>
<!-- logo collapse icon -->
<div class="sidebar-collapse">
<a href="#" class="sidebar-collapse-icon"><!-- add class "with-animation" if you want sidebar to have animation during expanding/collapsing transition -->
<i class="entypo-menu"></i>
</a>
</div>
<!-- open/close menu icon (do not remove if you want to enable menu on mobile devices) -->
<div class="sidebar-mobile-menu visible-xs">
<a href="#" class="with-animation"><!-- add class "with-animation" to support animation -->
<i class="entypo-menu"></i>
</a>
</div>
</header>
<ul id="main-menu" class="main-menu">
<!-- add class "multiple-expanded" to allow multiple submenus to open -->
<!-- class "auto-inherit-active-class" will automatically add "active" class for parent elements who are marked already with class "active" -->
<li class="has-sub">
<a href="index.html">
<i class="entypo-gauge"></i>
<span class="title">Dashboard</span>
</a>
<ul>
<li>
<a href="index.php">
<span class="title">User Dashboard</span>
</a>
</li>
<?php if($userIsAdmin == true){
echo "<li>
<a href=\"adminDash.php\">
<span class=\"title\">Admin Dashboard</span>
</a>
</li>";}?>
</ul>
</li>
<?php
if($userIsAdmin == true){echo "<li class=\"has-sub\">
<a href=\"forms-main.html\">
<i class=\"entypo-doc-text\"></i>
<span class=\"title\">Token Management Tools</span>
</a>
<ul>
<li>
<a href=\"https://panel.ratelimited.me/tokenGenerationTool.php\">
<span class=\"title\">Token Generator</span>
</a>
</li>
<li>
<a href=\"adminUsersList.php\">
<span class=\"title\">User Information</span>
</a>
</li>
</ul>
</li>";}?>
<li class="has-sub">
<a href="index.html">
<i class="entypo-user"></i>
<span class="title">My Account</span>
</a>
<ul>
<li>
<a href="resetToken.php">
<span class="title">Reset Token</span>
</a>
</li>
<li>
<a href="manageAccount.php">
<span class="title">Account Settings</span>
</a>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- Hey, George, This is where you should start work! -->
<div class="main-content">
<div class="row">
<!-- Profile Info and Notifications -->
<div class="col-md-6 col-sm-8 clearfix">
<ul class="user-info pull-left pull-none-xsm">
<!-- Profile Info -->
<li class="profile-info dropdown"><!-- add class "pull-right" if you want to place this from right -->
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<img src="<?php if(!empty($_SESSION['discordAvatar'])){echo $_SESSION['discordAvatar'];}else{echo "http://via.placeholder.com/120x120";} ?>" alt="" class="img-circle" width="44" />
<?php if(!empty($_SESSION['discordUserName'])){echo $_SESSION['discordUserName'];}else{echo "Error in username parsing.";} ?>
</a>
<ul class="dropdown-menu">
<!-- Reverse Caret -->
<li class="caret"></li>
<!-- Profile sub-links -->
<li>
<a href="#">
<i class="entypo-user"></i>
Edit Profile
</a>
</li>
<li>
<a href="#">
<i class="entypo-mail"></i>
Inbox
</a>
</li>
<li>
<a href="#">
<i class="entypo-calendar"></i>
Calendar
</a>
</li>
<li>
<a href="#">
<i class="entypo-clipboard"></i>
Tasks
</a>
</li>
</ul>
</li>
</ul>
<ul class="user-info pull-left pull-right-xs pull-none-xsm">
<!-- Raw Notifications -->
<li class="notifications dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" data-hover="dropdown" data-close-others="true">
<i class="entypo-attention"></i>
</a>
<ul class="dropdown-menu">
<li class="top">
<p class="small">
<a href="#" class="pull-right">Mark all Read</a>
You have <strong>no</strong> new notifications.
</p>
</li>
<li>
<ul class="dropdown-menu-list scroller">
<li class="unread notification-success">
<a href="#">
<i class="entypo-user-add pull-right"></i>
<span class="line">
<strong>You know this is still WIP, right?</strong>
</span>
<span class="line small">
30 seconds ago
</span>
</a>
</li>
</ul>
</li>
<li class="external">
<a href="#">View all notifications</a>
</li>
</ul>
</li>
<!-- Message Notifications -->
<li class="notifications dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" data-hover="dropdown" data-close-others="true">
<i class="entypo-mail"></i>
</a>
<ul class="dropdown-menu">
<li>
<form class="top-dropdown-search">
<div class="form-group">
<input type="text" class="form-control" placeholder="Search anything..." name="s" />
</div>
</form>
<ul class="dropdown-menu-list scroller">
<li class="active">
<a href="#">
<span class="image pull-right">
<img src="assets/images/[email protected]" width="44" alt="" class="img-circle" />
</span>
<span class="line">
<strong>George Tsatsis</strong>
- yesterday
</span>
<span class="line desc small">
Just stop looking in these, this is way too WIP for you to be looking!
</span>
</a>
</li>
</ul>
</li>
<li class="external">
<a href="#">All Messages</a>
</li>
</ul>
</li>
<!-- Task Notifications -->
<li class="notifications dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" data-hover="dropdown" data-close-others="true">
<i class="entypo-list"></i>
</a>
<ul class="dropdown-menu">
<li class="top">
<p>You have 0 pending tasks</p>
</li>
<li>
<ul class="dropdown-menu-list scroller">
<li>
<a href="#">
<span class="task">
<span class="desc">This is unhealthy for me, I should sleep :/</span>
<span class="percent">27%</span>
</span>
<span class="progress">
<span style="width: 27%;" class="progress-bar progress-bar-success">
<span class="sr-only">27% Complete</span>
</span>
</span>
</a>
</li>
</ul>
</li>
<li class="external">
<a href="#">See all tasks</a>
</li>
</ul>
</li>
</ul>
</div>
<!-- Raw Links -->
<div class="col-md-6 col-sm-4 clearfix hidden-xs">
<ul class="list-inline links-list pull-right">
<!-- Language Selector -->
<li class="dropdown language-selector">
Language:
<a href="#" class="dropdown-toggle" data-toggle="dropdown" data-close-others="true">
<img src="assets/images/flags/flag-uk.png" width="16" height="16" />
</a>
<ul class="dropdown-menu pull-right">
<li>
<a href="#">
<img src="assets/images/flags/flag-de.png" width="16" height="16" />
<span>Deutsch</span>
</a>
</li>
<li class="active">
<a href="#">
<img src="assets/images/flags/flag-uk.png" width="16" height="16" />
<span>English</span>
</a>
</li>
<li>
<a href="#">
<img src="assets/images/flags/flag-fr.png" width="16" height="16" />
<span>François</span>
</a>
</li>
<li>
<a href="#">
<img src="assets/images/flags/flag-al.png" width="16" height="16" />
<span>Shqip</span>
</a>
</li>
<li>
<a href="#">
<img src="assets/images/flags/flag-es.png" width="16" height="16" />
<span>Español</span>
</a>
</li>
</ul>
</li>
<li class="sep"></li>
<li>
<a href="#" onclick="logoutFunc();">
Log Out <i class="entypo-logout right"></i>
</a>
</li>
</ul>
</div>
</div>
<hr />
<script type="text/javascript">
jQuery(document).ready(function($)
{
<?php
if($testEnv == true){
echo"
// Sample Toastr Notification
setTimeout(function()
{
var opts = {
\"closeButton\": true,
\"debug\": false,
\"positionClass\": rtl() || public_vars.\$pageContainer.hasClass('right-sidebar') ? \"toast-top-left\" : \"toast-top-right\",
\"toastClass\": \"black\",
\"onclick\": null,
\"showDuration\": \"300\",
\"hideDuration\": \"1000\",
\"timeOut\": \"5000\",
\"extendedTimeOut\": \"1000\",
\"showEasing\": \"swing\",
\"hideEasing\": \"linear\",
\"showMethod\": \"fadeIn\",
\"hideMethod\": \"fadeOut\"
};
toastr.success(\"You have been awarded with 1 year free subscription. Enjoy it!\", \"Account Subcription Updated\", opts);
}, 3000);";}?>
});
</script>
<div class="row">
<div class="col-sm-3 col-xs-6">
<div class="tile-stats tile-red">
<div class="icon"><i class="entypo-users"></i></div>
<div class="num" data-start="0" data-end="<?=$getRegisteredUsersCount;?>" data-postfix="" data-duration="1500" data-delay="0">0</div>
<h3>Registered Users</h3>
<p>Total registrations (Approved)</p>
</div>
</div>
<div class="col-sm-3 col-xs-6">
<div class="tile-stats tile-green">
<div class="icon"><i class="entypo-upload"></i></div>
<div class="num" data-start="0" data-end="<?=$getTotalFilesUploadedCount;?>" data-postfix="" data-duration="1500" data-delay="600">0</div>
<h3>Total Files Uploaded</h3>
<p>Files uploaded since RLAPI was released. Does not include OwOAPI stats.</p>
</div>
</div>
<div class="clear visible-xs"></div>
<div class="col-sm-3 col-xs-6">
<div class="tile-stats tile-aqua">
<div class="icon"><i class="entypo-upload"></i></div>
<div class="num" data-start="0" data-end="<?=$filesTotalByUserRowCount;?>" data-postfix="" data-duration="1500" data-delay="1200">0</div>
<h3>Total Files Uploaded By You</h3>
<p>This is the total of files you have uploaded</p>
</div>
</div>
<div class="col-sm-3 col-xs-6">
<div class="tile-stats tile-blue">
<div class="icon"><i class="entypo-rss"></i></div>
<div class="num" data-start="0" data-end="<?= $getSignupsPendingCount ?>" data-postfix="" data-duration="1500" data-delay="1800">0</div>
<h3>Pending Signups</h3>
<p>on our site right now.</p>
</div>
</div>
</div>
<br />
<div class="row">
<div class="col-sm-12">
<script type="text/javascript">
jQuery( document ).ready( function( $ ) {
var $table1 = jQuery( '#table-1' );
// Initialize DataTable
$table1.DataTable( {
"aLengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]],
"bStateSave": true,
"ajax": {"url": "api/getAllPendingSignups.inc.php?q=GetAllPending"},
"columns": [
{ "data": "username"},
{ "data": "email"},
{ "data": "date"},
{ "data": "discordid"},
{ "tokenmgmt": "accepttoken", "render": function(data, type, row, username){
return '<td><form action=\"https://panel.ratelimited.me/api/tokengen.php\" class=\"accept-user\">\n<input type=\"hidden\" name=\"Action\" value=\"Accept\">\n<input type=\"hidden\" name=\"signupDiscordUsername\" value=\"' + row['username'] + '\">\n<input type=\"hidden\" name=\"signupDiscordEmail\" value=\"' + row['email'] + '\">\n<input type=\"hidden\" name=\"signupDiscordId\" value=\"' + row['discordid'] + '\">\n<button type=\"submit\" class=\"btn btn-green btn-icon icon-left\"">\n Accept\n <i class=\"entypo-check\"></i>\n </button></form></td>';
}},
{ "tokenmgmt": "denytoken", "render": function(data, type, row, username){
return '<td><form action=\"https://panel.ratelimited.me/api/tokengen.php\" class=\"deny-user\">\n<input type=\"hidden\" name=\"Action\" value=\"Deny\">\n<input type=\"hidden\" name=\"signupDiscordUsername\" value=\"' + row['username'] + '\">\n<input type=\"hidden\" name=\"signupDiscordEmail\" value=\"' + row['email'] + '\">\n<input type=\"hidden\" name=\"signupDiscordId\" value=\"' + row['discordid'] + '\">\n<button type=\"submit\" class=\"btn btn-red btn-icon icon-left\">\n Decline\n <i class=\"entypo-cancel\"></i>\n </button></form></td>';
}}
]
});
// Initalize Select Dropdown after DataTables is created
$table1.closest( '.dataTables_wrapper' ).find( 'select' ).select2( {
minimumResultsForSearch: -1
});
} );
</script>
</br>
<script type="text/javascript">
jQuery(document).submit(function(e){
var opts = {
"closeButton": true,
"debug": false,
"positionClass": rtl() || public_vars.$pageContainer.hasClass('right-sidebar') ? "toast-top-left" : "toast-top-right",
"toastClass": "black",
"onclick": null,
"showDuration": "300",
"hideDuration": "1000",
"timeOut": "5000",
"extendedTimeOut": "1000",
"showEasing": "swing",
"hideEasing": "linear",
"showMethod": "fadeIn",
"hideMethod": "fadeOut"
};
var form = jQuery(e.target);
e.preventDefault();
jQuery.ajax({
type: "POST",
url: form.attr("action"),
data: form.serialize(), // serializes the form's elements.
success: function(data) {
console.log(data); // show response from the php script. (use the developer toolbar console, firefox firebug or chrome inspector console)
refreshTable();
toastr.success(data, "Token Generation Status", opts);
}
});
});
</script>
<script type="text/javascript">
//var auto_refresh = setInterval(
// function ()
// {
// $('#table-1').load('tokenGenerationTool.php #table-1').fadeIn("slow");
// }, 10000); // refresh every 10000 milliseconds
function refreshTable(){
$('#table-1').DataTable().ajax.reload(null, false);
}
</script>
<table class="table table-bordered datatable" id="table-1">
<thead>
<tr>
<th>Username</th>
<th>E-Mail</th>
<th>Timestamp of request</th>
<th>Discord ID</th>
<th>Create Token</th>
<th>Deny Token</th>
</tr>
</thead>
<tbody>
</tbody>
<tfoot>
<tr>
<th>Username</th>
<th>E-Mail</th>
<th>Timestamp of request</th>
<th>Discord ID</th>
<th>Create Token</th>
<th>Deny Token</th>
</tr>
</tfoot>
</table>
</div>
<!-- Footer -->
<footer class="main">
© <?php echo date("Y"); ?> <strong>RATELIMITED</strong>
</footer>
<!-- Hey, George, This is where you should end work! -->
</div>
</div>
<!-- Imported styles on this page -->
<link rel="stylesheet" href="assets/js/datatables/datatables.css">
<link rel="stylesheet" href="assets/js/select2/select2-bootstrap.css">
<link rel="stylesheet" href="assets/js/select2/select2.css">
<!-- Bottom scripts (common) -->
<script src="assets/js/gsap/TweenMax.min.js"></script>
<script src="assets/js/jquery-ui/js/jquery-ui-1.10.3.minimal.min.js"></script>
<script src="assets/js/bootstrap.js"></script>
<script src="assets/js/joinable.js"></script>
<script src="assets/js/resizeable.js"></script>
<script src="assets/js/neon-api.js"></script>
<script src="assets/js/jvectormap/jquery-jvectormap-1.2.2.min.js"></script>
<!-- Imported scripts on this page -->
<script src="assets/js/jvectormap/jquery-jvectormap-europe-merc-en.js"></script>
<script src="assets/js/jquery.sparkline.min.js"></script>
<script src="assets/js/rickshaw/vendor/d3.v3.js"></script>
<script src="assets/js/rickshaw/rickshaw.min.js"></script>
<script src="assets/js/raphael-min.js"></script>
<script src="assets/js/morris.min.js"></script>
<script src="assets/js/toastr.js"></script>
<script src="assets/js/datatables/datatables.js"></script>
<script src="assets/js/select2/select2.min.js"></script>
<!-- JavaScripts initializations and stuff -->
<script src="assets/js/neon-custom.js"></script>
<!-- Demo Settings -->
<script src="assets/js/neon-demo.js"></script>
</body>
</html>