1 | <?php
|
---|
2 | $id = (int) $_GET['str1'];
|
---|
3 | $server_info = $db->query_fetch_assoc('SELECT * FROM `servers` where `id`='.$id);
|
---|
4 | if(($user['admin']==1) OR ($_SESSION['id']===$server_info['owner']))
|
---|
5 | {
|
---|
6 | if (isset($_POST['name']))
|
---|
7 | {
|
---|
8 | $check = check_edit_server($id);
|
---|
9 | if ($check['error'])
|
---|
10 | {
|
---|
11 | $tpl->output['error_blok'] ='block';
|
---|
12 | $tpl->output['success_blok'] ='none';
|
---|
13 | $tpl->output['error_msg'] = $text['add_server_'.$check['error_msg']];
|
---|
14 | }
|
---|
15 | else
|
---|
16 | {
|
---|
17 | $db->update('servers', array('name'=>$posted['name'], 'online_players_sum'=> $posted['sum'], 'xp'=>$posted['xp'], 'limit'=>$posted['limit'], 'port'=>$posted['port'], 'ip'=>$posted['ip'], 'web'=>$posted['web'], 'web_reg'=>$posted['web_reg'], 'type'=>$posted['type'], 'desc'=>$posted['desc'], 'place'=>$posted['place'], 'emu' => $posted['emu'], 'version'=>$posted['version'] ), '`id`='.$id);
|
---|
18 | $tpl->output['error_blok'] ='none';
|
---|
19 | $tpl->output['success_blok'] ='block';
|
---|
20 | $tpl->output['success_msg'] = 'Edited';
|
---|
21 | $server_info = $db->query_fetch_assoc('SELECT * FROM `servers` where `id`='.$id);
|
---|
22 | }
|
---|
23 |
|
---|
24 | }
|
---|
25 | else
|
---|
26 | {
|
---|
27 | $tpl->output['success_blok']= 'none';
|
---|
28 | $tpl->output['error_blok'] = 'none';
|
---|
29 | }
|
---|
30 |
|
---|
31 | $tpl->output['info_avarage_players'] = $text['info_avarage_players'];
|
---|
32 | $tpl->output['input_sum'] = $server_info['online_players_sum'];
|
---|
33 |
|
---|
34 |
|
---|
35 | $tpl->output['add_server_h2'] = $text['add_server_h2'];
|
---|
36 | $tpl->output['form_name_server'] = $text['reg_name_server'];
|
---|
37 | $tpl->output['form_type_server'] = $text['reg_type_server'];
|
---|
38 | $tpl->output['form_place_server'] = $text['reg_place_server'];
|
---|
39 | $tpl->output['form_web_page'] = $text['reg_web_page'];
|
---|
40 | $tpl->output['form_web_reg'] = $text['reg_web_reg'];
|
---|
41 | $tpl->output['form_desc'] = $text['reg_desc'];
|
---|
42 | $tpl->output['input_czech_server'] = $text['reg_czech'];
|
---|
43 | $tpl->output['input_abroad_server'] = $text['reg_abroad'];
|
---|
44 | $tpl->output['add_server_rules_h3'] = $text['add_server_rules_h3'];
|
---|
45 | $tpl->output['add_server_rules'] = $text['add_server_rules'];
|
---|
46 | $tpl->output['accept_rules'] = $text['reg_accept_rules'];
|
---|
47 |
|
---|
48 |
|
---|
49 | $tpl->output['server_name'] = $server_info['name'];
|
---|
50 | $tpl->output['input_name'] = $server_info['name'];
|
---|
51 | $tpl->output['input_emu'] = $server_info['emu'];
|
---|
52 | $tpl->output['input_version'] = $server_info['version'];
|
---|
53 |
|
---|
54 | switch ($server_info['type'])
|
---|
55 | {
|
---|
56 | case 'PvP': $tpl->output['select_pvp'] = 'SELECTED';
|
---|
57 | $tpl->output['select_rp'] = '';
|
---|
58 | $tpl->output['select_pvprp'] = '';
|
---|
59 | $tpl->output['select_rppvp'] = '';
|
---|
60 | break;
|
---|
61 | case 'RP': $tpl->output['select_pvp'] = '';
|
---|
62 | $tpl->output['select_rp'] = 'SELECTED';
|
---|
63 | $tpl->output['select_pvprp'] = '';
|
---|
64 | $tpl->output['select_rppvp'] = '';
|
---|
65 | break;
|
---|
66 | case 'RPPvP': $tpl->output['select_pvp'] = '';
|
---|
67 | $tpl->output['select_rp'] = '';
|
---|
68 | $tpl->output['select_pvprp'] = '';
|
---|
69 | $tpl->output['select_rppvp'] = 'SELECTED';
|
---|
70 | break;
|
---|
71 | case 'PvPRP': $tpl->output['select_pvp'] = '';
|
---|
72 | $tpl->output['select_rp'] = '';
|
---|
73 | $tpl->output['select_pvprp'] = 'SELECTED';
|
---|
74 | $tpl->output['select_rppvp'] = '';
|
---|
75 | break;
|
---|
76 | default: $tpl->output['select_pvp'] = 'SELECTED';
|
---|
77 | $tpl->output['select_rp'] = '';
|
---|
78 | $tpl->output['select_pvprp'] = '';
|
---|
79 | $tpl->output['select_rppvp'] = '';
|
---|
80 | break;
|
---|
81 |
|
---|
82 |
|
---|
83 | }
|
---|
84 | $tpl->output['input_limit'] = $server_info['limit'];
|
---|
85 | if (empty($server_info['web'])) $tpl->output['input_web'] = 'http://'; else $tpl->output['input_web'] = $server_info['web'];
|
---|
86 | if (empty($server_info['web_reg'])) $tpl->output['input_reg'] = 'http://'; else $tpl->output['input_reg'] = $server_info['web_reg'];
|
---|
87 | $tpl->output['input_desc'] = $server_info['desc'];
|
---|
88 | if (empty($server_info['ip'])) $tpl->output['ip'] = 'http://'; else $tpl->output['ip'] = $server_info['ip'];
|
---|
89 | $tpl->output['port'] = $server_info['port'];
|
---|
90 |
|
---|
91 |
|
---|
92 | switch ($server_info['xp'])
|
---|
93 | {
|
---|
94 | case 1: $tpl->output['xp1'] = 'SELECTED';
|
---|
95 | $tpl->output['xp2'] = '';
|
---|
96 | $tpl->output['xp3'] = '';
|
---|
97 | $tpl->output['xp4'] = '';
|
---|
98 | $tpl->output['xp5'] = '';
|
---|
99 | break;
|
---|
100 | case 2: $tpl->output['xp1'] = '';
|
---|
101 | $tpl->output['xp2'] = 'SELECTED';
|
---|
102 | $tpl->output['xp3'] = '';
|
---|
103 | $tpl->output['xp4'] = '';
|
---|
104 | $tpl->output['xp5'] = '';
|
---|
105 | break;
|
---|
106 | case 3: $tpl->output['xp1'] = '';
|
---|
107 | $tpl->output['xp2'] = '';
|
---|
108 | $tpl->output['xp3'] = 'SELECTED';
|
---|
109 | $tpl->output['xp4'] = '';
|
---|
110 | $tpl->output['xp5'] = '';
|
---|
111 | break;
|
---|
112 | case 4: $tpl->output['xp1'] = '';
|
---|
113 | $tpl->output['xp2'] = '';
|
---|
114 | $tpl->output['xp3'] = '';
|
---|
115 | $tpl->output['xp4'] = 'SELECTED';
|
---|
116 | $tpl->output['xp5'] = '';
|
---|
117 | break;
|
---|
118 | case 5: $tpl->output['xp1'] = '';
|
---|
119 | $tpl->output['xp2'] = '';
|
---|
120 | $tpl->output['xp3'] = '';
|
---|
121 | $tpl->output['xp4'] = '';
|
---|
122 | $tpl->output['xp5'] = 'SELECTED';
|
---|
123 | break;
|
---|
124 | default: $tpl->output['xp1'] = '';
|
---|
125 | $tpl->output['xp2'] = '';
|
---|
126 | $tpl->output['xp3'] = 'SELECTED';
|
---|
127 | $tpl->output['xp4'] = '';
|
---|
128 | $tpl->output['xp5'] = '';
|
---|
129 | break;
|
---|
130 | }
|
---|
131 |
|
---|
132 | if ($server_info['place']==2)
|
---|
133 | {
|
---|
134 | $tpl->output['place2'] = 'SELECTED';
|
---|
135 | $tpl->output['place1'] ='';
|
---|
136 | }
|
---|
137 | else
|
---|
138 | {
|
---|
139 | $tpl->output['place2'] = '';
|
---|
140 | $tpl->output['place1'] ='SELECTED';
|
---|
141 | }
|
---|
142 |
|
---|
143 | }
|
---|
144 | else
|
---|
145 | {
|
---|
146 | die('hacking atempt');
|
---|
147 | }
|
---|
148 | ?>
|
---|