-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
529 lines (339 loc) · 22.9 KB
/
index.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
<?php
// ___ ___ ___ ___ ___ __ _______ ________
// |" \ /" |" \/" | |" | /""\ | _ "\ /" )
// \ \ // / \ \ / || | / \ (. |_) :(: \___/
// \\ \/. ./ \\ \/ |: | /' /\ \ |: \/ \___ \
// \. // /\. \ \ |___ // __' \ (| _ \\ __/ \\
// \\ / / \ \ ( \_|: \ / / \\ \|: |_) :)/" \ :)
// \__/ |___/\___| \_______(___/ \___(_______/(_______/
//
// Unapproved use and redistribution of this code and respective product is strictly prohibited.
// Copyright© 2017 Keanu Ashwell all rights are reserved to the author, creator, registered
// and licensed owners of this product and it's content
if(session_id() != $_COOKIE['PHPSESSID'] || !$_COOKIE['PHPSESSID']) {
session_start();
}
// Generate random hash
//$HASH = bin2hex(random_bytes(32));
// Require
require_once('mysql.php');
?>
<html>
<head>
<link rel="stylesheet" href="css/index.css">
<link rel="stylesheet" href="css/globals.css">
<script src="javascript/script.js"></script>
<title>VX KotH</title>
</head>
<body>
<!-- Container -->
<div id="grid-container">
<!-- Header -->
<div id="grid-header">
<!-- Top Header -->
<div id="grid-header-top">
<!-- VX KOTH Container -->
<div id="grid-vxkoth-container">
<a href="index.php">
<h3 id="grid-vx">VX</h3>
<h3 id="grid-koth">KOTH</h3>
</a>
</div>
<?php
// If cookie exists and is set
if(isset($_COOKIE['USERNAME'])) {
// Query
$QUERY_ALL_USERS = mysqli_query($conn, "
SELECT
vx.accounts.id,
vx.accounts.username,
vx.accounts.ip
FROM vx.accounts
WHERE vx.accounts.username = '" . $_COOKIE['USERNAME'] . "';
");
// Fetch the results
$RESULT_ALL_USERS = mysqli_fetch_array($QUERY_ALL_USERS);
if($RESULT_ALL_USERS[0] == $_SESSION['USERID']) {
echo '
<div id="grid-account-options">
<p id="grid-myaccount" class="grid-account-managment"><a href="account.php">My Account</a></p>
<p id="grid-logout" class="grid-account-managment">Logout</p>
</div>
';
} else {
// No session userid set
// Check session userid and cookie set
if(!$_SESSION['USERID'] && $_COOKIE['USERNAME']) {
header('Location: index.php');
} else {
echo '
<div id="grid-account-options">
<p id="grid-register" class="grid-account-managment"><a href="register.php">Register</a></p>
</div>
';
}
}
} else {
// Cookie either doesnt exist or isnt set
echo '
<div id="grid-account-options">
<p id="grid-register" class="grid-account-managment"><a href="register.php">Register</a></p>
</div>
';
}
?>
</div>
<!-- News -->
<div id="grid-header-news">
<marquee>Latest News From VX</marquee>
</div>
<!-- Bottom Header -->
<div id="grid-header-bottom">
<?php
// If cookie exists and is set
if($_COOKIE['USERNAME']) {
// User exists
// Query
$QUERY_ALL_USERS = mysqli_query($conn, "
SELECT
vx.accounts.id,
vx.accounts.username,
vx.accounts.ip,
vx.accounts.admin,
vx.accounts.permissionArray
FROM vx.accounts
WHERE vx.accounts.username = '" . $_COOKIE['USERNAME'] . "';
");
// Fetch the results
$RESULT_ALL_USERS = mysqli_fetch_array($QUERY_ALL_USERS);
// User is an admin and ip matches as well as account id for extra security
if(
$RESULT_ALL_USERS[3] == 1
&& $RESULT_ALL_USERS[2] == $_SERVER['REMOTE_ADDR']
&& $_SESSION['USERID'] == $RESULT_ALL_USERS[0]
) {
echo '
<p class="grid-user-display">Logged in as: ' . $_COOKIE['USERNAME'] . ' <a href="admin.php">(Admin)</a></p>
';
} else {
// User is not an admin
// Check the user
if(
$RESULT_ALL_USERS[1] == $_COOKIE['USERNAME']
&& $_SESSION['USERID'] == $RESULT_ALL_USERS[0]
)
echo '
<p class="grid-user-display">Logged in as: ' . $_COOKIE['USERNAME'] . '</p>
';
}
} else {
// Cookie either doesnt exist or isnt set
}
?>
</div>
<?php
// Query
$QUERY_ALL_USERS = mysqli_query($conn, "
SELECT
vx.accounts.id,
vx.accounts.username,
vx.accounts.ip,
vx.accounts.salt
FROM vx.accounts
WHERE vx.accounts.username = '" . $_COOKIE['USERNAME'] . "';
");
// Fetch the results
$RESULT_ALL_USERS = mysqli_fetch_array($QUERY_ALL_USERS);
// Check post values are set
if(
isset($_COOKIE['USERNAME'])
&& isset($_COOKIE['319f4d26e3c536b5dd871bb2c52e3178'])
&& !isset($_SESSION['USERID'])
) {
// Query
$QUERY_SESSIONID = mysqli_query($conn, "
SELECT
vx.accounts.id
FROM vx.accounts
WHERE vx.accounts.username = '" . $_COOKIE['USERNAME'] . "'
AND vx.accounts.password = '" . str_replace($RESULT_ALL_USERS[3], " ", $_COOKIE['319f4d26e3c536b5dd871bb2c52e3178']) . "';
");
// Fetch the results
$RESULT_SESSIONID = mysqli_fetch_array($QUERY_SESSIONID);
// Set the session value
$_SESSION['USERID'] = $RESULT_SESSIONID[0];
}
if(
!isset($_COOKIE['USERNAME'])
|| $RESULT_ALL_USERS[0] != $_SESSION['USERID']
) {
echo '
<!-- Account Login -->
<div id="grid-account-login">
<form id="grid-form-login" method="post" action="index.php"></form>
<input id="grid-login-username" type="text" name="USERNAME" placeholder="Username" form="grid-form-login">
<input id="grid-login-password" type="password" name="PASSWORD" placeholder="Password" form="grid-form-login">
</div>
';
// Make sure post fields arent empty
if(!empty($_POST['USERNAME']) && !empty($_POST['PASSWORD'])) {
// Make sure both post fields are set
if(isset($_POST['USERNAME']) && isset($_POST['PASSWORD'])) {
// Query accounts
$QUERY_ALL_USERS = mysqli_query($conn, "
SELECT
vx.accounts.id,
vx.accounts.username,
vx.accounts.email,
vx.accounts.password,
vx.accounts.salt
FROM vx.accounts
");
// Fetch the results
$RESULT_ALL_USERS = mysqli_fetch_array($QUERY_ALL_USERS);
// Check account actually exists
if(
$RESULT_ALL_USERS[1] == $_POST['USERNAME']
|| $RESULT_ALL_USERS[2] == $_POST['USERNAME']
&& $RESULT_ALL_USERS[3] == md5($_POST['PASSWORD'])
) {
// Account exists
// Add salt to password
$PASSWORD = md5($_POST['PASSWORD']) . $RESULT_ALL_USERS[4];
// If post username was email
if($_POST['USERNAME'] == $RESULT_ALL_USERS[2]) {
// Set the cookie
setcookie("USERNAME", $RESULT_ALL_USERS[1], time() + (86400 * 30), "/");
// Set password cookie
setcookie(md5("PASSWORD"), $PASSWORD , time() + (86400 * 30), "/");
// Set session user id
$_SESSION['USERID'] = $RESULT_ALL_USERS[0];
} else if($RESULT_ALL_USERS[1] == $_POST['USERNAME']) {
// Set the cookie
setcookie("USERNAME", $RESULT_ALL_USERS[1], time() + (86400 * 30), "/");
// Set password cookie
setcookie(md5("PASSWORD"), $PASSWORD, time() + (86400 * 30), "/");
// Set session user id
$_SESSION['USERID'] = $RESULT_ALL_USERS[0];
}
// Redirect to make sure the cookie is loaded to the client
header('Location: index.php');
} else {
// Account doesnt exist
}
} else {
// Fields arent set
}
} else {
// Posts are empty
}
}
?>
</div>
<!-- Content -->
<div id="grid-content">
<!-- Headings -->
<h1 id="grid-welcome">Welcome</h1>
<h1 id="grid-heading-area1">Heading 1</h1>
<h1 id="grid-heading-area2">Heading 2</h1>
<!-- Paragraphs -->
<p id="grid-text-area1" class="grid-landing-text">First and foremost, Welcome to VX Gaming. This is our user player panel. This serves as the place where you can get all the information regarding to your time at VX Gaming. All your information that we've gathered over the course of your gaming time spent on VX servers whether it be VX Labs KotH, VX Labs Escape From Tanoa, VX Labs Escape From Altis or any other mission that we offer or provide. At VX we aim and we strive to bring you the best player and user experience we can. We do so by offering quality servers, quality staff assistance and overall just a quality user experience. </p>
<p id="grid-text-area2" class="grid-landing-text">Mauris semper velit eu mattis bibendum. Aenean eu est non neque lobortis tincidunt id eu odio. Donec interdum efficitur semper. Duis urna dui, condimentum sed accumsan nec, egestas id neque. Cras tincidunt dapibus faucibus. Etiam sit amet tellus a enim consequat interdum. Cras bibendum elit ante, vel luctus eros luctus a. Vestibulum felis elit, tempus non arcu nec, tempus dapibus est. Aenean vitae laoreet felis. Suspendisse euismod ut felis vel hendrerit. Etiam tristique libero eget pellentesque bibendum. Donec euismod vel sapien a blandit. Ut eleifend dolor eget lectus pretium elementum. Cras faucibus nulla ac dapibus cursus. Integer velit lorem, finibus ut pellentesque et, sollicitudin quis ante. Suspendisse vehicula neque vitae magna porttitor tincidunt. Cras justo nisi, cursus sit amet nisi vitae, vehicula blandit risus. Nullam finibus tincidunt odio, vel varius nisl. Phasellus pellentesque leo sed varius tempus. Ut eu lorem elit. Pellentesque ut nulla malesuada, dapibus lacus vel, mattis massa. In hac habitasse platea dictumst. Curabitur interdum elit nec tincidunt commodo. Cras dictum ligula vitae augue eleifend pellentesque. Morbi eu diam et felis suscipit efficitur in a massa.</p>
<p id="grid-text-area3" class="grid-landing-text">Quisque eu libero eget ligula interdum vestibulum sit amet ac tellus. Etiam fringilla laoreet augue, eu tincidunt est accumsan quis. Aliquam hendrerit lacus a augue euismod pretium. Proin ac nisl quis elit ornare vulputate ac elementum purus. Donec non dignissim orci. Praesent ultrices mauris risus, non porttitor dui convallis nec. Proin et eleifend nibh. Phasellus commodo pellentesque viverra. Donec ut nunc erat. Donec ipsum erat, sodales vel mi non, maximus consectetur magna. Aliquam ac leo ipsum. Nullam nec pellentesque ligula. Cras semper sollicitudin eros quis sagittis. Sed ultrices fermentum mattis. Curabitur quis pretium nibh. Curabitur auctor ultrices mauris. Nam fermentum faucibus nibh vel auctor. Curabitur suscipit venenatis eros. Phasellus interdum luctus augue eu congue. Praesent nec consectetur tortor. Integer convallis ut dui in volutpat. Aenean sed augue eu tellus fringilla egestas. Aliquam et purus et libero finibus accumsan. Integer urna sem, scelerisque ut hendrerit non, venenatis sed leo. Vivamus mi est, convallis sit amet lacus a, molestie ultrices mi. Donec malesuada lacinia ipsum id aliquet. Aenean consectetur sollicitudin mi, pellentesque pretium enim fermentum quis.</p>
</div>
<!-- Footer -->
<div id="grid-footer">
<!-- Logos and Association-->
<img id="grid-footer-vx-logo" src="img/VXLogo.png">
<img id="grid-footer-armahosts-logo" src="img/ArmaHosts.png">
<!-- General Information -->
<div id="grid-footer-information">
<!-- Headings -->
<h3 id="grid-footer-heading-general" class="grid-footer-headings">GENERAL</h3>
<h3 id="grid-footer-heading-misc" class="grid-footer-headings">MISC</h3>
<h3 id="grid-footer-heading-break" class="grid-footer-headings">LEGAL</h3>
<!-- General -->
<p id="grid-footer-general-home" class="grid-footer-links"><a href="index.php">Home</a></p>
<p id="grid-footer-general-player" class="grid-footer-links"><a href="player.php">Player Panel</a></p>
<!-- Legal -->
<p id="grid-footer-legal-contact" class="grid-footer-links"><a href="legal.php?part=Contact">Contact</a></p>
<p id="grid-footer-legal-copyright" class="grid-footer-links"><a href="legal.php?part=Copyright">Copyright</a></p>
<p id="grid-footer-legal-privacy" class="grid-footer-links"><a href="legal.php?part=Privacy">Privacy</a></p>
<!-- Misc -->
<p id="grid-footer-misc-vxgaming" class="grid-footer-links"><a href="https://www.vxkoth.com/">VX KOTH</a></p>
<p id="grid-footer-misc-faq" class="grid-footer-links"><a href="https://www.vxkoth.com/faqs">FAQ</a></p>
<p id="grid-footer-misc-sitrep" class="grid-footer-links"><a href="https://www.vxkoth.com/blog">Sitreps</a></p>
</div>
<!-- Social Media -->
<div id="grid-footer-media">
<img id="grid-footer-facebook-logo" class="grid-footer-logos" src="img/FacebookLogo.png">
<img id="grid-footer-twitter-logo" class="grid-footer-logos" src="img/TwitterLogo.png">
<img id="grid-footer-youtube-logo" class="grid-footer-logos" src="img/YoutubeLogo.png">
<img id="grid-footer-discord-logo" class="grid-footer-logos" src="img/DiscordLogo.png">
<p id="grid-footer-misc-disclaimer">This website is not affiliated or authorized by Bohemia Interactive. Bohemia Interactive, ARMA, DAYZ and all associated logos and designs are trademarks of Bohemia Interactive</p>
</div>
</div>
</div>
<?php
// Nightmode settings
// Check cookie value
if($_COOKIE['NIGHTMODE'] == 'true') {
echo '
<script>
// Set to nightmode
// Check container exists
if(document.getElementById("grid-container")) {
// Element exists
// Change background colour
document.getElementById("grid-container").style.backgroundColor = "#3e3e3e";
// Change heading colour
for(var i = 0; i < document.getElementsByTagName("h1").length; i++) {
document.getElementsByTagName("h1")[i].style.color = "#FFFFFF";
}
// Change text colour
for(var i = 0; i < document.getElementsByTagName("p").length; i++) {
document.getElementsByTagName("p")[i].style.color = "#FFFFFF";
}
// Check element exists
if(document.getElementById("grid-file-upload")) {
// Change file upload colour;
document.getElementById("grid-file-upload").style.color = "#FFFFFF";
}
// Set header colour incase it was changed
document.getElementsByClassName("grid-user-display")[0].style.color = "#FFFFFF";
document.getElementsByClassName("grid-account-managment")[1].style.color = "#FFFFFF";
}
</script>
';
} else if($_COOKIE['NIGHTMODE'] == 'false') {
echo '
<script>
// Set to nightmode
// Check container exists
if(document.getElementById("grid-container")) {
// Element exists
// Change background colour
document.getElementById("grid-container").style.backgroundColor = "#FFFFFF";
// Change heading colour
for(var i = 0; i < document.getElementsByTagName("h1").length; i++) {
document.getElementsByTagName("h1")[i].style.color = "#000000";
}
// Change text colour
for(var i = 0; i < document.getElementsByTagName("p").length; i++) {
document.getElementsByTagName("p")[i].style.color = "#000000";
}
// Check element exists
if(document.getElementById("grid-file-upload")) {
// Change file upload colour;
document.getElementById("grid-file-upload").style.color = "#000000";
}
// Set header colour incase it was changed
document.getElementsByClassName("grid-user-display")[0].style.color = "#FFFFFF";
document.getElementsByClassName("grid-account-managment")[1].style.color = "#FFFFFF";
}
</script>
';
}
?>
</body>
</html>