echo '<h4>' . errorMessage(372, $lang) . '</h4>'; } ?> </div> <div class="tab-pane well fade" id="police_lic"> <?php if ($player->cop_licenses !== '"[]"' && $player->cop_licenses !== '') { $return = stripArray($player->cop_licenses, 0); echo '<h4 style="centred">' . $lang['cop'] . ' ' . $lang['licenses'] . '</h4>'; foreach ($return as $value) { if (strpos($value, "1") == TRUE) { $name = before(',', $value); echo "<button type='button' id=" . $name . " class='license btn btn-xs btn-success' style='margin-bottom: 3px;'>" . licName($name, $license) . "</button> "; } else { $name = before(',', $value); echo "<button type='button' id=" . $name . " class='license btn btn-xs btn-theme01' style='margin-bottom: 3px;'>" . licName($name, $license) . "</button> "; } } } else { echo '<h4>' . errorMessage(373, $lang) . '</h4>'; } ?> </div> <?php } if ($_SESSION['permissions']['edit']['inventory']) { ?> <div class="tab-pane fade well" id="civ_inv"> <?php if ($player->civ_gear !== '"[]"' && $player->civ_gear !== '') { echo '<h4 style="centred">' . $lang['civil'] . ' ' . $lang['gear'] . '</h4>';
if ($_SESSION['permissions']['edit']['licences'] && isset($_POST['player']) && isset($_POST['id'])) { require '../gfunctions.php'; require '../config/license.php'; $settings = (require '../config/settings.php'); if (isset($_SESSION['dbid'])) { $db_link = serverConnect($_SESSION['dbid']); $change = explode("_", $_POST['id']); $col = $change['1'] . "_licenses"; $sql = "SELECT `" . $col . "` FROM `players` WHERE `uid` = '" . $_POST['player'] . "';"; //todo: innerjoin $result = $db_link->query($sql); if ($result->num_rows > 0) { $lic = $result->fetch_object()->{$col}; $num = strpos($lic, $change['2']) + strlen($change['2']) + 2; if ($lic[$num] == '1') { $lic[$num] = '0'; if ($settings['logging']) { logAction($_SESSION['user_name'], $lang['removed'] . ' ' . uIDname($_POST['player'], $db_link) . ' ' . $lang['licenses'] . ' (' . licName($_POST['id'], $license) . ')', 2); } } elseif ($lic[$num] == '0') { $lic[$num] = '1'; if ($settings['logging']) { logAction($_SESSION['user_name'], $lang['added'] . ' ' . uIDname($_POST['player'], $db_link) . ' ' . $lang['licenses'] . ' (' . licName($_POST['id'], $license) . ')', 2); } } $sql = "UPDATE `players` SET `" . $col . "`='{$lic}' WHERE `uid` = '" . $_POST['player'] . "';"; $db_link->query($sql); } } } }
echo $lang['police'] . " " . $lang['licenses']; ?> </h4> <?php $sql = 'SELECT * FROM `players` WHERE `uid` ="' . $uID . '";'; $result_of_query = $db_connection->query($sql); while ($row = mysqli_fetch_assoc($result_of_query)) { if ($row["cop_licenses"] !== '"[]"') { $return = stripArray($row["cop_licenses"]); foreach ($return as $value) { if (strpos($value, "1") == TRUE) { $name = before(',', $value); echo "<span class='label label-success' style='margin-right:3px; line-height:2;'>" . licName($name, $license) . "</span> "; } else { $name = before(',', $value); echo "<span class='label label-default' style='margin-right:3px; line-height:2;'>" . licName($name, $license) . "</span> "; } } } else { echo $lang['no'] . " " . $lang['licenses']; } } if ($_SESSION['user_level'] >= P_EDIT_PLAYER_LICENCES) { ?> <a data-toggle="modal" href="#edit_cop_licenses" class="btn btn-primary btn-xs" style="float: right;"> <i class="fa fa-pencil"></i> </a> <?php } ?>