-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathcore.php
More file actions
executable file
·70 lines (68 loc) · 3.01 KB
/
core.php
File metadata and controls
executable file
·70 lines (68 loc) · 3.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
use UserObject\User;
define("BASEPATH", 1);
include __DIR__ . "/vendor/autoload.php";
include_once __DIR__ . '/system/config.php';
include_once __DIR__ . '/inc/functions.php';
include_once __DIR__ . '/classes/User.php';
include_once __DIR__ . '/classes/MinSide.php';
include_once __DIR__ . '/classes/BBcodes.php';
include_once __DIR__ . '/classes/mainclass.php';
if (isset($_SERVER['X-Requested-With'])) {
if ($_SERVER['X-Requested-With'] == "XMLHttpRequest") {
define("JSON", 1);
} else {
define("JSON", 0);
}
} else {
define("JSON", 0);
}
if (isset($_SESSION['sessionzar'])) {
include __DIR__ . "/inc/database.php";
$m = explode(" ", microtime());
$start = $m[0] + $m[1];
[$user, $pass, $sss] = $_SESSION['sessionzar'];
$ip = (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) ? $_SERVER['HTTP_X_FORWARDED_FOR'] . $_SERVER['REMOTE_ADDR']
: $_SERVER['REMOTE_ADDR'];
# $st1 = $db->prepare("SELECT id,user,pass,ip,forceout,lastactive, health, status, image, exp, bank, hand, points, city, family, bullets, weapon, support, profile FROM `users` WHERE `user` = ? AND `pass` = ?");
$st1 = $db->prepare("SELECT * FROM `users` WHERE `user` = ? AND `pass` = ?");
$st1->execute([$user, $pass]);
$obj = $st1->fetchObject(User::class);
if (!$obj) {
header("Location: " . WWWPATH . "/logout.php?g=4");
die('<a href="' . WWWPATH . '/logout.php">Det kan se ut som du har blitt logget ut, det er noen andre som har logget på din bruker.</a>');
} else {
$stored_queries = [
"online" => 0,
"jail" => 0
];
if ($obj->ip != $ip) {
header("Location: " . WWWPATH . "/logout.php?g=7¤tip=$ip&dbip={$obj->ip}");
echo '<h1>It seems you\'ve been logged in on another network. Click here to go to the login page: <a href="' . WWWPATH . 'logout.php">Frontpage</a></h1>';
die();
}
liv_check();
ipbanned($ip);
if ($obj->forceout == 1) {
$db->query("UPDATE `users` SET `forceout` = '0' WHERE `id` = '{$obj->id}'");
die('<a href="' . WWWPATH . '/logout.php?g=6">You\'ve been logged out by administration. Please log back in again to continue playing.</a>');
}
if (($obj->lastactive + $timeout) < time()) {
header("Location: " . WWWPATH . "/logout.php?g=5");
} elseif (($obj->lastactive + $timeout) > time()) {
if (defined("NOUPDATE") && NOUPDATE == 1) {
} else {
$st2 = $db->prepare("UPDATE `users` SET `lastactive` = UNIX_TIMESTAMP() WHERE `id` = ?");
if (!$st2->execute([$obj->id])) {
if ($obj->status == 1) {
die("<p>Couldn't set info to DB. <br>" . var_export($st2->errorInfo(), true) . "</p>");
} else {
die("<p>There's been a script error</p>");
}
}
}
}
}
} else {
header("Location: " . WWWPATH . "/logout.php?g=1");
}