Issues (501)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

views/steam/life/player.php (13 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
if ($settings['url'] == "/") {
4
    require_once("config/carNames.php");
5
    require_once("config/images.php");
6
    require_once("config/license.php");
7
} else {
8
    require_once(realpath($settings['url']) . "config/carNames.php");
9
    require_once(realpath($settings['url']) . "config/images.php");
10
    require_once(realpath($settings['url']) . "config/license.php");
11
}
12
13
$db_link = serverConnect();
14
15
$sql = "SELECT *, $playerIdColumn as playerid FROM `players` WHERE $playerIdColumn = '" . $_SESSION['playerid'] . "'";
16
$result = $db_link->query($sql);
17
if ($result->num_rows > 0) {
18
    $player = $result->fetch_object();
19
20
    $temp = "";
21
    $pGID = $player->playerid;
22 View Code Duplication
    for ($i = 0; $i < 8; $i++) {
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.

Loading history...
23
        $temp .= chr($pGID & 0xFF);
24
        $pGID >>= 8;
25
    }
26
    $pGID = md5('BE' . $temp);
27
?>
28
<div class="col-md-3" style="float:left;  padding-top:20px;">
29
    <div class="panel panel-default">
30
        <div class="panel-heading">
31
            <h2 class="panel-title"><i class="fa fa-child fa-fw"></i><?php echo $player->name; ?></h2>
32
        </div>
33
34
35
        <div class="panel-body">
36
            <?php
37
                $alias = str_replace('"[`', "", $player->aliases);
38
                $alias = str_replace('`]"', "", $alias);
39
40
                echo '<center><img alt="' . $alias . '" src="'. skinImage($player->civ_gear) .'">';
41
                echo "<h4>" . $lang['aliases'] . ": " . $alias . "</h4>";
42
                echo "<h4>" . $lang['uid'] . ": " . $player->uid . "</h4>";
43
                echo "<h4>" . $lang['playerID'] . ": " . $player->playerid . "</h4>";
44
                echo "<h4 style='word-wrap: break-word;'>" . $lang['GUID'] . ": " . $pGID . "</h4>";
45
            ?>
46
            <i class="fa fa-2x fa-money"></i>
47
            <h4> <?php echo $lang['cash'] . ": " . $player->cash; ?> </h4>
48
            <i style="padding-left:15px;" class="fa fa-2x fa-bank"></i>
49
            <h4> <?php echo $lang['bank'] . ": " . $player->bankacc; ?> </h4>
50
            <?php
51 View Code Duplication
                if ($player->arrested == 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.

Loading history...
52
                    echo "<h4><button type='button' id='arrested' class='arrest btn btn-xs btn-success'>" . $lang["not"] . " " . $lang["arrested"] . "</button></h4>";
53
                } else {
54
                    echo "<h4><button type='button' id='arrested' class='arrest btn btn-xs btn-theme01'>" . $lang["arrested"] . "</button></h4>";
55
                }
56
57 View Code Duplication
                if ($player->blacklist == 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.

Loading history...
58
                    echo "<h4><button type='button' id='blacklist' class='arrest btn btn-xs btn-success'>" . $lang["not"] . " " . $lang["blacklisted"] . "</button></h4>";
59
                } else {
60
                    echo "<h4><button type='button' id='blacklist' class='arrest btn btn-xs btn-theme01'>" . $lang["blacklisted"] . "</button></h4>";
61
                }
62
63
                echo "</center>";
64
            ?>
65
        </div>
66
    </div>
67
</div>
68
69
<!-- Right Container -->
70
71
<div class="col-md-9" style="float:right; padding-top:20px;">
72
    <div class="row mtbox">
73
        <div class="col-md-2 col-sm-2 col-md-offset-1 box0">
74
            <div class="box1">
75
                <span class="fa fa-3x fa-taxi"></span>
76
77
                <h3> <?php echo $lang['police'] . ": " . $player->coplevel; ?> </h3>
78
            </div>
79
        </div>
80
        <div class="col-md-2 col-sm-2 box0">
81
            <div class="box1">
82
                <span class="fa fa-3x fa-ambulance"></span>
83
84
                <h3> <?php echo $lang['medic'] . ": " . $player->mediclevel; ?> </h3>
85
            </div>
86
        </div>
87
        <div class="col-md-2 col-sm-2 box0">
88
            <div class="box1">
89
                <span class="fa fa-3x fa-usd"></span>
90
91
                <h3> <?php echo $lang['donator'] . ": " . $player->$settings['donorFormat']; ?> </h3>
92
            </div>
93
        </div>
94
        <div class="col-md-2 col-sm-2 box0">
95
            <div class="box1">
96
                <span class="fa fa-3x fa-group"></span>
97
98
                <h3> <?php echo $lang['admin'] . ": " . $player->adminlevel; ?> </h3>
99
            </div>
100
        </div>
101
        <?php
102 View Code Duplication
        if ($_SESSION['permissions']['view']['steam'] || $uID == $_SESSION['playerid']) {
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.

Loading history...
103
            echo '<div class="col-md-2 col-sm-2 box0">';
104
            echo '<a href="http://steamcommunity.com/profiles/' . $row["playerid"] . '"';
105
            echo 'target="_blank">';
106
            echo '<div class="box1">';
107
            echo '<span class="fa fa-3x fa-steam"></span>';
108
            echo '<h3>Steam</h3>';
109
            echo '</div>';
110
            echo '</div></a>';
111
        } ?>
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 class="dropdown active">
117
                <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo $lang['licenses']; ?> <b class="caret"></b></a>
118
                <ul class="dropdown-menu">
119
                    <li><a href="#civ_lic" data-toggle="tab"><?php echo $lang['civ']; ?></a></li>
120
                    <li><a href="#medic_lic" data-toggle="tab"><?php echo $lang['medic']; ?></a></li>
121
                    <li><a href="#police_lic" data-toggle="tab"><?php echo $lang['police']; ?></a></li>
122
                </ul>
123
            </li>
124
            <li class="dropdown">
125
                <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo $lang['inventory']; ?> <b class="caret"></b></a>
126
                <ul class="dropdown-menu">
127
                    <li><a href="#civ_inv" data-toggle="tab"><?php echo $lang['civ']; ?></a></li>
128
                    <li><a href="#medic_inv" data-toggle="tab"><?php echo $lang['medic']; ?></a></li>
129
                    <li><a href="#police_inv" data-toggle="tab"><?php echo $lang['police']; ?></a></li>
130
                </ul>
131
            </li>
132
            <li><a href="#house" data-toggle="tab"><?php echo $lang['houses']; ?></a></li>
133
            <li><a href="#veh" data-toggle="tab"><?php echo $lang['vehicles']; ?></a></li>
134
        </ul>
135
        <div class="panel-body">
136
            <div id="myTabContent" class="tab-content">
137
                <?php if ($player->playerid == $_SESSION['playerid']) { ?>
138
                    <div class="tab-pane fade in active well" id="civ_lic">
139
                        <h4 style="centred"><?php echo $lang['civ'] . " " . $lang['licenses']; ?> </h4>
140
                        <?php
141 View Code Duplication
                            if ($player->civ_licenses !== '"[]"') {
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.

Loading history...
142
                                $return = stripArray($player->civ_licenses, 0);
143
                                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.

  1. If you want to be on the safe side, you can add an additional type-check:

    $collection = json_decode($data, true);
    if ( ! is_array($collection)) {
        throw new \RuntimeException('$collection must be an array.');
    }
    
    foreach ($collection as $item) { /** ... */ }
    
  2. If you are sure that the expression is traversable, you might want to add a doc comment cast to improve IDE auto-completion and static analysis:

    /** @var array $collection */
    $collection = json_decode($data, true);
    
    foreach ($collection as $item) { /** .. */ }
    
  3. Mark the issue as a false-positive: Just hover the remove button, in the top-right corner of this issue for more options.

Loading history...
144
                                    if (strpos($value, "1") == TRUE) {
0 ignored issues
show
Bug Best Practice introduced by
It seems like you are loosely comparing strpos($value, '1') of type integer to the boolean TRUE. If you are specifically checking for non-zero, consider using something more explicit like > 0 or !== 0 instead.
Loading history...
145
                                        $name = before(',', $value);
146
                                        echo "<button class='license btn btn-xs btn-success' style='margin-bottom: 3px;'>" . licName($name, $license) . "</button> ";
147
                                    } else {
148
                                        $name = before(',', $value);
149
                                        echo "<button class='license btn btn-xs btn-theme01' style='margin-bottom: 3px;'>" . licName($name, $license) . "</button> ";
150
                                    }
151
                                }
152
                            } else {
153
                                    echo errorMessage(37,$lang);
154
                            }?>
155
                    </div>
156
                    <div class="tab-pane well fade" id="medic_lic">
157
                        <h4 style="centred"><?php echo $lang['medic'] . " " . $lang['licenses']; ?> </h4>
158
                        <?php
159 View Code Duplication
                            if ($player->med_licenses !== '"[]"') {
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.

Loading history...
160
                                $return = stripArray($player->med_licenses,0);
161
162
                                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.

  1. If you want to be on the safe side, you can add an additional type-check:

    $collection = json_decode($data, true);
    if ( ! is_array($collection)) {
        throw new \RuntimeException('$collection must be an array.');
    }
    
    foreach ($collection as $item) { /** ... */ }
    
  2. If you are sure that the expression is traversable, you might want to add a doc comment cast to improve IDE auto-completion and static analysis:

    /** @var array $collection */
    $collection = json_decode($data, true);
    
    foreach ($collection as $item) { /** .. */ }
    
  3. Mark the issue as a false-positive: Just hover the remove button, in the top-right corner of this issue for more options.

Loading history...
163
                                    if (strpos($value, "1") == TRUE) {
0 ignored issues
show
Bug Best Practice introduced by
It seems like you are loosely comparing strpos($value, '1') of type integer to the boolean TRUE. If you are specifically checking for non-zero, consider using something more explicit like > 0 or !== 0 instead.
Loading history...
164
                                        $name = before(',', $value);
165
                                        echo "<button class='license btn btn-xs btn-success' style='margin-bottom: 3px;'>" . licName($name, $license) . "</button> ";
166
                                    } else {
167
                                        $name = before(',', $value);
168
                                        echo "<button class='license btn btn-xs btn-theme01' style='margin-bottom: 3px;'>" . licName($name, $license) . "</button> ";
169
                                    }
170
                                }
171
                            } else {
172
                                    echo errorMessage(37,$lang);
173
                            } ?>
174
                    </div>
175
                    <div class="tab-pane well fade" id="police_lic">
176
                        <h4 style="centred"><?php echo $lang['cop'] . " " . $lang['licenses']; ?> </h4>
177
                        <?php
178 View Code Duplication
                            if ($player->cop_licenses !== '"[]"') {
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.

Loading history...
179
                                $return = stripArray($player->cop_licenses,0);
180
181
                                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.

  1. If you want to be on the safe side, you can add an additional type-check:

    $collection = json_decode($data, true);
    if ( ! is_array($collection)) {
        throw new \RuntimeException('$collection must be an array.');
    }
    
    foreach ($collection as $item) { /** ... */ }
    
  2. If you are sure that the expression is traversable, you might want to add a doc comment cast to improve IDE auto-completion and static analysis:

    /** @var array $collection */
    $collection = json_decode($data, true);
    
    foreach ($collection as $item) { /** .. */ }
    
  3. Mark the issue as a false-positive: Just hover the remove button, in the top-right corner of this issue for more options.

Loading history...
182
                                    if (strpos($value, "1") == TRUE) {
0 ignored issues
show
Bug Best Practice introduced by
It seems like you are loosely comparing strpos($value, '1') of type integer to the boolean TRUE. If you are specifically checking for non-zero, consider using something more explicit like > 0 or !== 0 instead.
Loading history...
183
                                        $name = before(',', $value);
184
                                        echo "<button class='license btn btn-xs btn-success' style='margin-bottom: 3px;'>" . licName($name, $license) . "</button> ";
185
                                    } else {
186
                                        $name = before(',', $value);
187
                                        echo "<button class='license btn btn-xs btn-theme01' style='margin-bottom: 3px;'>" . licName($name, $license) . "</button> ";
188
                                    }
189
                                }
190
                            } else {
191
                                    echo errorMessage(37,$lang);
192
                            }
193
                        ?>
194
                    </div>
195
                <?php } ?>
196
197
                <?php if ($player->playerid == $_SESSION['playerid']) { ?>
198
                    <div class="tab-pane fade well" id="civ_inv">
199
                        <h4 style="centred"><?php echo $lang['civ'] . " " . $lang['gear']; ?> </h4>
200
                        <?php
201
                        echo "<textarea class='form-control' readonly rows='5' style='width: 100%' id='civ_gear' name='civ_gear'>" . $player->civ_gear . "</textarea>";
202
                        echo '<br>';
203
204
                        if ($_SESSION['permissions']['edit']['inventory']) {
205
                            echo '<a data-toggle="modal" href="#edit_civ_inv" class="btn btn-primary btn-xs" style="float: right;">';
206
                            echo '<i class="fa fa-pencil"></i></a>';
207
                        } ?>
208
209
                        <br>
210
                    </div>
211
                    <div class="tab-pane fade well" id="police_inv">
212
                        <h4 style="centred"><?php echo $lang['police'] . " " . $lang['gear']; ?> </h4>
213
                        <?php
214
                        echo "<textarea class='form-control' readonly rows='5' style='width: 100%' id='civ_gear' name='cop_gear'>" . $player->cop_gear . "</textarea>";
215
                        echo '<br>';
216
                        if ($_SESSION['permissions']['edit']['inventory']) {
217
                            echo '<a data-toggle="modal" href="#edit_cop_inv" class="btn btn-primary btn-xs" style="float: right;">';
218
                            echo '<i class="fa fa-pencil"></i></a>';
219
                        } ?>
220
221
                        <br>
222
                    </div>
223
                    <div class="tab-pane fade well" id="medic_inv">
224
                        <h4 style="centred"><?php echo $lang['medic'] . " " . $lang['gear']; ?> </h4>
225
                        <?php
226
                        echo "<textarea class='form-control' readonly rows='5' style='width: 100%' id='civ_gear' name='med_gear'>" . $player->med_gear . "</textarea>";
227
                        echo '<br>';
228
                        if ($_SESSION['permissions']['edit']['inventory']) {
229
                            echo '<a data-toggle="modal" href="#edit_med_inv" class="btn btn-primary btn-xs" style="float: right;">';
230
                            echo '<i class="fa fa-pencil"></i></a>';
231
                        } ?>
232
                        <br>
233
                    </div>
234
                <?php } ?>
235
236
                <?php if ($player->playerid == $_SESSION['playerid']) { ?>
237
                    <div class="tab-pane fade" id="house">
238
                        <div class="table-responsive">
239
                            <?php
240
                            $sql = "SELECT `pos`,`id` FROM `houses` WHERE `pid` = '" . $player->playerid . "' ORDER BY `id` DESC LIMIT 8";
241
                            $result_of_query = $db_link->query($sql);
242
                            if ($result_of_query->num_rows > 0) {
243
                                ?>
244
                                <table class="table table-bordered table-hover table-striped">
245
                                    <thead>
246
                                    <tr>
247
                                        <th><?php echo $lang['position']; ?></th>
248
                                        <th><?php echo $lang['edit']; ?></th>
249
                                    </tr>
250
                                    </thead>
251
                                    <tbody>
252
                                    <?php
253
                                    while ($row = mysqli_fetch_assoc($result_of_query)) {
254
                                        echo "<tr>";
255
                                        echo "<td>" . $row["pos"] . "</td>";
256
                                        echo "<td><a class='btn btn-primary btn-xs' href='" . $settings['url'] . "editHouse/" . $row["id"] . "'>";
257
                                        echo "<i class='fa fa-pencil'></i></a></td>";
258
                                        echo "</tr>";
259
                                    };
260
                                    ?>
261
                                    </tbody>
262
                                </table>
263
                                <?php echo '<a class="fa fa-caret-right fa-2x" style="float: right; padding-right:15px;" href="' . $settings['url'] . 'houses/' . $player->playerid . '"> More</a>';
264
                            } else {
265
                              echo errorMessage(31, $lang);
266
                            } ?>
267
                        </div>
268
                    </div>
269
                <?php } ?>
270
271
                <?php if ($player->playerid == $_SESSION['playerid']) { ?>
272
                    <div class="tab-pane fade" id="veh">
273
                        <div class="table-responsive">
274
                        <?php
275
                            $sql = "SELECT `classname`,`type`,`id`,`plate` FROM `vehicles` WHERE `pid` = '" . $player->playerid . "' ORDER BY `id` DESC LIMIT 8";
276
                            $result_of_query = $db_link->query($sql);
277
                            if ($result_of_query->num_rows > 0) {
278
                                $veh = $result_of_query->fetch_object();
279
                                echo '<table class="table table-bordered table-hover table-striped">';
280
                                echo '<thead><tr>';
281
                                echo '<th>' . $lang['class'] . '</th>';
282
                                echo '<th>' . $lang['type'] . '</th>';
283
                                echo '<th>' . $lang['plate'] . '</th>';
284
                                if ($_SESSION['permissions']['edit']['vehicles']) {
285
                                    echo "<th>" . $lang['edit'] . "</th>";
286
                                }
287
                                echo '</tr></thead><tbody';
288
                                echo '<tr>';
289
                                echo '<td>' . carName($veh->classname) . '</td>';
290
                                echo '<td>' . carType($veh->type, $lang) . '</td>';
291
                                echo '<td>' . $veh->plate . '</td>';
292
293
                                if ($_SESSION['permissions']['edit']['vehicles']) {
294
                                    echo "<td><a class='btn btn-primary btn-xs' href='" . $settings['url'] . "editVeh.php?ID=" . $veh->id . "'>";
295
                                    echo "<i class='fa fa-pencil'></i></a></td>";
296
                                }
297
298
                                echo '</tr>';
299
                                echo '</tbody></table>';
300
                                echo '<a class="fa fa-caret-right fa-2x" style="float: right; padding-right:15px;" href="' . $settings['url'] . 'vehicles/' . $player->playerid . '"> More</a>';
301
302
                            } else  echo errorMessage(31, $lang);
303
                        ?>
304
                        </div>
305
                    </div>
306
                <?php } ?>
307
            </div>
308
        </div>
309
    </div>
310
</div>
311
312
<?php }