forked from Mo45/Rust-Server-Website-Template
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathincludes.php
More file actions
139 lines (134 loc) · 7.49 KB
/
Copy pathincludes.php
File metadata and controls
139 lines (134 loc) · 7.49 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
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
<?php
include_once 'config.php';
if(MODULE_SERVERS_V2 == "ON"){
//GET JSON STATUS FOR SERVER #1
$json_url = "https://rust-servers.net/api/?object=servers&element=detail&key=".SERVER_1_KEY."";
$json_string = file_get_contents($json_url);
$parsed_json = json_decode($json_string,true);
if(empty($parsed_json)){
$s1_name = "Server Offline";
$s1_status = "Offline";
$s1_button = "class='btn btn-outline-danger btn-lg disabled'><i class='fa fa-exclamation-circle' aria-hidden='true'></i> Offline</a> ";
$s1_connect_button = "<button type='button' class='btn btn-outline-danger btn-lg disabled'><i class='fa fa-exclamation-circle'></i> Offline</button>";
$s1_cur = "0"; $s1_max = "0";
$s1_img = "img/serverlogo_1024.webp";
}else{
$s1_name = $parsed_json['name'];
if($s1_name == "" OR empty($s1_name)){$s1_name = "Server Offline";};
$s1_status = $parsed_json['is_online'];
if($s1_status == "1"){$s1_status = "Online";
$s1_button = "class='btn btn-outline-success btn-lg'><i class='fa fa-play-circle' aria-hidden='true'></i> Connect</a> ";
$s1_connect_button = "<button data-bs-toggle='modal' data-bs-target='#ServerConnect1' type='button' class='btn btn-outline-success btn-lg'><i class='fab fa-steam-symbol'></i> Connect</button>";
}
else{$s1_status = "Offline";
$s1_button = "class='btn btn-outline-danger btn-lg disabled'><i class='fa fa-exclamation-circle' aria-hidden='true'></i> Offline</a> ";
$s1_connect_button = "<button type='button' class='btn btn-outline-danger btn-lg disabled'><i class='fa fa-exclamation-circle'></i> Offline</button>";
};
$s1_cur = $parsed_json['players'];
if($s1_cur == "" OR empty($s1_cur)){$s1_cur = "0";};
$s1_max = $parsed_json['maxplayers'];
if($s1_max == "" OR empty($s1_max)){$s1_max = "0";};
$s1_url = $parsed_json['url'];
if(MODULE_SERVERS_V2 == "ON"){$s1_img = "img/serverlogo_1024.webp";};//Remove PHP Notice in logs
if(MODULE_SERVERS_V2 == "OFF"){
$s1_img = $parsed_json['image'];
if ($s1_img == "" OR empty($s1_img)) {$s1_img = "img/serverlogo_1024.webp";};
if (getimagesize($s1_img) == false) {$s1_img = "img/serverlogo_1024.webp";};
};
$s1_ip = $parsed_json['address'];
$s1_port = $parsed_json['port'];
};
//GET JSON STATUS FOR SERVER #2
$json_url = "https://rust-servers.net/api/?object=servers&element=detail&key=".SERVER_2_KEY."";
$json_string = file_get_contents($json_url);
$parsed_json = json_decode($json_string,true);
if(empty($parsed_json)){
$s2_name = "Server Offline";
$s2_status = "Offline";
$s2_button = "class='btn btn-outline-danger btn-lg disabled'><i class='fa fa-exclamation-circle' aria-hidden='true'></i> Offline</a> ";
$s2_connect_button = "<button type='button' class='btn btn-outline-danger btn-lg disabled'><i class='fa fa-exclamation-circle'></i> Offline</button>";
$s2_cur = "0"; $s2_max = "0";
$s2_img = "img/serverlogo_1024.webp";
}else{
$s2_name = $parsed_json['name'];
if($s2_name == "" OR empty($s2_name)){$s2_name = "Server Offline";};
$s2_status = $parsed_json['is_online'];
if($s2_status == "1"){$s2_status = "Online";
$s2_button = "class='btn btn-outline-success btn-lg'><i class='fa fa-play-circle' aria-hidden='true'></i> Connect</a> ";
$s2_connect_button = "<button data-bs-toggle='modal' data-bs-target='#ServerConnect2' type='button' class='btn btn-outline-success btn-lg'><i class='fab fa-steam-symbol'></i> Connect</button>";
}
else{$s2_status = "Offline";
$s2_button = "class='btn btn-outline-danger btn-lg disabled'><i class='fa fa-exclamation-circle' aria-hidden='true'></i> Offline</a> ";
$s2_connect_button = "<button type='button' class='btn btn-outline-danger btn-lg disabled'><i class='fa fa-exclamation-circle'></i> Offline</button>";
};
$s2_cur = $parsed_json['players'];
if($s2_cur == "" OR empty($s2_cur)){$s2_cur = "0";};
$s2_max = $parsed_json['maxplayers'];
if($s2_max == "" OR empty($s2_max)){$s2_max = "0";};
$s2_url = $parsed_json['url'];
if(MODULE_SERVERS_V2 == "ON"){$s2_img = "img/serverlogo_1024.webp";};//Remove PHP Notice in logs
if(MODULE_SERVERS_V2 == "OFF"){
$s2_img = $parsed_json['image'];
if ($s2_img == "" OR empty($s2_img)) {$s2_img = "img/serverlogo_1024.webp";};
if (getimagesize($s2_img) == false) {$s2_img = "img/serverlogo_1024.webp";};
};
$s2_ip = $parsed_json['address'];
$s2_port = $parsed_json['port'];
};
//EXTRA SERVERS START
//EXTRA SERVERS END
};
if(MODULE_SERVERS == "ON"){
//GET JSON STATUS FOR SERVER #1
$json_url = "https://api.rust-servers.info/info/".SRV_ID_1."";
$json_string = file_get_contents($json_url);
$parsed_json = json_decode($json_string,true);
$s1_name = $parsed_json['hostname'];
$s1_status = $parsed_json['online_state'];
if($s1_status == "1"){$s1_status = "Online";$s1_button = "class='btn btn-outline-success btn-lg'><i class='fa fa-play-circle' aria-hidden='true'></i> Connect</a> ";}
else{$s1_status = "Offline";$s1_button = "class='btn btn-outline-danger btn-lg disabled'><i class='fa fa-exclamation-circle' aria-hidden='true'></i> Offline</a> ";};
$s1_cur = $parsed_json['players_cur'];
$s1_max = $parsed_json['players_max'];
$s1_img = $parsed_json['image'];
if ($s1_img == "") {$s1_img = "img/serverlogo.webp";};//Empty path fix
if (getimagesize($s1_img) == false) {$s1_img = "img/serverlogo.webp";};
$s1_ip = $parsed_json['ip'];
$s1_port = $parsed_json['port'];
//GET JSON STATUS FOR SERVER #2
$json_url = "https://api.rust-servers.info/info/".SRV_ID_2."";
$json_string = file_get_contents($json_url);
$parsed_json = json_decode($json_string,true);
$s2_name = $parsed_json['hostname'];
$s2_status = $parsed_json['online_state'];
if($s2_status == "1"){$s2_status = "Online";$s2_button = "class='btn btn-outline-success btn-lg'><i class='fa fa-play-circle' aria-hidden='true'></i> Connect</a>";}
else{$s2_status = "Offline";$s2_button = "class='btn btn-outline-danger btn-lg disabled'><i class='fa fa-exclamation-circle' aria-hidden='true'></i> Offline</a> ";};
$s2_cur = $parsed_json['players_cur'];
$s2_max = $parsed_json['players_max'];
$s2_img = $parsed_json['image'];
if ($s2_img == "") {$s2_img = "img/serverlogo.webp";};//Empty path fix
if (getimagesize($s2_img) == false) {$s2_img = "img/serverlogo.webp";};
$s2_ip = $parsed_json['ip'];
$s2_port = $parsed_json['port'];
//EXTRA SERVERS START
//EXTRA SERVERS END
};
if(MODULE_COMMUNITY == "ON"){
//STEAM GROUP
$url = "http://steamcommunity.com/gid/".STEAM_GID."/memberslistxml/";
$xml = simplexml_load_file($url);
$memberscount = (int) $xml->memberCount;
$memberscount = number_format( $memberscount );
$membersingame = (int) $xml->groupDetails->membersInGame;
$membersingame = number_format( $membersingame );
$membersonline = (int) $xml->groupDetails->membersOnline;
$membersonline = number_format( $membersonline );
};
if(MODULE_DISCORD == "ON"){
//DISCORD SERVER
$json_url = "https://discordapp.com/api/guilds/".DISCORD_SERVER_ID."/widget.json";
$json_string = file_get_contents($json_url);
$parsed_json = json_decode($json_string,true);
$discord_name = $parsed_json['name'];
$discord_members = $parsed_json['members'];
};
?>