-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconsole.php
executable file
·88 lines (86 loc) · 3.63 KB
/
console.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
<?php
/*
* quick_console.php
*
* Copyright 2022 Jim Richardson <jim@noideersoftware.co.uk>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
*
*/
include 'inc/master.inc.php';
if (isset($_GET['server'])) {
// just load this server
$display_server = $_GET['server'];
$sql = "SELECT `host_name`,`server_name`,`url`,`bport`,`location`,`host`,`port` FROM server1 where `host_name` = '{$_GET['server']}' ";
$server = $database->get_row($sql);
//print_r($server);
//die();
$display_server = " - ".$server['server_name'];
}
$build = "3243-1919938056";
$version = "1.000";
$time = "1663578036";
$module = "Console";
$we_are_here = $settings['url'];
$tmp='';
$sidebar_data['servers'] = 'Game Servers';
$sidebar_data['base_servers'] = 'Base Servers';
$template = new template();
$template->load('templates/subtemplates/header.html');
$page['header'] = $template->get_template();
$template->load('templates/subtemplates/footer.html');
$page['footer'] = $template->get_template();
$template->load('templates/subtemplates/sidebar.html');
$template->replace_vars($sidebar_data);
$page['sidebar'] = $template->get_template();
$sql = "SELECT DISTINCT `host_name`,`server_name`,`url`,`bport`,`location`,`host`,`port` FROM server1 where `running` = 1 order by `host_name`";
$servers = $database->get_results($sql);
$sbox ='<option id ="" value="" path="" host ="">Choose Server</option>';
foreach ($servers as $server) {
//fill select box
$uri = parse_url($server['url']);
$url = $uri['scheme']."://".$uri['host'].':'.$server['bport'];
if (isset($uri['path'])) {$url .= $uri['path'];}
//echo "$url<br>";
//print_r($server);
$sbox .='<option id ="'.$server['host_name'].'" value="'.$url.'" path="'.$server['location'].'" host ="'.$server['host'].':'.$server['port'].'">'.$server['server_name'].'</option>';
//get_maps($server);
}
$page['sbox'] = $sbox;
//we need to fill the map select some how
$template->load('templates/subtemplates/user-frame.html');
$page['userframe'] = $template->get_template();
$template->load('templates/subtemplates/alert.html');
$page['alert'] = $template->get_template();
$template->load('templates/console.html');
$page['display_server'] =$display_server;
$template->replace_vars($page);
$template->publish();
function get_maps($server) {
// get the option list of maps
$file = $server['location'].'/'.$server['game'].'/cfg/mapcycle.txt'; // work out file we need a fall back
$map_list = explode(cr,file_get_contents($file)); // get the file & array it
$box = '<select class="form-control" style="width:227px;display:none;" id="map_change_'.$server['host_name.'].'" >'; // split the server id so the change fuction will work use server var
//now loop
foreach ($map_list as $map) {
// think ! add to box
}
$box .= '</select>';
//<option id="test" value="http://localhost:80/ajaxv2.5" path="/home/jim/games/bb2" host="81.132.54.204:27015">Brainbread II</option>
//</select>
}
?>