This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | require("config/carNames.php"); |
||
4 | require_once("config/images.php"); |
||
5 | |||
6 | |||
7 | $db_link = serverConnect(); |
||
8 | |||
9 | if (isset($_POST["editType"])) { |
||
10 | if ($_SESSION['permissions']['edit']['vehicles']) { |
||
11 | if (formtoken::validateToken($_POST)) { |
||
12 | switch ($_POST["editType"]) { |
||
13 | case "veh_inv": |
||
14 | $vehInv = $_POST["vehInv"]; |
||
15 | $sql = "UPDATE `vehicles` SET `inventory`='" . $vehInv . "' WHERE `vehicles`.`id` = '" . $vehID . "'"; |
||
16 | $result_of_query = $db_link->query($sql); |
||
17 | message($lang['vehicle'] . ' ' . $lang['edited']); |
||
18 | $sql = "SELECT `pid`,`classname` FROM `vehicles` WHERE `id` ='" . $vehID . "';"; |
||
19 | $result_of_query = $db_link->query($sql); |
||
20 | $vehTemp = $result_of_query->fetch_object(); |
||
21 | logAction($_SESSION['user_name'], $lang['edited'] . ' a ' . carName($vehTemp->classname) . ' (' . $vehID . ') ' . $lang['inventory'] . ' belonging to '. nameID($vehTemp->pid, $db_link), 1); |
||
22 | break; |
||
23 | |||
24 | View Code Duplication | case "veh_store": |
|
0 ignored issues
–
show
|
|||
25 | $sql = "UPDATE `vehicles` SET `alive`='1',`active`='0' WHERE `vehicles`.`id` = '" . $vehID . "'"; |
||
26 | $result_of_query = $db_link->query($sql); |
||
27 | message($lang['vehicle'] . ' stored'); |
||
28 | $sql = "SELECT `pid`,`classname` FROM `vehicles` WHERE `id` ='" . $vehID . "';"; |
||
29 | $result_of_query = $db_link->query($sql); |
||
30 | $vehTemp = $result_of_query->fetch_object(); |
||
31 | logAction($_SESSION['user_name'], $lang['stored'] . ' ' . nameID($vehTemp->pid, $db_link) . ' ' . carName($vehTemp->classname) . '(' . $vehID . ')', 1); |
||
32 | |||
33 | break; |
||
34 | |||
35 | View Code Duplication | case "veh_del": |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
36 | $sql = "SELECT `pid`, `classname` FROM `vehicles` WHERE `id` ='" . $vehID . "';"; |
||
37 | $result_of_query = $db_link->query($sql); |
||
38 | $vehTemp = $result_of_query->fetch_object(); |
||
39 | logAction($_SESSION['user_name'], $lang['deleted'] . ' ' . nameID($vehTemp->pid, $db_link) . ' ' . carName($vehTemp->classname) . '(' . $vehID . ')', 2); |
||
40 | |||
41 | $sql = "DELETE FROM `vehicles` WHERE `vehicles`.`id` = '" . $vehID . "'"; |
||
42 | $result_of_query = $db_link->query($sql); |
||
43 | message($lang['vehicle'] . ' ' . $lang['deleted']); |
||
44 | break; |
||
45 | |||
46 | case "veh_edit": |
||
47 | $vehSide = $_POST["vehSide"]; |
||
48 | $vehPlate = $_POST["vehPlate"]; |
||
49 | $vehCol = $_POST["vehCol"]; |
||
50 | $vehType = $_POST["vehType"]; |
||
51 | |||
52 | $sql = "UPDATE `vehicles` SET `side`='" . $vehSide . "',`type`='" . $vehType . "',`color`='" . $vehCol . "' WHERE `vehicles`.`id` = '" . $vehID . "'"; |
||
53 | $result_of_query = $db_link->query($sql); |
||
54 | |||
55 | message($lang['vehicle'] . ' ' . $lang['edited']); |
||
56 | |||
57 | $sql = "SELECT `pid`, `classname` FROM `vehicles` WHERE `id` ='" . $vehID . "';"; |
||
58 | $result_of_query = $db_link->query($sql); |
||
59 | $vehTemp = $result_of_query->fetch_object(); |
||
60 | logAction($_SESSION['user_name'], $lang['edited'] . ' ' . nameID($vehTemp->pid, $db_link) . ' ' . carName($vehTemp->classname) . '(' . $vehID . ')', 1); |
||
61 | break; |
||
62 | } |
||
63 | } else { |
||
64 | message($lang['expired']); |
||
65 | } |
||
66 | } |
||
67 | } |
||
68 | |||
69 | $sql = "SELECT * FROM `vehicles` WHERE `id` ='" . $vehID . "';"; |
||
70 | $result_of_query = $db_link->query($sql); |
||
71 | if ($result_of_query->num_rows > 0) { |
||
72 | $veh = $result_of_query->fetch_object(); |
||
73 | ?> |
||
74 | <div class="col-md-4" style="float:left; padding-top:20px;"> |
||
75 | <div class="panel panel-default"> |
||
76 | <div class="panel-heading"> |
||
77 | <h2 class="panel-title"><i |
||
78 | class="fa fa-child fa-fw"></i><?php echo nameID($veh->pid, $db_link) . "'s " . carName($veh->classname); ?> |
||
79 | </h2> |
||
80 | </div> |
||
81 | <div class="panel-body"> |
||
82 | <?php $carPic = getPic($veh->classname); |
||
83 | echo '<center><img src="' . $settings['url'] . 'assets/img/cars/' . $carPic . '.jpg" class="img-responsive" alt="' . $veh->classname . '">'; ?> |
||
84 | <?php |
||
85 | echo "<h4>" . $lang['owner'] . ": <a href='" . $settings['url'] . "editPlayer/" . uID($veh->pid, $db_link) . "'>" . nameID($veh->pid, $db_link) . "</a></h4>"; |
||
86 | echo "<h4>" . $lang['class'] . ": " . carName($veh->classname) . "</h4>"; |
||
87 | echo "<h4>" . $lang['plate'] . ": " . $veh->plate . "</h4>"; |
||
88 | |||
89 | View Code Duplication | if ($veh->alive == false) { |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
90 | echo "<h4><span class='label label-danger'>" . $lang["not"] . " " . $lang["alive"] . "</span></h4>"; |
||
91 | } else { |
||
92 | echo "<h4><span class='label label-success'>" . $lang["alive"] . "</span></h4> "; |
||
93 | } |
||
94 | |||
95 | View Code Duplication | if ($veh->active == false) { |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
96 | echo " <h4><span class='label label-danger'>" . $lang["not"] . " " . $lang["active"] . "</span></h4>"; |
||
97 | } else { |
||
98 | echo " <h4><span class='label label-success'>" . $lang["active"] . "</span></h4>"; |
||
99 | } |
||
100 | if ($_SESSION['permissions']['edit']['vehicles']) { |
||
101 | echo ' |
||
102 | <div style="float: right;"> |
||
103 | <a data-toggle="modal" href="#edit_veh" class="btn btn-primary btn-xs" style="margin-right:3px"> |
||
104 | <i class="fa fa-pencil"></i> |
||
105 | </a> |
||
106 | <a data-toggle="modal" href="#store_veh" class="btn btn-warning btn-xs" style="margin-right:3px"> |
||
107 | <i class="fa fa-wrench"></i> |
||
108 | </a> |
||
109 | <a data-toggle="modal" href="#del_veh" class="btn btn-danger btn-xs" style="margin-right:3px"> |
||
110 | <i class="fa fa-exclamation-triangle"></i> |
||
111 | </a> |
||
112 | </div>'; |
||
113 | } |
||
114 | ?> |
||
115 | </div> |
||
116 | </div> |
||
117 | </div> |
||
118 | |||
119 | <div class="col-md-8" style="float:right; padding-top:20px;"> |
||
120 | <div class="row mtbox"> |
||
121 | <?php |
||
122 | echo '<div class="col-md-2 col-sm-2 col-md-offset-1 box0">'; |
||
123 | echo '<div class="box1">'; |
||
124 | View Code Duplication | switch ($veh->side) { |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
125 | case 'civ': |
||
126 | ?> |
||
127 | <span class="fa fa-3x fa-car"></span> |
||
128 | <h4> <?php echo $lang['side'] . ": " . $lang['civ']; ?> </h4> |
||
129 | <?php |
||
130 | break; |
||
131 | case 'cop': |
||
132 | ?> |
||
133 | <div class="col-md-2 col-sm-2 col-md-offset-1 box0"> |
||
134 | <div class="box1"> |
||
135 | <span class="fa fa-3x fa-taxi"></span> |
||
136 | <h4> <?php echo $lang['side'] . ": " . $lang['police']; ?> </h4> |
||
137 | </div> |
||
138 | </div> |
||
139 | <?php |
||
140 | break; |
||
141 | case 'med': |
||
142 | ?> |
||
143 | <span class="fa fa-3x fa-ambulance"></span> |
||
144 | <h4> <?php echo $lang['side'] . ": " . $lang['medic']; ?> </h4> |
||
145 | <?php |
||
146 | break; |
||
147 | } |
||
148 | echo '</div></div>'; |
||
149 | echo '<div class="col-md-2 col-sm-2 box0">'; |
||
150 | echo '<div class="box1">'; |
||
151 | View Code Duplication | switch ($veh->type) { |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
152 | case 'Car': |
||
153 | echo "<span class='fa fa-3x fa-car'></span>"; |
||
154 | echo "<h4>" . $lang['type'] . ": " . $lang['car'] . "</h4>"; |
||
155 | break; |
||
156 | case 'Air': |
||
157 | echo "<span class='fa fa-3x fa-fighter-jet'></span>"; |
||
158 | echo "<h4>" . $lang['type'] . ": " . $lang['air'] . "</h4>"; |
||
159 | break; |
||
160 | case 'Ship': |
||
161 | echo "<span class='fa fa-3x fa-ship'></span>"; |
||
162 | echo "<h4>" . $lang['type'] . ": " . $lang['ship'] . "</h4>"; |
||
163 | break; |
||
164 | } |
||
165 | echo '</div> |
||
166 | </div> |
||
167 | </div>'; |
||
168 | ?> |
||
169 | |||
170 | <div class="panel panel-default" style="float:left; width:100%; margin:0 auto;"> |
||
171 | <div class="panel-body"> |
||
172 | <h4 style="centred"><?php echo $lang['vehicle'] . " " . $lang['inventory']; ?> </h4> |
||
173 | <?php |
||
174 | $inv = str_replace(']"', "", str_replace('"[', "", $veh->inventory)); |
||
175 | if (empty($inv)) { |
||
176 | $inv = 'Empty'; |
||
177 | } |
||
178 | echo "<textarea class='form-control' readonly rows='5' style='width: 100%' id='civ_gear' name='civ_gear'>" . $inv . "</textarea>"; |
||
179 | ?> |
||
180 | <br> |
||
181 | <a data-toggle="modal" href="#edit_veh_inv" class="btn btn-primary btn-xs" style="float: right;"> |
||
182 | <i class="fa fa-pencil"></i> |
||
183 | </a> |
||
184 | <br> |
||
185 | </div> |
||
186 | </div> |
||
187 | </div> |
||
188 | |||
189 | <div class="modal fade" id="edit_veh_inv" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" |
||
190 | aria-hidden="true"> |
||
191 | <div class="modal-dialog"> |
||
192 | <div class="modal-content"> |
||
193 | <div class="modal-header"> |
||
194 | <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> |
||
195 | <h4 class="modal-title"><span class="glyphicon glyphicon-pencil"></span><?php echo " " . $lang['edit'] . " " . $lang['vehicle'] . " " . $lang['inventory']; ?> |
||
196 | </h4> |
||
197 | </div> |
||
198 | <?php echo '<form method="post" action="' . $settings['url'] . 'editVeh/' . $vehID . '">' ?> |
||
199 | <?php echo formtoken::getField() ?> |
||
200 | <div class="modal-body"> |
||
201 | <div class="form-group"> |
||
202 | <input type="hidden" name="editType" value="veh_inv"/> |
||
203 | |||
204 | <div class="row"> |
||
205 | <textarea class="form-control" rows="10" |
||
206 | name="vehInv"><?php echo $veh->inventory; ?></textarea> |
||
207 | </div> |
||
208 | </div> |
||
209 | </div> |
||
210 | <div class="modal-footer"> |
||
211 | <button class="btn btn-default" data-dismiss="modal" type="reset"><?php echo $lang['close']; ?></button> |
||
212 | <button class="btn btn-primary" type="submit"><?php echo $lang['subChange'] ?></button> |
||
213 | </div> |
||
214 | </form> |
||
215 | </div> |
||
216 | </div> |
||
217 | </div> |
||
218 | <div class="modal fade" id="del_veh" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> |
||
219 | <div class="modal-dialog"> |
||
220 | <div class="modal-content"> |
||
221 | <div class="modal-header"> |
||
222 | <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> |
||
223 | <h4 class="modal-title"><span |
||
224 | class="glyphicon glyphicon-pencil"></span><?php echo " " . $lang['delete'] . " " . $lang['vehicle']; ?> |
||
225 | </h4> |
||
226 | </div> |
||
227 | <?php echo '<form method="post" action="' . $settings['url'] . 'editVeh/' . $vehID . '">' ?> |
||
228 | <?php echo formtoken::getField() ?> |
||
229 | <div class="modal-body"> |
||
230 | <div class="form-group"> |
||
231 | <input type="hidden" name="editType" value="veh_del"/> |
||
232 | |||
233 | <div class="row"> |
||
234 | <center><h4>Are you Sure?</h4></center> |
||
235 | </div> |
||
236 | </div> |
||
237 | </div> |
||
238 | <div class="modal-footer"> |
||
239 | <button class="btn btn-danger" type="submit"><?php echo $lang['yes']; ?></button> |
||
240 | <button class="btn btn-primary" data-dismiss="modal" |
||
241 | type="reset"><?php echo $lang['no'] ?></button> |
||
242 | </div> |
||
243 | </form> |
||
244 | </div> |
||
245 | </div> |
||
246 | </div> |
||
247 | <div class="modal fade" id="store_veh" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" |
||
248 | aria-hidden="true"> |
||
249 | <div class="modal-dialog"> |
||
250 | <div class="modal-content"> |
||
251 | <div class="modal-header"> |
||
252 | <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> |
||
253 | <h4 class="modal-title"><span |
||
254 | class="glyphicon glyphicon-pencil"></span><?php echo " " . $lang['store'] . " " . $lang['vehicle']; ?> |
||
255 | </h4> |
||
256 | </div> |
||
257 | <?php echo '<form method="post" action="' . $settings['url'] . 'editVeh/' . $vehID . '">' ?> |
||
258 | <?php echo formtoken::getField() ?> |
||
259 | <div class="modal-body"> |
||
260 | <div class="form-group"> |
||
261 | <input type="hidden" name="editType" value="veh_store"/> |
||
262 | |||
263 | <div class="row"> |
||
264 | <center><h4>Are you Sure?</h4></center> |
||
265 | </div> |
||
266 | </div> |
||
267 | </div> |
||
268 | <div class="modal-footer"> |
||
269 | <button class="btn btn-danger" type="submit"><?php echo $lang['yes']; ?></button> |
||
270 | <button class="btn btn-primary" data-dismiss="modal" |
||
271 | type="reset"><?php echo $lang['no']; ?></button> |
||
272 | </div> |
||
273 | </form> |
||
274 | |||
275 | </div> |
||
276 | </div> |
||
277 | </div> |
||
278 | <div class="modal fade" id="edit_veh" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> |
||
279 | <div class="modal-dialog"> |
||
280 | <div class="modal-content"> |
||
281 | <div class="modal-header"> |
||
282 | <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> |
||
283 | <h4 class="modal-title"><span class="glyphicon glyphicon-pencil"></span> Edit Player</h4> |
||
284 | </div> |
||
285 | <?php echo '<form method="post" action="' . $settings['url'] . 'editVeh/' . $vehID . '">' ?> |
||
286 | <?php echo formtoken::getField() ?> |
||
287 | <div class="modal-body"> |
||
288 | <div class="form-group"> |
||
289 | <input type="hidden" name="editType" value="veh_edit"/> |
||
290 | |||
291 | <div class="row"> |
||
292 | <center> |
||
293 | <?php |
||
294 | echo "<h4>" . $lang['class'] . ": <input id='vehClass' name='vehClass' type='text' value='" . $veh->classname . "' readonly></td><br/>"; |
||
295 | echo "<h4>" . $lang['plate'] . ": <input id='vehPlate' name='vehPlate' type='number' value='" . $veh->plate . "'readonly></td><br/>"; |
||
296 | echo "<h4>" . $lang['side'] . ": "; |
||
297 | echo "<select id='vehSide' name='vehSide'>"; |
||
298 | echo '<option value="civ"' . select('civ', $veh->side) . '>' . $lang['civ'] . '</option>'; |
||
299 | echo '<option value="cop"' . select('cop', $veh->side) . '>' . $lang['cop'] . '</option>'; |
||
300 | echo '<option value="med"' . select('med', $veh->side) . '>' . $lang['medic'] . '</option>'; |
||
301 | echo "</select>"; |
||
302 | echo "<h4>" . $lang['type'] . ": "; |
||
303 | echo "<select id='vehType' name='vehType'>"; |
||
304 | echo '<option value="Car"' . select('Car', $veh->type) . '>' . $lang['car'] . '</option>'; |
||
305 | echo '<option value="Air"' . select('Air', $veh->type) . '>' . $lang['air'] . '</option>'; |
||
306 | echo '<option value="Ship"' . select('Ship', $veh->type) . '>' . $lang['ship'] . '</option>'; |
||
307 | echo "</select>"; |
||
308 | echo "<h4>" . $lang['colour'] . ": <input id='vehCol' name='vehCol' type='number' value='" . $veh->color . "'></td><br/>"; |
||
309 | echo "</center>"; |
||
310 | ?> |
||
311 | </center> |
||
312 | </div> |
||
313 | </div> |
||
314 | </div> |
||
315 | <div class="modal-footer"> |
||
316 | <button class="btn btn-default" data-dismiss="modal" type="reset">Close</button> |
||
317 | <button class="btn btn-primary" type="submit"><?php echo $lang['subChange']; ?></button> |
||
318 | </div> |
||
319 | </form> |
||
320 | </div> |
||
321 | </div> |
||
322 | </div> |
||
323 | <?php } else echo "<h1>" . errorMessage(32, $lang) . "</h1>"; |
||
0 ignored issues
–
show
|
|||
324 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.