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); } } } }
<?php session_name('CyberWorks'); session_set_cookie_params(1209600); session_start(); if (isset($_SESSION['permissions']['edit']['player'])) { if ($_SESSION['permissions']['edit']['player'] && isset($_POST['player']) && isset($_POST['id'])) { require '../gfunctions.php'; require '../config/license.php'; $settings = (require '../config/settings.php'); $db_link = serverConnect($_SESSION['dbid']); if ($settings['logging']) { logAction($_SESSION['user_name'], $lang['edited'] . ' ' . uIDname($_POST['player'], $db_link) . ' ' . $lang['licenses'], 1); } if ($_POST['id'] == 'arrested') { $sql = "SELECT `arrested` FROM `players` WHERE `uid` = '" . $_POST['player'] . "';"; $result = $db_link->query($sql); if ($result->num_rows > 0) { $switch = $result->fetch_object(); if ($switch == '1') { $sql = "UPDATE `players` SET `arrested`='0' WHERE `uid` = '" . $_POST['player'] . "';"; } elseif ($switch == '0') { $sql = "UPDATE `players` SET `arrested`='1' WHERE `uid` = '" . $_POST['player'] . "';"; } $db_link->query($sql); } } elseif ($_POST['id'] == 'blacklist') { $sql = "SELECT `arrested` FROM `players` WHERE `uid` = '" . $_POST['player'] . "';"; $result = $db_link->query($sql); if ($result->num_rows > 0) { $switch = $result->fetch_object();