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 | $db_link = serverConnect(); |
||
3 | |||
4 | if (isset($_POST["editType"])) { |
||
5 | if ($_SESSION['permissions']['edit']['houses']) { |
||
6 | switch ($_POST["editType"]) { |
||
7 | View Code Duplication | case "house_inv": |
|
0 ignored issues
–
show
|
|||
8 | $hInv = $_POST["hInv"]; |
||
9 | $sql = "UPDATE `houses` SET `inventory`='" . $hInv . "' WHERE `houses`.`id` = '" . $hID . "'"; |
||
10 | $db_link->query($sql); |
||
11 | message($lang['house'] . ' ' . $lang['updated']); |
||
12 | break; |
||
13 | |||
14 | View Code Duplication | case "house_cont": |
|
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. ![]() |
|||
15 | $hCont = $_POST["hCont"]; |
||
16 | $sql = "UPDATE `houses` SET `containers`='" . $hCont . "' WHERE `houses`.`id` = '" . $hID . "'"; |
||
17 | $db_link->query($sql); |
||
18 | message($lang['house'] . ' ' . $lang['updated']); |
||
19 | break; |
||
20 | |||
21 | case "house_del": |
||
22 | $sql = "DELETE FROM `houses` WHERE `houses`.`id` = '" . $hID . "'"; |
||
23 | $db_link->query($sql); |
||
24 | header("location: " . $settings['url'] . "houses"); |
||
25 | break; |
||
26 | |||
27 | case "house_details": |
||
28 | $hPos = $_POST["hPos"]; |
||
29 | $hOwn = $_POST["hOwn"]; |
||
30 | $hOwned = $_POST["hOwned"]; |
||
31 | $sql = "UPDATE `houses` SET `pid`='" . $hOwn . "',`pos`='" . $hPos . "',`owned`='" . $hOwned . "' WHERE `id` = '" . $hID . "'"; |
||
32 | $db_link->query($sql); |
||
33 | message($lang['house'] . ' ' . $lang['updated']); |
||
34 | break; |
||
35 | } |
||
36 | } |
||
37 | } |
||
38 | |||
39 | $sql = "SELECT * FROM `houses` WHERE `id` ='" . $hID . "';"; |
||
40 | $result_of_query = $db_link->query($sql); |
||
41 | if ($result_of_query->num_rows > 0) { |
||
42 | $house = $result_of_query->fetch_object(); |
||
43 | ?> |
||
44 | <div class="col-md-4" style="float:left; padding-top:20px;"> |
||
45 | <div class="panel panel-default"> |
||
46 | <div class="panel-heading"> |
||
47 | <h2 class="panel-title"><i |
||
48 | class="fa fa-child fa-fw"></i><?php echo nameID($house->pid, $db_link) . "'s " . $lang['house']; ?> |
||
49 | </h2> |
||
50 | </div> |
||
51 | <div class="panel-body"> |
||
52 | <?php |
||
53 | echo '<center><img class="img-responsive" src="' . $settings['url'] . 'assets/img/house/1.jpg"/>'; |
||
54 | |||
55 | echo "<h4>" . $lang['owner'] . ": <a href='" . $settings['url'] . "editPlayer/" . uID($house->pid, $db_link) . "'>" . nameID($house->pid, $db_link) . "</a></h4>"; |
||
56 | echo "<h4>" . $lang['position'] . ": " . $house->pos . "</h4>"; |
||
57 | |||
58 | if ($_SESSION['permissions']['edit']['houses']) { |
||
59 | echo ' |
||
60 | <div style="float: right;"> |
||
61 | <a data-toggle="modal" href="#edit_house" class="btn btn-primary btn-xs" style="margin-right:3px"> |
||
62 | <i class="fa fa-pencil"></i> |
||
63 | </a> |
||
64 | <a data-toggle="modal" href="#del_house" class="btn btn-danger btn-xs" style="margin-right:3px"> |
||
65 | <i class="fa fa-exclamation-triangle"></i> |
||
66 | </a> |
||
67 | </div>'; |
||
68 | } |
||
69 | echo "</center>"; |
||
70 | ?> |
||
71 | </div> |
||
72 | </div> |
||
73 | </div> |
||
74 | |||
75 | <div class="col-md-8" style="float:right; padding-top:20px;"> |
||
76 | <?php |
||
77 | echo '<div class="panel panel-default" style="float:left; width:100%; margin:0 auto;">'; |
||
78 | echo '<ul id="myTab" class="nav nav-tabs">'; |
||
79 | echo '<li><a href="#house_inv" data-toggle="tab">' . $lang['inventory'] . '</a></li>'; |
||
80 | echo '<li><a href="#house_cont" data-toggle="tab">' . $lang['containers'] . '</a></li>'; |
||
81 | echo '</ul>'; |
||
82 | ?> |
||
83 | <div id="myTabContent" class="tab-content"> |
||
84 | <div class="tab-pane fade active in well" id="house_inv"> |
||
85 | <h4 style="centred"><?php echo $lang['house'] . " " . $lang['inventory']; ?> </h4> |
||
86 | <?php |
||
87 | echo "<textarea class='form-control' readonly rows='5' style='width: 100%' id='civ_gear' name='civ_gear'>" . $house->inventory . "</textarea>"; |
||
88 | ?> |
||
89 | <br> |
||
90 | <?php if ($_SESSION['permissions']['edit']['houses']) { ?> |
||
91 | <a data-toggle="modal" href="#edit_house_inv" class="btn btn-primary btn-xs" style="float: right;"> |
||
92 | <i class="fa fa-pencil"></i> |
||
93 | </a> |
||
94 | <?php } ?> |
||
95 | <br> |
||
96 | </div> |
||
97 | <div class="tab-pane fade well" id="house_cont"> |
||
98 | <h4 style="centred"><?php echo $lang['house'] . " " . $lang['containers']; ?> </h4> |
||
99 | <?php |
||
100 | echo "<textarea class='form-control' readonly rows='5' style='width: 100%' id='house_cont' name='house_cont'>" . $house->containers . "</textarea>"; |
||
101 | ?> |
||
102 | <br> |
||
103 | <?php if ($_SESSION['permissions']['edit']['houses']) { ?> |
||
104 | <a data-toggle="modal" href="#edit_house_cont" class="btn btn-primary btn-xs" style="float: right;"> |
||
105 | <i class="fa fa-pencil"></i> |
||
106 | </a> |
||
107 | <?php } ?> |
||
108 | <br> |
||
109 | </div> |
||
110 | </div> |
||
111 | </div> |
||
112 | </div> |
||
113 | |||
114 | <div class="modal fade" id="edit_house_inv" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> |
||
115 | <div class="modal-dialog"> |
||
116 | <div class="modal-content"> |
||
117 | <div class="modal-header"> |
||
118 | <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> |
||
119 | <h4 class="modal-title"><span class="glyphicon glyphicon-pencil"></span><?php echo $lang['edit'] . " " . $lang['house'] . " " . $lang['inventory'] ?> |
||
120 | </h4> |
||
121 | </div> |
||
122 | <form method="post" action="<?php echo $settings['url'] . "editHouse/" . $hID ?>" role="form"> |
||
123 | <div class="modal-body"> |
||
124 | <div class="form-group"> |
||
125 | <input type="hidden" name="editType" value="house_inv"/> |
||
126 | |||
127 | <div class="row"> |
||
128 | <textarea class="form-control" rows="10" |
||
129 | name="hInv"><?php echo $house->inventory ?></textarea> |
||
130 | </div> |
||
131 | </div> |
||
132 | </div> |
||
133 | <div class="modal-footer"> |
||
134 | <button class="btn btn-default" data-dismiss="modal" type="reset">Close</button> |
||
135 | <button class="btn btn-primary" type="submit"><?php echo $lang['subChange']; ?></button> |
||
136 | </div> |
||
137 | </form> |
||
138 | </div> |
||
139 | </div> |
||
140 | </div> |
||
141 | <div class="modal fade" id="edit_house_cont" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" |
||
142 | aria-hidden="true"> |
||
143 | <div class="modal-dialog"> |
||
144 | <div class="modal-content"> |
||
145 | <div class="modal-header"> |
||
146 | <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> |
||
147 | <h4 class="modal-title"> |
||
148 | <span |
||
149 | class="glyphicon glyphicon-pencil"></span> <?php echo $lang['edit'] . " " . $lang['house'] . " " . $lang['containers'] ?> |
||
150 | </h4> |
||
151 | </div> |
||
152 | <form method="post" action="<?php echo $settings['url'] . "editHouse/" . $hID ?>" role="form"> |
||
153 | <div class="modal-body"> |
||
154 | <div class="form-group"> |
||
155 | <input type="hidden" name="editType" value="house_cont"/> |
||
156 | |||
157 | <div class="row"> |
||
158 | <textarea class="form-control" rows="10" |
||
159 | name="hCont"><?php echo $house->containers; ?></textarea> |
||
160 | </div> |
||
161 | </div> |
||
162 | </div> |
||
163 | <div class="modal-footer"> |
||
164 | <button class="btn btn-default" data-dismiss="modal" type="reset">Close</button> |
||
165 | <button class="btn btn-primary" type="submit"><?php echo $lang['subChange']; ?></button> |
||
166 | </div> |
||
167 | </form> |
||
168 | </div> |
||
169 | </div> |
||
170 | </div> |
||
171 | <div class="modal fade" id="del_house" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> |
||
172 | <div class="modal-dialog"> |
||
173 | <div class="modal-content"> |
||
174 | <div class="modal-header"> |
||
175 | <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> |
||
176 | <h4 class="modal-title"><span class="glyphicon glyphicon-pencil"></span> <?php echo $lang['delete'] . " " . $lang['house'] ?> |
||
177 | </h4> |
||
178 | </div> |
||
179 | <form method="post" action="<?php echo $settings['url'] . "editHouse/" . $hID ?>" role="form"> |
||
180 | <div class="modal-body"> |
||
181 | <div class="form-group"> |
||
182 | <input type="hidden" name="editType" value="house_del"/> |
||
183 | |||
184 | <div class="row"> |
||
185 | <center><h4>Are you Sure?</h4></center> |
||
186 | </div> |
||
187 | </div> |
||
188 | </div> |
||
189 | <div class="modal-footer"> |
||
190 | <button class="btn btn-danger" type="submit"><?php echo $lang['yes']; ?></button> |
||
191 | <button class="btn btn-primary" data-dismiss="modal" |
||
192 | type="reset"><?php echo $lang['no']; ?></button> |
||
193 | </div> |
||
194 | </form> |
||
195 | </div> |
||
196 | </div> |
||
197 | </div> |
||
198 | <div class="modal fade" id="edit_house" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> |
||
199 | <div class="modal-dialog"> |
||
200 | <div class="modal-content"> |
||
201 | <div class="modal-header"> |
||
202 | <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> |
||
203 | <h4 class="modal-title"> |
||
204 | <span class="glyphicon glyphicon-pencil"></span> <?php echo $lang['edit'] . " " . $lang['house'] ?> |
||
205 | </h4> |
||
206 | </div> |
||
207 | <form method="post" action="<?php echo $settings['url'] . "editHouse/" . $hID ?>" role="form"> |
||
208 | <div class="modal-body"> |
||
209 | <div class="form-group"> |
||
210 | <input type="hidden" name="editType" value="house_details"/> |
||
211 | |||
212 | <div class="row"> |
||
213 | <center> |
||
214 | <?php |
||
215 | echo "<h4>" . $lang['owner'] . ": <input id='hOwn' name='hOwn' type='text' value='" . $house->pid . "'></td><br/>"; |
||
216 | echo "<h4>" . $lang['position'] . ": <input id='hPos' name='hPos' type='text' value='" . $house->pos . "'readonly></td><br/>"; |
||
217 | echo "<h4>" . $lang['owned'] . ": "; |
||
218 | echo "<select id='hOwned' name='hOwned'>"; |
||
219 | echo '<option value="0"' . select('0', $house->owned) . '>' . $lang['no'] . '</option>'; |
||
220 | echo '<option value="1"' . select('1', $house->owned) . '>' . $lang['yes'] . '</option>'; |
||
221 | echo "</select>"; |
||
222 | echo "</center>"; |
||
223 | ?> |
||
224 | </center> |
||
225 | </div> |
||
226 | </div> |
||
227 | </div> |
||
228 | <div class="modal-footer"> |
||
229 | <button class="btn btn-default" data-dismiss="modal" type="reset">Close</button> |
||
230 | <button class="btn btn-primary" type="submit"><?php echo $lang['subChange'] ?></button> |
||
231 | </div> |
||
232 | </form> |
||
233 | </div> |
||
234 | </div> |
||
235 | </div> |
||
236 | <?php } else errorMessage(3, $lang); ?> |
||
0 ignored issues
–
show
|
|||
237 |
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.