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