exec("INSERT INTO `$dbname`.`csrf_token` (`token`,`timestamp`,`sessionid`) VALUES ('$csrf_token','".time()."','".session_id()."')") === false) {
$err_msg = print_r($mysqlcon->errorInfo(), true);
$err_lvl = 3;
}
if (($db_csrf = $mysqlcon->query("SELECT * FROM `$dbname`.`csrf_token` WHERE `sessionid`='".session_id()."'")->fetchALL(PDO::FETCH_UNIQUE|PDO::FETCH_ASSOC)) === false) {
$err_msg = print_r($mysqlcon->errorInfo(), true);
$err_lvl = 3;
}
if(($groupslist = $mysqlcon->query("SELECT * FROM `$dbname`.`groups` ORDER BY `sortid`,`sgidname` ASC")->fetchAll(PDO::FETCH_UNIQUE|PDO::FETCH_ASSOC)) === false) {
$err_msg = print_r($mysqlcon->errorInfo(), true);
$err_lvl = 3;
}
if(!isset($groupslist) || $groupslist == NULL) {
$err_msg = 'No servergroups found inside the Ranksystem cache!
Please connect the Ranksystem Bot to the TS server. The Ranksystem will download the servergroups when it is connected to the server.
Give it a few minutes and reload this page. The dropdown field should contain your groups after.';
$err_lvl = 1;
}
if (isset($_POST['update_old']) && isset($db_csrf[$_POST['csrf_token']])) {
if(empty($_POST['rankup_definition'])) {
$grouparr_old = null;
} else {
foreach (explode(',', $_POST['rankup_definition']) as $entry) {
list($time, $groupid) = explode('=>', $entry);
$grouparr_old[$groupid] = $time;
}
}
if(isset($groupslist) && $groupslist != NULL) {
foreach($grouparr_old as $groupid => $time) {
if(!isset($groupslist[$groupid]) && $groupid != NULL) {
$err_msg .= sprintf($lang['upgrp0001'], $groupid, $lang['wigrptime']).'
';
$err_lvl = 3;
$errcnf++;
}
}
}
if($_POST['rankup_definition'] == "") {
$err_msg = "Saving of empty defintion prevented.
Your changes were not be saved!
You need at least one entry to be able to save the configuration!";
$err_lvl = 3;
} else {
$cfg['rankup_definition'] = $_POST['rankup_definition'];
if($errcnf == 0) {
if ($mysqlcon->exec("INSERT INTO `$dbname`.`cfg_params` (`param`,`value`) VALUES ('rankup_definition','{$cfg['rankup_definition']}') ON DUPLICATE KEY UPDATE `value`=VALUES(`value`); DELETE FROM `$dbname`.`csrf_token` WHERE `token`='{$_POST['csrf_token']}'") === false) {
$err_msg = print_r($mysqlcon->errorInfo(), true);
$err_lvl = 3;
} else {
$err_msg = $lang['wisvsuc']." ".sprintf($lang['wisvres'], '