This repository has been archived by the owner on Aug 10, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathseller.php
394 lines (367 loc) · 16.1 KB
/
seller.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
<?php
include_once 'inc/functions.php';
Functions::SecStart();
if(Functions::IsLoggedIn() && Functions::GetLoginLevel() >= 1) :
$totalclients = Functions::GetCurrentClientCount();
$totaltokens = Functions::GetTokenCount("1");
//db
$Pdo = Functions::GetDB();
// -------------------------------------------------------------------------------------
//last 10 clients
$last_ten_clients = "";
$tmp = 1;
$Stmt = $Pdo->query("SELECT * FROM `clients` ORDER BY `id` DESC LIMIT 5");
while($Result = $Stmt->fetch()){
//blacklist
$CCPUKey = '<span class="cpu'. (($Result['blacklisted'] == 1) ? 'bad' : 'good').'">'.$Result['cpukey'].'</span>';
//dev name
$CName = (($Result['developer'] == 1) ? '<span class="dev-name">'.$Result['name'].'</span>' : (($Result['lifetime'] == 1) ? '<span class="unlimited-access">'.$Result['name'].'</span>' : $Result['name']));
//formatted expire
$tmpdate = new DateTime();
$tmpdate->setTimestamp($Result['remaining']);
$tmpexpire = (($Result['lifetime'] == 1) ? "<span class='lifetime'>Unlimited Access</span>" : (($Result['remaining'] > time()) ? $tmpdate->format("M j, Y @ g:i a") : "<span class='expired'>Expired</span>"));
$last_ten_clients .= "<tr><td><font color='#3bafda'>".$tmp."</font></td><td><font color='#fff'>".$CName."</font></td><td><a href='editclient.php?id=".$Result['id']."'>".$CCPUKey."</a></td><td>".$tmpexpire."</td></tr>";
$tmp++;
}
// -------------------------------------------------------------------------------------
//last 10 tokens
$last_ten_tokens = "";
$tmp = 1;
$Stmt = $Pdo->query("SELECT * FROM `tokens` ORDER BY `id` DESC LIMIT 5");
while($Result = $Stmt->fetch()){
$tmpdate = new DateTime();
$tmpdate->setTimestamp($Result['generated_date']);
$TStatus = '<span class="token'.(($Result['redeemed'] == 1) ? 'used">Used' : 'good">Unused').'</span>';
$last_ten_tokens .= "<tr><td><font color='#3bafda'>".$tmp."</font></td><td><font color='#fff'>".$Result['generated_by']."</font></td><td><a href='edittoken.php?id=".$Result['id']."'><span class='tokenblue'>".$Result['token']."</span></a></td><td>".$Result['days']."</td><td>".$tmpdate->format("M j, Y @ g:i a")."</td><td>".$TStatus."</td></tr>";
$tmp++;
}
// -------------------------------------------------------------------------------------
//longest 10 kvs
$longest_ten_kvs = "";
$tmp = 1;
$Stmt = $Pdo->query("SELECT * FROM `clients` WHERE `kvstart` > 0 AND `kvstatus` = 2 ORDER BY `kvstart` ASC LIMIT 5");
while($Result = $Stmt->fetch()){
//blacklist
$CCPUKey = '<span class="cpu'. (($Result['blacklisted'] == 1) ? 'bad' : 'good').'">'.$Result['cpukey'].'</span>';
//dev name
$CName = (($Result['developer'] == 1) ? '<span class="dev-name">'.$Result['name'].'</span>' : (($Result['lifetime'] == 1) ? '<span class="unlimited-access">'.$Result['name'].'</span>' : $Result['name']));
//formatted start time
$tmpdate = new DateTime();
$tmpdate->setTimestamp($Result['kvstart']);
$tmpmonths = floor((time() - $Result['kvstart']) / 2592000);
$tmpdays = floor(((time() - $Result['kvstart']) % 2592000)/86400);
$longest_ten_kvs .= "<tr><td><font color='#3bafda'>".$tmp."</font></td><td><font color='#fff'>".$CName."</font></td><td><a href='editclient.php?id=".$Result['id']."'>".$CCPUKey."</a></td><td>".$Result['kvserial']."</td><td>".$tmpdate->format("M j, Y @ g:i a")."</td><td>".$tmpmonths." Months ".$tmpdays." Days</td></tr>";
$tmp++;
}
// -------------------------------------------------------------------------------------
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="TamperedLive Dashboard">
<meta name="author" content="HaXzz">
<link rel="shortcut icon" href="img/favicon.png">
<title>TamperedLive - Dashboard</title>
<link href="css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<link href="css/core.css" rel="stylesheet" type="text/css" />
<link href="css/components.css" rel="stylesheet" type="text/css" />
<link href="css/icons.css" rel="stylesheet" type="text/css" />
<link href="css/pages.css" rel="stylesheet" type="text/css" />
<link href="css/menu.css" rel="stylesheet" type="text/css" />
<link href="css/responsive.css" rel="stylesheet" type="text/css" />
<link href="css/jquery.circliful.css" rel="stylesheet" type="text/css" />
<link href="css/dashboard.css" rel="stylesheet" type="text/css" />
<link href="css/sweet-alert.css" rel="stylesheet" type="text/css" />
<link href="css/switchery.min.css" rel="stylesheet" type="text/css" />
<!-- HTML5 Shiv and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
<![endif]-->
<script src="js/modernizr.min.js"></script>
</head>
<body>
<!-- Navigation Bar-->
<header id="topnav">
<div class="topbar-main">
<div class="container">
<!-- Logo container-->
<div class="logo">
<a href="dashboard.php" class="logo"><i class="md md-equalizer"></i> <span>TamperedLive</span> </a>
</div>
<!-- End Logo container-->
<div class="menu-extras">
<ul class="nav navbar-nav navbar-right pull-right">
<li>
<form role="search" class="navbar-left app-search pull-left hidden-xs">
<input type="text" placeholder="Search..." class="form-control">
<a href=""><i class="fa fa-search"></i></a>
</form>
</li>
<li class="dropdown">
<a href="" class="dropdown-toggle waves-effect waves-light profile" data-toggle="dropdown" aria-expanded="true"><img src="<?php echo Functions::GetAvatar(); ?>" alt="user-img" class="img-circle"> </a>
<ul class="dropdown-menu">
<li><a href="editprofile.php"><i class="ti-user m-r-5"></i> Profile</a></li>
<li><a onclick="$('#logout').submit();" href="javascript:void(0)"><i class="ti-power-off m-r-5"></i> Logout</a></li>
<form id="logout" name="logout" action="inc/handler.php" method="POST"><input hidden name="func" value="logout"></form>
</ul>
</li>
</ul>
<div class="menu-item">
<!-- Mobile menu toggle-->
<a class="navbar-toggle">
<div class="lines">
<span></span>
<span></span>
<span></span>
</div>
</a>
<!-- End mobile menu toggle-->
</div>
</div>
</div>
</div>
<!-- End topbar -->
<!-- Navbar Start -->
<div class="navbar-custom">
<div class="container">
<div id="navigation">
<!-- Navigation Menu-->
<ul class="navigation-menu">
<li class="has-submenu active">
<a href="seller.php"><i class="md md-dashboard"></i>Dashboard</a>
</li>
<li class="has-submenu">
<a href="clients-seller.php"><i class="md md-account-child"></i>Clients</a>
</li>
<li class="has-submenu">
<a href="tokens-seller.php"><i class="md md-stars"></i>Tokens</a>
</li>
</ul>
<!-- End navigation menu -->
</div> <!-- end #navigation -->
</div> <!-- end container -->
</div> <!-- end navbar-custom -->
</header>
<!-- End Navigation Bar-->
<!-- =======================
===== START PAGE ======
======================= -->
<div class="wrapper">
<div class="container">
<!-- Page-Title -->
<div class="row">
<div class="col-sm-12">
<h4 class="page-title">Welcome <?php echo htmlentities($_SESSION['name']); ?>!</h4>
</div>
</div>
<!-- end Page-Title -->
<div class="row">
<div class="col-lg-4">
<div class="card-box">
<audio id="notify" hidden="true" src="mp3/noice.mp3"></audio>
<h4 class="m-t-0 m-b-20 header-title"><b>Chat</b></h4>
<div class="chat-conversation">
<ul class="conversation-list nicescroll" id="chatlog">
<li class="clearfix">
<div class="chat-avatar">
<img src="img/default-avatar.png" alt="Female">
<i>00:00</i>
</div>
<div class="conversation-text">
<div class="ctext-wrap">
<i>Server</i>
<p>
Connecting... Please wait!
</p>
</div>
</div>
</li>
</ul>
<div class="row">
<div class="col-sm-9 chat-inputbar">
<input type="text" id="chatInput" class="form-control chat-input" placeholder="Enter a message">
</div>
<div class="col-sm-3 chat-send">
<button onclick="AdminWrapper.sendChat();" class="btn btn-md btn-primary btn-block waves-effect waves-light">Send</button>
</div>
</div>
</div>
</div>
<div class="panel panel-border panel-purple">
<div class="panel-heading">
<h3 class="panel-title">Connected Clients</h3>
</div>
<div class="panel-body" id="connectedclients">
</div>
</div>
</div>
<div class="col-lg-8">
<div class="card-box">
<h4 class="text-dark header-title m-t-0">Last 5 Clients</h4>
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th>#</th>
<th>Name</th>
<th>CPUKey</th>
<th>Expire Time</th>
</tr>
</thead>
<tbody>
<?php echo $last_ten_clients; ?>
</tbody>
</table>
</div>
</div>
<div class="card-box">
<h4 class="text-dark header-title m-t-0">Last 5 Tokens</h4>
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th>#</th>
<th>Generated By</th>
<th>Token</th>
<th>Days</th>
<th>Date</th>
<th>Status</th>
</tr>
</thead>
<tbody>
<?php echo $last_ten_tokens; ?>
</tbody>
</table>
</div>
</div>
<div class="card-box">
<h4 class="text-dark header-title m-t-0">Longest Lasting KVs</h4>
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th>#</th>
<th>Name</th>
<th>CPUKey</th>
<th>KV Serial</th>
<th>Start Date</th>
<th>Elapsed</th>
</tr>
</thead>
<tbody>
<?php echo $longest_ten_kvs; ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<!-- end container -->
</div>
<!-- End wrapper -->
<!-- jQuery -->
<script src="js/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/detect.js"></script>
<script src="js/fastclick.js"></script>
<script src="js/jquery.blockUI.js"></script>
<script src="js/waves.js"></script>
<script src="js/wow.min.js"></script>
<script src="js/jquery.nicescroll.js"></script>
<script src="js/jquery.scrollTo.min.js"></script>
<script src="js/bootstrap-checkbox.js"></script>
<script src="js/highcharts.js"></script>
<script src="js/dark-unica.js"></script>
<script src="js/socket.io-1.4.5.js"></script>
<script src="js/switchery.min.js"></script>
<script src="js/sweet-alert.min.js"></script>
<!-- Counter Up -->
<script src="js/jquery.waypoints.min.js"></script>
<script src="js/jquery.counterup.min.js"></script>
<!-- circliful Chart -->
<script src="js/jquery.circliful.min.js"></script>
<script src="js/jquery.sparkline.min.js"></script>
<!-- Custom main Js -->
<script src="js/jquery.core.js"></script>
<script src="js/jquery.app.js"></script>
<script type="text/javascript">
var doOnce = true;
$(function(){
//enter key on chat input
$('#chatInput').keyup(function(e){
if(e.keyCode == 13) { $(this).trigger("enterKey"); }
});
$('#chatInput').bind("enterKey",function(e){
AdminWrapper.sendChat();
});
});
//admin wrapper
AdminWrapper={
socket: null,
name:"<?php echo htmlentities($_SESSION['name']); ?>",
init:function(){
AdminWrapper.socket = io.connect('<?php echo Functions::GetOption("socketio"); ?>', {secure: true});
AdminWrapper.socket.on('connect', function (data) {
AdminWrapper.socket.emit('credentials', {
name: AdminWrapper.name,
uid: "<?php echo htmlentities($_SESSION['id']); ?>",
param1: "<?php echo $_SERVER['HTTP_USER_AGENT']; ?>",
param2: "<?php echo htmlentities($_SESSION['data']); ?>"
});
//console.log("Connected to Listener")
});
AdminWrapper.socket.on('closepage', function () {
var win = window.open("about:blank", "_self");
win.close();
open('about:blank', '_self');
//console.log("hate");
});
AdminWrapper.socket.on('connectedclients', function(data){
//console.log(data);
var str = "";
for (var i = 0; i < data.clients.length; i++){
str += '<div class="card-box widget-user"><div><img src="'+data.clients[i].avatar+'" class="img-responsive img-circle" alt="user"><div class="wid-u-info"><h4 class="m-t-0 m-b-5">'+data.clients[i].name+'</h4><p class="text-muted m-b-5 font-13"> - IP Hidden - </p><small class="text-danger"><b>Admin</b></small></div></div></div>';
}
if(str.length < 1) str = "<h4>None</h4>";
$('#connectedclients').html(str);
});
AdminWrapper.socket.on('chat', function (data) {
//console.log(data);
var str = "";
for (var i = 0; i < data.msgArray.length; i++){
var mo = data.msgArray[i];
str += '<li class="clearfix' + ((mo.name != AdminWrapper.name) ? " odd" : "") + '">' +
'<div class="chat-avatar"><img src="'+mo.avatar+'" alt="'+mo.name+'"><i>'+mo.date+'</i></div>' +
'<div class="conversation-text"><div class="ctext-wrap"><i>'+mo.name+'</i><p>'+mo.message+'</p>' +
'</div></div></li>';
}
$("#chatlog").html(str);
$('#chatlog').scrollTop($('#chatlog')[0].scrollHeight);
if (!doOnce){
$('#notify').get(0).setAttribute('src', "mp3/noice.mp3");
$('#notify').get(0).load();
$('#notify').get(0).play();
}
doOnce = false;
});
},
sendChat:function(){
AdminWrapper.socket.emit('chat', {
msgarray: [],
message: $('#chatInput').val()
});
$('#chatInput').val('');
},
}
AdminWrapper.init();
</script>
</body>
</html>
<?php else :
header('Location: index.php');
endif; ?>