forked from devryan/GamePanelX-V3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathservers.php
129 lines (112 loc) · 4.71 KB
/
servers.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
<?php
require('checkallowed.php'); // Check logged-in
?>
<div class="page_title">
<div class="page_title_icon"><img src="images/icons/medium/servers.png" border="0" /></div>
<div class="page_title_text"><?php echo $lang['servers']; ?></div>
</div>
<div class="box">
<div class="box_title" id="box_servers_title"><?php echo $lang['servers']; ?></div>
<div class="box_content" id="box_servers_content">
<table border="0" cellpadding="0" cellspacing="0" align="center" width="900" id="srv_table" class="box_table" style="text-align:left;">
<tr>
<td width="25"> </td>
<td width="300"><b><?php echo $lang['game']; ?></b></td>
<td width="240"><b><?php echo $lang['username']; ?></b></td>
<td width="200"><b><?php echo $lang['network']; ?></b></td>
<td width="260"><b><?php echo $lang['desc']; ?></b></td>
<td width="150"><b><?php echo $lang['status']; ?></b></td>
<td width="80"><b><?php echo $lang['manage']; ?></b></td>
</tr>
<?php
// Game or voice or all
$url_type = $GPXIN['t'];
if($url_type == 'g') $sql_where = "AND d.type = 'game'";
elseif($url_type == 'v') $sql_where = "AND d.type = 'voice'";
else $sql_where = '';
// List servers
$result_srv = @mysql_query("SELECT
s.id,
s.userid,
s.port,
s.status,
s.description,
d.intname,
d.gameq_name,
d.name,
n.ip,
u.username
FROM servers AS s
LEFT JOIN default_games AS d ON
s.defid = d.id
LEFT JOIN network AS n ON
s.netid = n.id
LEFT JOIN users AS u ON
s.userid = u.id
WHERE
s.userid = '$gpx_userid'
$sql_where
ORDER BY
s.id DESC,
n.ip ASC
LIMIT 30") or die($lang['err_query'].' ('.mysql_error().')');
$json_arr = array();
$count_json = 0;
while($row_srv = mysql_fetch_array($result_srv))
{
$srv_id = $row_srv['id'];
$srv_userid = $row_srv['userid'];
$srv_ip = $row_srv['ip'];
$srv_port = $row_srv['port'];
$srv_status = $row_srv['status'];
$srv_description = $row_srv['description'];
$srv_def_name = $row_srv['name'];
$srv_def_intname = $row_srv['intname'];
$srv_gameq_name = $row_srv['gameq_name'];
$srv_username = $row_srv['username'];
// Add to JSON arry (only if complete)
if($srv_status == 'complete')
{
if($srv_id) $json_arr[$count_json]['id'] = $srv_id;
if($srv_ip && $srv_port) $json_arr[$count_json]['host'] = $srv_ip . ':' . $srv_port;
if($srv_gameq_name) $json_arr[$count_json]['type'] = $srv_gameq_name;
}
// Use correct status; if complete, show online/offline
if($srv_status == 'installing')
{
$srv_status = '<font color="blue">'.$lang['installing'].' ...</font>';
}
elseif($srv_status == 'failed')
{
$srv_status = '<font color="red">'.$lang['failed'].'!</font>';
}
elseif($srv_status == 'none')
{
$srv_status = '<font color="orange">'.$lang['unknown'].'</font>';
}
echo '<tr id="srv_' . $srv_id . '" style="cursor:pointer;" onClick="javascript:server_tab_info(' . $srv_id . ');">
<td><img src="images/gameicons/small/' . $srv_def_intname . '.png" width="20" height="20" border="0" /></td>
<td>' . $srv_def_name . '</td>
<td>' . $srv_username . '</td>
<td>' . $srv_ip . ':' . $srv_port . '</td>
<td style="font-size:10pt;">' . $srv_description . '</td>
<td id="statustd_' . $srv_id . '">'.$srv_status;
echo '</td>
<td class="links">'.$lang['manage'].'</td>
</tr>';
$count_json++;
}
$json_str = json_encode($json_arr);
?>
<tr id="srv_table_ld_tr">
<td colspan="7" align="left" id="srv_table_ld_td"> </td>
</tr>
</table>
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){
setTimeout("multi_query()", 200);
});
</script>
<input type='hidden' id='json_hid' value='<?php echo $json_str; ?>' />