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["squad"])) { |
||
5 | $xml = '<?xml version="1.0"?> |
||
6 | <?DOCTYPE squad SYSTEM "squad.dtd"?> |
||
7 | <?xml-stylesheet href="squad.xsl?" type="text/xsl"?> |
||
8 | |||
9 | <squad nick="CZ"> |
||
10 | <name>Clan of Zombies</name> |
||
11 | <email>[email protected]</email> |
||
12 | <web></web> |
||
13 | <picture>logo.paa</picture> |
||
14 | <title>CZ</title>'; |
||
15 | |||
16 | $sql = "SELECT `name`,`members` FROM `gangs` WHERE `id` = '" . $gID . "';"; |
||
17 | $result = $db_link->query($sql); |
||
18 | $gang = $result->fetch_object(); |
||
19 | $members = str_replace('`]"', '', str_replace('"[`', '', $gang->members)); |
||
20 | $members = explode('`,`', $members); |
||
21 | View Code Duplication | foreach ($members as $member) { |
|
0 ignored issues
–
show
|
|||
22 | $name = nameID($member, $db_link); |
||
23 | $xml .= '<member id="' . $member . '" nick="' . $name . '"> |
||
24 | <name>'.$name . '</name><email></email><icq></icq><remark></remark></member>'; |
||
25 | } |
||
26 | $xml .= '</squad>'; |
||
27 | var_dump($xml); |
||
28 | } |
||
29 | |||
30 | if (isset($_POST["editType"])) { |
||
31 | if (formtoken::validateToken($_POST)) { |
||
32 | if ($_SESSION['permissions']['edit']['gangs']) { |
||
33 | switch ($_POST["editType"]) { |
||
34 | View Code Duplication | case "edit_members": |
|
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. ![]() |
|||
35 | $gMem = clean($_POST["gMem"], 'string'); |
||
36 | $sql = "UPDATE `gangs` SET `members`='" . $gMem . "' WHERE `gangs`.`id` = '" . $gID . "'"; |
||
37 | $result_of_query = $db_link->query($sql); |
||
38 | message($lang['updated']); |
||
39 | break; |
||
40 | |||
41 | case "del_gang": |
||
42 | $sql = "DELETE FROM `gangs` WHERE `gangs`.`id` = '" . $gID . "'"; |
||
43 | $result_of_query = $db_link->query($sql); |
||
44 | message($lang['updated']); |
||
45 | break; |
||
46 | |||
47 | case "gang_edit": |
||
48 | $gname = clean($_POST["gname"], 'string'); |
||
49 | $gowner = clean($_POST["gowner"], 'int'); |
||
50 | $gMM = clean($_POST["gMM"], 'int'); |
||
51 | $gbank = clean($_POST["gbank"], 'int'); |
||
52 | $gAct = clean($_POST["gAct"], 'int'); |
||
53 | $sql = "UPDATE `gangs` SET `owner`='" . $gowner . "',`name`='" . $gname . "',`maxmembers`='" . $gMM . "',`bank`='" . $gbank . "',`active`='" . $gAct . "' WHERE `gangs`.`id` = '" . $gID . "'"; |
||
54 | $result_of_query = $db_link->query($sql); |
||
55 | message($lang['updated']); |
||
56 | break; |
||
57 | } |
||
58 | } |
||
59 | } else { |
||
60 | message($lang['expired']); |
||
61 | } |
||
62 | } |
||
63 | |||
64 | $sql = 'SELECT * FROM `gangs` WHERE `id` ="' . $gID . '";'; |
||
65 | $result_of_query = $db_link->query($sql); |
||
66 | if ($result_of_query->num_rows > 0) { |
||
67 | $gang = $result_of_query->fetch_object(); |
||
68 | ?> |
||
69 | <div class="col-md-3" style="float:left; padding-top:20px;"> |
||
70 | <div class="panel panel-default"> |
||
71 | <div class="panel-heading"> |
||
72 | <h2 class="panel-title"><i |
||
73 | class="fa fa-child fa-fw"></i><?php echo nameID($gang->owner, $db_link) . "'s " . $lang['gang']; ?> |
||
74 | </h2> |
||
75 | </div> |
||
76 | <div class="panel-body"> |
||
77 | <center><img src="<?php echo $settings['url'] ?>assets/img/uniform/U_BG_Guerilla2_3.jpg"/> |
||
78 | <?php |
||
79 | echo "<h4>" . $lang['owner'] . ": <a href='" . $settings['url'] . "editPlayer/" . uID($gang->owner, $db_link) . "'>" . nameID($gang->owner, $db_link) . "</a></h4>"; |
||
80 | echo "<h4>" . $lang['name'] . ": " . $gang->name . "</h4>"; |
||
81 | ?> |
||
82 | <span class="fa fa-2x fa-bank"></span> |
||
83 | <h4> <?php echo $lang['bank'] . ": " . $gang->bank; ?> </h4> |
||
84 | <?php |
||
85 | View Code Duplication | if ($gang->active == 0) { |
|
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. ![]() |
|||
86 | echo "<h4><button type='button' class='gangActive btn btn-danger'>" . $lang["not"] . " " . $lang["active"] . "</button></h4> "; |
||
87 | } else { |
||
88 | echo "<h4><button type='button' class='gangActive btn btn-success'>" . $lang["active"] . "</button></h4> "; |
||
89 | } |
||
90 | if ($_SESSION['permissions']['edit']['gangs']) { |
||
91 | echo '<a data-toggle="modal" href="#edit_gang" class="btn btn-primary btn-xs" style="float: right; margin-right:3px;">'; |
||
92 | echo '<i class="fa fa-pencil"></i>'; |
||
93 | echo '</a>'; |
||
94 | echo '<a data-toggle="modal" href="#gang_del" class="btn btn-danger btn-xs" style="float: right; margin-right:3px;">'; |
||
95 | echo '<i class="fa fa-warning"></i>'; |
||
96 | echo '</a>'; |
||
97 | } |
||
98 | echo "</center>"; |
||
99 | ?> |
||
100 | </div> |
||
101 | </div> |
||
102 | </div> |
||
103 | |||
104 | <div class="col-md-9" style="float:right; padding-top:20px;"> |
||
105 | <div class="row mtbox"> |
||
106 | <div class="col-md-2 col-sm-2 col-md-offset-1 box0"> |
||
107 | <div class="box1"> |
||
108 | <span class="fa fa-3x fa-users"></span> |
||
109 | <h4> <?php echo $lang['maxMembers'] . ": " . $gang->maxmembers; ?> </h4> |
||
110 | </div> |
||
111 | </div> |
||
112 | </div> |
||
113 | |||
114 | <div class="panel panel-default" style="float:left; width:100%; margin:0 auto;"> |
||
115 | <ul id="myTab" class="nav nav-tabs"> |
||
116 | <li><a href="#gang_members" data-toggle="tab"><?php echo $lang['members']; ?></a></li> |
||
117 | </ul> |
||
118 | <div id="myTabContent" class="tab-content"> |
||
119 | <div class="tab-pane fade active in well" id="civ_inv"> |
||
120 | <h4 style="centred"><?php echo $lang['gang'] . " " . $lang['members']; ?> </h4> |
||
121 | <?php |
||
122 | $return = stripArray($gang->members, 1); |
||
123 | |||
124 | foreach ($return as $value) { |
||
0 ignored issues
–
show
The expression
$return of type array|null is not guaranteed to be traversable. How about adding an additional type check?
There are different options of fixing this problem.
![]() |
|||
125 | echo "<span class='label label-success' style='margin-right:3px; line-height:2;'>" . nameID($value, $db_link) . "</span> "; |
||
126 | } |
||
127 | } |
||
128 | ?> |
||
129 | <br> |
||
130 | <a data-toggle="modal" href="#edit_gang_members" class="btn btn-primary btn-xs" style="float: right;"> |
||
131 | <i class="fa fa-pencil"></i> |
||
132 | </a> |
||
133 | <br> |
||
134 | </div> |
||
135 | </div> |
||
136 | </div> |
||
137 | </div> |
||
138 | |||
139 | <div class="modal fade" id="edit_gang_members" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" |
||
140 | aria-hidden="true"> |
||
141 | <div class="modal-dialog"> |
||
142 | <div class="modal-content"> |
||
143 | <div class="modal-header"> |
||
144 | <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> |
||
145 | <h4 class="modal-title"><span |
||
146 | class="glyphicon glyphicon-pencil"></span><?php echo " " . $lang['edit'] . " " . $lang['gang'] . " " . $lang['members']; ?> |
||
147 | </h4> |
||
148 | </div> |
||
149 | <form method="post" action="<?php echo $settings['url'] . 'editGang/' . $gID; ?>" role="form"> |
||
150 | <?php echo formtoken::getField() ?> |
||
151 | <div class="modal-body"> |
||
152 | <div class="form-group"> |
||
153 | <input type="hidden" name="editType" value="edit_members"/> |
||
154 | |||
155 | <div class="row"> |
||
156 | <textarea id='gMem' name='gMem' class="form-control" |
||
157 | rows="10"><?php echo $gang->members ?></textarea> |
||
158 | </div> |
||
159 | </div> |
||
160 | </div> |
||
161 | <div class="modal-footer"> |
||
162 | <button class="btn btn-default" data-dismiss="modal" type="reset">Close</button> |
||
163 | <button class="btn btn-primary" type="submit"><?php echo $lang['subChange']; ?></button> |
||
164 | </div> |
||
165 | </form> |
||
166 | </div> |
||
167 | </div> |
||
168 | </div> |
||
169 | <div class="modal fade" id="gang_del" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> |
||
170 | <div class="modal-dialog"> |
||
171 | <div class="modal-content"> |
||
172 | <div class="modal-header"> |
||
173 | <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> |
||
174 | <h4 class="modal-title"> |
||
175 | <span |
||
176 | class="glyphicon glyphicon-pencil"></span><?php echo " " . $lang['delete'] . " " . $lang['gang']; ?> |
||
177 | </h4> |
||
178 | </div> |
||
179 | <form method="post" action="<?php echo $settings['url'] . 'editGang/' . $gID; ?>" role="form"> |
||
180 | <?php echo formtoken::getField() ?> |
||
181 | <div class="modal-body"> |
||
182 | <div class="form-group"> |
||
183 | <input type="hidden" name="editType" value="del_gang"/> |
||
184 | |||
185 | <div class="row"> |
||
186 | <center><h4>Are you Sure?</h4></center> |
||
187 | </div> |
||
188 | </div> |
||
189 | </div> |
||
190 | <div class="modal-footer"> |
||
191 | <button class="btn btn-danger" type="submit"><?php echo $lang['yes']; ?></button> |
||
192 | <button class="btn btn-primary" data-dismiss="modal" |
||
193 | type="reset"><?php echo $lang['no']; ?></button> |
||
194 | </div> |
||
195 | </form> |
||
196 | </div> |
||
197 | </div> |
||
198 | </div> |
||
199 | <div class="modal fade" id="edit_gang" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> |
||
200 | <div class="modal-dialog"> |
||
201 | <div class="modal-content"> |
||
202 | <div class="modal-header"> |
||
203 | <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> |
||
204 | <h4 class="modal-title"><span |
||
205 | class="glyphicon glyphicon-pencil"></span><?php echo " " . $lang['edit'] . " " . $lang['gang']; ?> |
||
206 | </h4> |
||
207 | </div> |
||
208 | <form method="post" action="<?php echo $settings['url'] . 'editGang/' . $gID; ?>" role="form"> |
||
209 | <?php echo formtoken::getField() ?> |
||
210 | <div class="modal-body"> |
||
211 | <div class="form-group"> |
||
212 | <input type="hidden" name="editType" value="gang_edit"/> |
||
213 | |||
214 | <div class="row"> |
||
215 | <center> |
||
216 | <?php |
||
217 | echo "<center>"; |
||
218 | echo "<h3>" . $lang['name'] . ": <input id='gname' name='gname' type='text' value='" . $gang->name . "'></td><br/>"; |
||
219 | echo "<h4>" . $lang['owner'] . ": <input id='gowner' name='gowner' type='number' value='" . $gang->owner . "'></td><br/>"; |
||
220 | echo "<h4>" . $lang['maxMembers'] . ": <input id='gMM' name='gMM' type='number' value='" . $gang->maxmembers . "'></td><br/>"; |
||
221 | echo "<h4>" . $lang['bank'] . ": <input id='gbank' name='gbank' type='number' value='" . $gang->bank . "'></td><br/>"; |
||
222 | echo "<h4>" . $lang['active'] . ": "; |
||
223 | echo "<select id='gAct' name='gAct'>"; |
||
224 | echo '<option value="0"' . select('0', $gang->active) . '>' . $lang['no'] . '</option>'; |
||
225 | echo '<option value="1"' . select('1', $gang->active) . '>' . $lang['yes'] . '</option>'; |
||
226 | echo "</select>"; |
||
227 | echo "</center>"; |
||
228 | ?> |
||
229 | </center> |
||
230 | </div> |
||
231 | </div> |
||
232 | </div> |
||
233 | <div class="modal-footer"> |
||
234 | <button class="btn btn-default" data-dismiss="modal" type="reset">Close</button> |
||
235 | <button class="btn btn-primary" type="submit"><?php echo $lang['subChange']; ?></button> |
||
236 | </div> |
||
237 | </form> |
||
238 | </div> |
||
239 | </div> |
||
240 | </div> |
||
241 | View Code Duplication | <?php if ($_SESSION['permissions']['edit']['licences']) { ?> |
|
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. ![]() |
|||
242 | <script> |
||
243 | $( document ).ready(function() { |
||
244 | $(".gangActive").click(function () { |
||
245 | $(this).toggleClass('btn-success btn-danger'); |
||
246 | $.post( "<?php echo $settings['url'] ?>hooks/gangActive.php", {gang: "<?php echo $gID ?>"} ); |
||
247 | }); |
||
248 | }); |
||
249 | </script> |
||
250 | <?php } ?> |
||
0 ignored issues
–
show
|
|||
251 |
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.