-
Notifications
You must be signed in to change notification settings - Fork 7
/
process.php
42 lines (35 loc) · 1.05 KB
/
process.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
<?php
include "main.php";
$br_skeniranja = $config['broj_skeniranja'];
if ($_POST['task']=="gtstatus") {
$ip = $restarter->ocistiIP($_POST['ip']);
$server = $restarter->skenirajServer($ip);
if (!$server) {
$return['status'] = "No server";
$return['players'] = "-";
$return['action'] = "hide";
} else {
$return['status'] = $server['status'];
if (!$return['status']) $return['players'] = "-";
else $return['players'] = $server['players']."/".$server['playersmax'];
$return['action'] = "display";
}
die(json_encode($return));
} else if ($_POST['task']=="restartServer") {
$serverid = (int)$_POST['serverid'];
$ip = $restarter->ocistiIP($_POST['ip']);
$temp = (int)$_POST['auth'];
$token = $config['tokens'][$temp];
$server = $restarter->skenirajServer($ip);
if (!$server || in_array($serverid, $config['ignorisi'])) {
$return['msg'] = "No server";
} else {
if ($server['status']) {
$return['msg'] = "Server online";
} else {
$return['msg'] = $restarter->restartujServer($serverid, $token);
}
}
die(json_encode($return));
}
?>