release 1.2.12

This commit is contained in:
Newcomer1989
2019-02-24 02:49:55 +01:00
parent ce3c88d833
commit 357a38dbf8
57 changed files with 2054 additions and 1134 deletions

View File

@@ -15,7 +15,7 @@ session_start();
require_once('../other/config.php');
require_once('../other/load_addons_config.php');
$addons_config = load_addons_config($mysqlcon,$lang,$dbname,$timezone,$logpath);
$addons_config = load_addons_config($mysqlcon,$lang,$cfg,$dbname);
function getclientip() {
if (!empty($_SERVER['HTTP_CLIENT_IP']))
@@ -41,7 +41,7 @@ if (isset($_POST['logout'])) {
exit;
}
if (!isset($_SESSION[$rspathhex.'username']) || $_SESSION[$rspathhex.'username'] != $webuser || $_SESSION[$rspathhex.'password'] != $webpass || $_SESSION[$rspathhex.'clientip'] != getclientip()) {
if (!isset($_SESSION[$rspathhex.'username']) || $_SESSION[$rspathhex.'username'] != $cfg['webinterface_user'] || $_SESSION[$rspathhex.'password'] != $cfg['webinterface_pass'] || $_SESSION[$rspathhex.'clientip'] != getclientip()) {
header("Location: //".$_SERVER['HTTP_HOST'].rtrim(dirname($_SERVER['PHP_SELF']), '/\\'));
exit;
}

View File

@@ -38,7 +38,7 @@ if (isset($_POST['logout'])) {
exit;
}
if (!isset($_SESSION[$rspathhex.'username']) || $_SESSION[$rspathhex.'username'] != $webuser || $_SESSION[$rspathhex.'password'] != $webpass || $_SESSION[$rspathhex.'clientip'] != getclientip()) {
if (!isset($_SESSION[$rspathhex.'username']) || $_SESSION[$rspathhex.'username'] != $cfg['webinterface_user'] || $_SESSION[$rspathhex.'password'] != $cfg['webinterface_pass'] || $_SESSION[$rspathhex.'clientip'] != getclientip()) {
header("Location: //".$_SERVER['HTTP_HOST'].rtrim(dirname($_SERVER['PHP_SELF']), '/\\'));
exit;
}

View File

@@ -38,7 +38,7 @@ if (isset($_POST['logout'])) {
exit;
}
if (!isset($_SESSION[$rspathhex.'username']) || $_SESSION[$rspathhex.'username'] != $webuser || $_SESSION[$rspathhex.'password'] != $webpass || $_SESSION[$rspathhex.'clientip'] != getclientip()) {
if (!isset($_SESSION[$rspathhex.'username']) || $_SESSION[$rspathhex.'username'] != $cfg['webinterface_user'] || $_SESSION[$rspathhex.'password'] != $cfg['webinterface_pass'] || $_SESSION[$rspathhex.'clientip'] != getclientip()) {
header("Location: //".$_SERVER['HTTP_HOST'].rtrim(dirname($_SERVER['PHP_SELF']), '/\\'));
exit;
}

View File

@@ -32,10 +32,10 @@ function getclientip() {
return false;
}
function getlog($logpath,$number_lines,$filters,$filter2,$inactivefilter = NULL) {
function getlog($cfg,$number_lines,$filters,$filter2,$inactivefilter = NULL) {
$lines=array();
if(file_exists($logpath."ranksystem.log")) {
$fp = fopen($logpath."ranksystem.log", "r");
if(file_exists($cfg['logs_path']."ranksystem.log")) {
$fp = fopen($cfg['logs_path']."ranksystem.log", "r");
$buffer=array();
while($line = fgets($fp, 4096)) {
array_push($buffer, $line);
@@ -168,7 +168,7 @@ if (isset($_POST['logout'])) {
exit;
}
if (!isset($_SESSION[$rspathhex.'username']) || $_SESSION[$rspathhex.'username'] != $webuser || $_SESSION[$rspathhex.'password'] != $webpass || $_SESSION[$rspathhex.'clientip'] != getclientip()) {
if (!isset($_SESSION[$rspathhex.'username']) || $_SESSION[$rspathhex.'username'] != $cfg['webinterface_user'] || $_SESSION[$rspathhex.'password'] != $cfg['webinterface_pass'] || $_SESSION[$rspathhex.'clientip'] != getclientip()) {
rem_session_ts3($rspathhex);
header("Location: //".$_SERVER['HTTP_HOST'].rtrim(dirname($_SERVER['PHP_SELF']), '/\\'));
exit;
@@ -193,10 +193,10 @@ if ((isset($_POST['start']) || isset($_POST['stop']) || isset($_POST['restart'])
exit;
}
$logoutput = getlog($logpath,$number_lines,$filters,$filter2,$inactivefilter);
$logoutput = getlog($cfg,$number_lines,$filters,$filter2,$inactivefilter);
if (isset($_POST['start']) && isset($db_csrf[$_POST['csrf_token']])) {
if(substr(sprintf('%o', fileperms($logpath)), -3, 1)!='7') {
if(substr(sprintf('%o', fileperms($cfg['logs_path'])), -3, 1)!='7') {
$err_msg = "!!!! Logs folder is not writable !!!!<br>Cancel start request!"; $err_lvl = 3;
} else {
if (substr(php_uname(), 0, 7) == "Windows") {
@@ -214,7 +214,7 @@ if (isset($_POST['start']) && isset($db_csrf[$_POST['csrf_token']])) {
$err_msg = $lang['wibot2'];
$err_lvl = 1;
usleep(80000);
$logoutput = getlog($logpath,$number_lines,$filters,$filter2,$inactivefilter);
$logoutput = getlog($cfg,$number_lines,$filters,$filter2,$inactivefilter);
}
}
@@ -230,11 +230,11 @@ if (isset($_POST['stop']) && isset($db_csrf[$_POST['csrf_token']])) {
$err_msg = $lang['wibot1'];
$err_lvl = 1;
usleep(80000);
$logoutput = getlog($logpath,$number_lines,$filters,$filter2,$inactivefilter);
$logoutput = getlog($cfg,$number_lines,$filters,$filter2,$inactivefilter);
}
if (isset($_POST['restart']) && isset($db_csrf[$_POST['csrf_token']])) {
if(substr(sprintf('%o', fileperms($logpath)), -3, 1)!='7') {
if(substr(sprintf('%o', fileperms($cfg['logs_path'])), -3, 1)!='7') {
$err_msg = "!!!! Logs folder is not writable !!!!<br>Cancel restart request!"; $err_lvl = 3;
} else {
if (substr(php_uname(), 0, 7) == "Windows") {
@@ -252,12 +252,12 @@ if (isset($_POST['restart']) && isset($db_csrf[$_POST['csrf_token']])) {
$err_msg = $lang['wibot3'];
$err_lvl = 1;
usleep(80000);
$logoutput = getlog($logpath,$number_lines,$filters,$filter2,$inactivefilter);
$logoutput = getlog($cfg,$number_lines,$filters,$filter2,$inactivefilter);
}
}
$disabled = '';
if($ts['host'] == NULL || $ts['query'] == NULL || $ts['voice'] == NULL || $ts['user'] == NULL || $ts['pass'] == NULL || $queryname == NULL || $grouptime == NULL || $logpath == NULL) {
if($cfg['teamspeak_host_address'] == NULL || $cfg['teamspeak_query_port'] == NULL || $cfg['teamspeak_voice_port'] == NULL || $cfg['teamspeak_query_user'] == NULL || $cfg['teamspeak_query_pass'] == NULL || $cfg['teamspeak_query_nickname'] == NULL || $cfg['rankup_definition'] == NULL || $cfg['logs_path'] == NULL) {
$disabled = 1;
$err_msg = $lang['wibot9'];
$err_lvl = 2;

View File

@@ -15,8 +15,8 @@ session_start();
require_once('../other/config.php');
require_once('../other/phpcommand.php');
function enter_logfile($logpath,$timezone,$loglevel,$logtext) {
$file = $logpath.'ranksystem.log';
function enter_logfile($cfg,$loglevel,$logtext,$norotate = false) {
$file = $cfg['logs_path'].'ranksystem.log';
if ($loglevel == 1) {
$loglevel = " CRITICAL ";
} elseif ($loglevel == 2) {
@@ -27,27 +27,22 @@ function enter_logfile($logpath,$timezone,$loglevel,$logtext) {
$loglevel = " NOTICE ";
} elseif ($loglevel == 5) {
$loglevel = " INFO ";
} elseif ($loglevel == 6) {
$loglevel = " DEBUG ";
}
$input = DateTime::createFromFormat('U.u', number_format(microtime(true), 6, '.', ''))->setTimeZone(new DateTimeZone($timezone))->format("Y-m-d H:i:s.u ").$loglevel.$logtext."\n";
$loghandle = fopen($file, 'a');
fwrite($loghandle, $input);
if (filesize($file) > 5242880) {
fwrite($loghandle, DateTime::createFromFormat('U.u', number_format(microtime(true), 6, '.', ''))->setTimeZone(new DateTimeZone($timezone))->format("Y-m-d H:i:s.u ")." NOTICE Logfile filesie of 5 MiB reached.. Rotate logfile.\n");
fwrite($loghandle, DateTime::createFromFormat('U.u', number_format(microtime(true), 6, '.', ''))->setTimeZone(new DateTimeZone($timezone))->format("Y-m-d H:i:s.u ")." NOTICE Restart Bot to continue with new log file...\n");
fwrite($loghandle, DateTime::createFromFormat('U.u', number_format(microtime(true), 6, '.', ''))->setTimeZone(new DateTimeZone($cfg['logs_timezone']))->format("Y-m-d H:i:s.u ").$loglevel.$logtext."\n");
fclose($loghandle);
if($norotate == false && filesize($file) > 5242880) {
$loghandle = fopen($file, 'a');
fwrite($loghandle, DateTime::createFromFormat('U.u', number_format(microtime(true), 6, '.', ''))->setTimeZone(new DateTimeZone($cfg['logs_timezone']))->format("Y-m-d H:i:s.u ")." NOTICE Logfile filesie of 5 MiB reached.. Rotate logfile.\n");
fclose($loghandle);
$file2 = "$file.old";
if (file_exists($file2)) unlink($file2);
rename($file, $file2);
if (substr(php_uname(), 0, 7) == "Windows") {
exec("del /F ".substr(__DIR__,0,-12).'logs/pid');
$WshShell = new COM("WScript.Shell");
$oExec = $WshShell->Run("cmd /C ".$phpcommand." ".substr(__DIR__,0,-12)."worker.php start", 0, false);
exit;
} else {
exec("rm -f ".substr(__DIR__,0,-12).'logs/pid');
exec($phpcommand." ".substr(__DIR__,0,-12)."worker.php start");
exit;
}
$loghandle = fopen($file, 'a');
fwrite($loghandle, DateTime::createFromFormat('U.u', number_format(microtime(true), 6, '.', ''))->setTimeZone(new DateTimeZone($cfg['logs_timezone']))->format("Y-m-d H:i:s.u ")." NOTICE Rotated logfile...\n");
fclose($loghandle);
}
}
@@ -74,7 +69,7 @@ if (isset($_POST['logout'])) {
exit;
}
if (!isset($_SESSION[$rspathhex.'username']) || $_SESSION[$rspathhex.'username'] != $webuser || $_SESSION[$rspathhex.'password'] != $webpass || $_SESSION[$rspathhex.'clientip'] != getclientip()) {
if (!isset($_SESSION[$rspathhex.'username']) || $_SESSION[$rspathhex.'username'] != $cfg['webinterface_user'] || $_SESSION[$rspathhex.'password'] != $cfg['webinterface_pass'] || $_SESSION[$rspathhex.'clientip'] != getclientip()) {
header("Location: //".$_SERVER['HTTP_HOST'].rtrim(dirname($_SERVER['PHP_SELF']), '/\\'));
exit;
}
@@ -93,15 +88,15 @@ if (($db_csrf = $mysqlcon->query("SELECT * FROM `$dbname`.`csrf_token` WHERE `se
}
if (isset($_POST['changepw']) && isset($db_csrf[$_POST['csrf_token']])) {
$newpass = password_hash($_POST['newpwd1'], PASSWORD_DEFAULT);
if (!password_verify($_POST['oldpwd'], $webpass)) {
$cfg['webinterface_pass'] = password_hash($_POST['newpwd1'], PASSWORD_DEFAULT);
if (!password_verify($_POST['oldpwd'], $cfg['webinterface_pass'])) {
$err_msg = $lang['wichpw1']; $err_lvl = 3;
} elseif ($_POST['newpwd1'] != $_POST['newpwd2'] || $_POST['newpwd1'] == NULL) {
$err_msg = $lang['wichpw2']; $err_lvl = 3;
} elseif ($mysqlcon->exec("UPDATE `$dbname`.`config` SET `webpass`='$newpass'") === false) {
} elseif($mysqlcon->exec("INSERT INTO `$dbname`.`cfg_params` (`param`,`value`) VALUES ('webinterface_pass','{$cfg['webinterface_pass']}') ON DUPLICATE KEY UPDATE `value`=VALUES(`value`)") === false) {
$err_msg = print_r($mysqlcon->errorInfo(), true); $err_lvl = 3;
} else {
enter_logfile($logpath,$timezone,3,sprintf($lang['wichpw3'],getclientip()));
enter_logfile($cfg,3,sprintf($lang['wichpw3'],getclientip()));
$err_msg = $lang['wisvsuc']; $err_lvl = NULL;
}
} elseif(isset($_POST['changepw'])) {

View File

@@ -37,7 +37,7 @@ if (isset($_POST['logout'])) {
exit;
}
if (!isset($_SESSION[$rspathhex.'username']) || $_SESSION[$rspathhex.'username'] != $webuser || $_SESSION[$rspathhex.'password'] != $webpass || $_SESSION[$rspathhex.'clientip'] != getclientip()) {
if (!isset($_SESSION[$rspathhex.'username']) || $_SESSION[$rspathhex.'username'] != $cfg['webinterface_user'] || $_SESSION[$rspathhex.'password'] != $cfg['webinterface_pass'] || $_SESSION[$rspathhex.'clientip'] != getclientip()) {
header("Location: //".$_SERVER['HTTP_HOST'].rtrim(dirname($_SERVER['PHP_SELF']), '/\\'));
exit;
}
@@ -56,24 +56,24 @@ if (($db_csrf = $mysqlcon->query("SELECT * FROM `$dbname`.`csrf_token` WHERE `se
}
if (isset($_POST['update']) && isset($db_csrf[$_POST['csrf_token']])) {
if(($groupslist = $mysqlcon->query("SELECT * FROM `$dbname`.`groups`")->fetchAll(PDO::FETCH_UNIQUE|PDO::FETCH_ASSOC)) === false) {
enter_logfile($logpath,$timezone,1,"Select on DB failed for group check: ".print_r($mysqlcon->errorInfo(), true));
$err_msg = print_r($mysqlcon->errorInfo(), true);
$err_lvl = 3;
}
if(empty($_POST['boost'])) {
$boostarr = null;
if(empty($_POST['rankup_boost_definition'])) {
$cfg['rankup_boost_definition'] = NULL;
} else {
$boostarr = null;
foreach (explode(',', $_POST['boost']) as $entry) {
foreach (explode(',', $_POST['rankup_boost_definition']) as $entry) {
list($key, $value1, $value2) = explode('=>', $entry);
$boostarr[$key] = array("group"=>$key,"factor"=>$value1,"time"=>$value2);
$addnewvalue2[$key] = array("group"=>$key,"factor"=>$value1,"time"=>$value2);
$cfg['rankup_boost_definition'] = $addnewvalue2;
}
}
if(empty($_POST['grouptime'])) {
if(empty($_POST['rankup_definition'])) {
$grouparr = null;
} else {
foreach (explode(',', $_POST['grouptime']) as $entry) {
foreach (explode(',', $_POST['rankup_definition']) as $entry) {
list($time, $groupid) = explode('=>', $entry);
$grouparr[$groupid] = $time;
}
@@ -89,14 +89,14 @@ if (isset($_POST['update']) && isset($db_csrf[$_POST['csrf_token']])) {
$errcnf++;
}
}
foreach($boostarr as $groupid => $value) {
foreach($cfg['rankup_boost_definition'] as $groupid => $value) {
if(!isset($groupslist[$groupid]) && $groupid != NULL) {
$err_msg .= sprintf($lang['upgrp0001'], $groupid, $lang['wiboost']).'<br>';
$err_lvl = 3;
$errcnf++;
}
}
foreach(array_flip(explode(',', $_POST['exceptgroup'])) as $groupid => $value) {
foreach(array_flip(explode(',', $_POST['rankup_excepted_group_id_list'])) as $groupid => $value) {
if(!isset($groupslist[$groupid]) && $groupid != NULL) {
$err_msg .= sprintf($lang['upgrp0001'], $groupid, $lang['wiexgrp']).'<br>';
$err_lvl = 3;
@@ -105,26 +105,26 @@ if (isset($_POST['update']) && isset($db_csrf[$_POST['csrf_token']])) {
}
}
unset($groupslist);
$cfg['rankup_time_assess_mode'] = $_POST['rankup_time_assess_mode'];
$cfg['rankup_excepted_mode'] = $_POST['rankup_excepted_mode'];
$cfg['rankup_excepted_unique_client_id_list'] = $_POST['rankup_excepted_unique_client_id_list'];
$cfg['rankup_excepted_group_id_list'] = $_POST['rankup_excepted_group_id_list'];
$cfg['rankup_excepted_channel_id_list'] = $_POST['rankup_excepted_channel_id_list'];
$cfg['rankup_definition'] = $_POST['rankup_definition'];
$cfg['rankup_boost_definition'] = $_POST['rankup_boost_definition'];
$cfg['rankup_ignore_idle_time'] = $_POST['rankup_ignore_idle_time'];
$substridle = $_POST['substridle'];
$exceptuuid = $_POST['exceptuuid'];
$exceptgroup = $_POST['exceptgroup'];
$exceptcid = $_POST['exceptcid'];
$grouptime = $_POST['grouptime'];
$ignoreidle = $_POST['ignoreidle'];
$resetexcept = $_POST['resetexcept'];
if (isset($_POST['resetbydbchange'])) $resetbydbchange = 1; else $resetbydbchange = 0;
if (isset($_POST['cleanclients'])) $cleanclients = 1; else $cleanclients = 0;
$cleanperiod = $_POST['cleanperiod'];
$boost = $_POST['boost'];
if($_POST['registercid'] == NULL) {
$registercid = 0;
if (isset($_POST['rankup_client_database_id_change_switch'])) $cfg['rankup_client_database_id_change_switch'] = 1; else $cfg['rankup_client_database_id_change_switch'] = 0;
if (isset($_POST['rankup_clean_clients_switch'])) $cfg['rankup_clean_clients_switch'] = 1; else $cfg['rankup_clean_clients_switch'] = 0;
$cfg['rankup_clean_clients_period'] = $_POST['rankup_clean_clients_period'];
if($_POST['teamspeak_verification_channel_id'] == NULL) {
$cfg['teamspeak_verification_channel_id'] = 0;
} else {
$registercid = $_POST['registercid'];
$cfg['teamspeak_verification_channel_id'] = $_POST['teamspeak_verification_channel_id'];
}
if($errcnf == 0) {
if ($mysqlcon->exec("UPDATE `$dbname`.`config` SET `substridle`='$substridle',`exceptuuid`='$exceptuuid',`exceptgroup`='$exceptgroup',`exceptcid`='$exceptcid',`grouptime`='$grouptime',`ignoreidle`='$ignoreidle',`resetbydbchange`='$resetbydbchange',`cleanclients`='$cleanclients',`cleanperiod`='$cleanperiod',`boost`='$boost',`resetexcept`='$resetexcept',`registercid`='$registercid'") === false) {
if ($mysqlcon->exec("INSERT INTO `$dbname`.`cfg_params` (`param`,`value`) VALUES ('rankup_time_assess_mode','{$cfg['rankup_time_assess_mode']}'),('rankup_excepted_mode','{$cfg['rankup_excepted_mode']}'),('rankup_excepted_unique_client_id_list','{$cfg['rankup_excepted_unique_client_id_list']}'),('rankup_excepted_group_id_list','{$cfg['rankup_excepted_group_id_list']}'),('rankup_excepted_channel_id_list','{$cfg['rankup_excepted_channel_id_list']}'),('rankup_definition','{$cfg['rankup_definition']}'),('rankup_ignore_idle_time','{$cfg['rankup_ignore_idle_time']}'),('rankup_client_database_id_change_switch','{$cfg['rankup_client_database_id_change_switch']}'),('rankup_clean_clients_switch','{$cfg['rankup_clean_clients_switch']}'),('rankup_clean_clients_period','{$cfg['rankup_clean_clients_period']}'),('teamspeak_verification_channel_id','{$cfg['teamspeak_verification_channel_id']}'),('rankup_boost_definition','{$cfg['rankup_boost_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 {
@@ -135,11 +135,28 @@ if (isset($_POST['update']) && isset($db_csrf[$_POST['csrf_token']])) {
} else {
$err_msg .= "<br>".$lang['errgrpid'];
}
$config['grouptime'] = $_POST['grouptime'];
$config['exceptuuid'] = $_POST['exceptuuid'];
$config['exceptgroup'] = $_POST['exceptgroup'];
$config['exceptcid'] = $_POST['exceptcid'];
$config['boost'] = $_POST['boost'];
$cfg['rankup_excepted_unique_client_id_list'] = array_flip(explode(',', $cfg['rankup_excepted_unique_client_id_list']));
$cfg['rankup_excepted_group_id_list'] = array_flip(explode(',', $cfg['rankup_excepted_group_id_list']));
$cfg['rankup_excepted_channel_id_list'] = array_flip(explode(',', $cfg['rankup_excepted_channel_id_list']));
if(empty($_POST['rankup_definition'])) {
$cfg['rankup_definition'] = NULL;
} else {
$grouptimearr = explode(',', $_POST['rankup_definition']);
foreach ($grouptimearr as $entry) {
list($key, $value) = explode('=>', $entry);
$addnewvalue1[$key] = $value;
$cfg['rankup_definition'] = $addnewvalue1;
}
}
if(empty($_POST['rankup_boost_definition'])) {
$cfg['rankup_boost_definition'] = NULL;
} else {
foreach (explode(',', $_POST['rankup_boost_definition']) as $entry) {
list($key, $value1, $value2) = explode('=>', $entry);
$addnewvalue2[$key] = array("group"=>$key,"factor"=>$value1,"time"=>$value2);
$cfg['rankup_boost_definition'] = $addnewvalue2;
}
}
} elseif(isset($_POST['update'])) {
echo '<div class="alert alert-danger alert-dismissible">',$lang['errcsrf'],'</div>';
rem_session_ts3($rspathhex);
@@ -161,10 +178,10 @@ if (isset($_POST['update']) && isset($db_csrf[$_POST['csrf_token']])) {
<div class="form-group">
<label class="col-sm-4 control-label" data-toggle="modal" data-target="#wisupidledesc"><?php echo $lang['wisupidle']; ?><i class="help-hover glyphicon glyphicon-question-sign"></i></label>
<div class="col-sm-8">
<select class="selectpicker show-tick form-control basic" name="substridle">
<select class="selectpicker show-tick form-control basic" name="rankup_time_assess_mode">
<?PHP
echo '<option value="0"'; if($substridle=="0") echo " selected=selected"; echo '>',$lang['wishcolot'],'</option>';
echo '<option value="1"'; if($substridle=="1") echo " selected=selected"; echo '>',$lang['wishcolat'],'</option>';
echo '<option value="0"'; if($cfg['rankup_time_assess_mode']=="0") echo " selected=selected"; echo '>',$lang['wishcolot'],'</option>';
echo '<option value="1"'; if($cfg['rankup_time_assess_mode']=="1") echo " selected=selected"; echo '>',$lang['wishcolat'],'</option>';
?>
</select>
</div>
@@ -174,11 +191,11 @@ if (isset($_POST['update']) && isset($db_csrf[$_POST['csrf_token']])) {
<div class="form-group">
<label class="col-sm-4 control-label" data-toggle="modal" data-target="#wiexresdesc"><?php echo $lang['wiexres']; ?><i class="help-hover glyphicon glyphicon-question-sign"></i></label>
<div class="col-sm-8">
<select class="selectpicker show-tick form-control basic" name="resetexcept">
<select class="selectpicker show-tick form-control basic" name="rankup_excepted_mode">
<?PHP
echo '<option value="0"'; if($resetexcept=="0") echo " selected=selected"; echo '>',$lang['wiexres1'],'</option>';
echo '<option value="1"'; if($resetexcept=="1") echo " selected=selected"; echo '>',$lang['wiexres2'],'</option>';
echo '<option value="2"'; if($resetexcept=="2") echo " selected=selected"; echo '>',$lang['wiexres3'],'</option>';
echo '<option value="0"'; if($cfg['rankup_excepted_mode']=="0") echo " selected=selected"; echo '>',$lang['wiexres1'],'</option>';
echo '<option value="1"'; if($cfg['rankup_excepted_mode']=="1") echo " selected=selected"; echo '>',$lang['wiexres2'],'</option>';
echo '<option value="2"'; if($cfg['rankup_excepted_mode']=="2") echo " selected=selected"; echo '>',$lang['wiexres3'],'</option>';
?>
</select>
</div>
@@ -186,21 +203,21 @@ if (isset($_POST['update']) && isset($db_csrf[$_POST['csrf_token']])) {
<div class="form-group">
<label class="col-sm-4 control-label" data-toggle="modal" data-target="#wiexuiddesc"><?php echo $lang['wiexuid']; ?><i class="help-hover glyphicon glyphicon-question-sign"></i></label>
<div class="col-sm-8">
<textarea class="form-control" data-pattern="^([A-Za-z0-9\\\/\+]{27}=,)*([A-Za-z0-9\\\/\+]{27}=)$" data-error="Check all unique IDs are correct and your list do not ends with a comma!" rows="1" name="exceptuuid" maxlength="999"><?php echo $config['exceptuuid']; ?></textarea>
<textarea class="form-control" data-pattern="^([A-Za-z0-9\\\/\+]{27}=,)*([A-Za-z0-9\\\/\+]{27}=)$" data-error="Check all unique IDs are correct and your list do not ends with a comma!" rows="1" name="rankup_excepted_unique_client_id_list" maxlength="999"><?php if(!empty($cfg['rankup_excepted_unique_client_id_list'])) echo implode(',',array_flip($cfg['rankup_excepted_unique_client_id_list'])); ?></textarea>
<div class="help-block with-errors"></div>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label" data-toggle="modal" data-target="#wiexgrpdesc"><?php echo $lang['wiexgrp']; ?><i class="help-hover glyphicon glyphicon-question-sign"></i></label>
<div class="col-sm-8">
<textarea class="form-control" data-pattern="^([0-9]{1,9},)*[0-9]{1,9}$" data-error="Only use digits separated with a comma! Also must the first and last value be digit!" rows="1" name="exceptgroup" maxlength="999"><?php echo $config['exceptgroup']; ?></textarea>
<textarea class="form-control" data-pattern="^([0-9]{1,9},)*[0-9]{1,9}$" data-error="Only use digits separated with a comma! Also must the first and last value be digit!" rows="1" name="rankup_excepted_group_id_list" maxlength="999"><?php if(!empty($cfg['rankup_excepted_group_id_list'])) echo implode(',',array_flip($cfg['rankup_excepted_group_id_list'])); ?></textarea>
<div class="help-block with-errors"></div>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label" data-toggle="modal" data-target="#wiexciddesc"><?php echo $lang['wiexcid']; ?><i class="help-hover glyphicon glyphicon-question-sign"></i></label>
<div class="col-sm-8">
<textarea class="form-control" data-pattern="^([0-9]{1,9},)*[0-9]{1,9}$" data-error="Only use digits separated with a comma! Also must the first and last value be digit!" rows="1" name="exceptcid" maxlength="999"><?php echo $config['exceptcid']; ?></textarea>
<textarea class="form-control" data-pattern="^([0-9]{1,9},)*[0-9]{1,9}$" data-error="Only use digits separated with a comma! Also must the first and last value be digit!" rows="1" name="rankup_excepted_channel_id_list" maxlength="999"><?php if(!empty($cfg['rankup_excepted_channel_id_list'])) echo implode(',',array_flip($cfg['rankup_excepted_channel_id_list'])); ?></textarea>
<div class="help-block with-errors"></div>
</div>
</div>
@@ -210,7 +227,7 @@ if (isset($_POST['update']) && isset($db_csrf[$_POST['csrf_token']])) {
<div class="form-group required-field-block">
<label class="col-sm-4 control-label" data-toggle="modal" data-target="#wigrptimedesc"><?php echo $lang['wigrptime']; ?><i class="help-hover glyphicon glyphicon-question-sign"></i></label>
<div class="col-sm-8">
<textarea class="form-control" data-pattern="^([0-9]{1,9}=>[0-9]{1,9},)*[0-9]{1,9}=>[0-9]{1,9}$" data-error="Wrong definition, please look at description for more details. No comma at ending!" rows="5" name="grouptime" maxlength="5000" required><?php echo $config['grouptime']; ?></textarea>
<textarea class="form-control" data-pattern="^([0-9]{1,9}=>[0-9]{1,9},)*[0-9]{1,9}=>[0-9]{1,9}$" data-error="Wrong definition, please look at description for more details. No comma at ending!" rows="5" name="rankup_definition" maxlength="5000" required><?php $implode_definition = ''; foreach ($cfg['rankup_definition'] as $time => $sgroup) { $implode_definition .= $time."=>".$sgroup.","; } $implode_definition = substr($implode_definition, 0, -1); echo $implode_definition; ?></textarea>
<div class="required-icon"><div class="text">*</div></div>
<div class="help-block with-errors"></div>
</div>
@@ -220,9 +237,9 @@ if (isset($_POST['update']) && isset($db_csrf[$_POST['csrf_token']])) {
<div class="form-group">
<label class="col-sm-4 control-label" data-toggle="modal" data-target="#wiignidledesc"><?php echo $lang['wiignidle']; ?><i class="help-hover glyphicon glyphicon-question-sign"></i></label>
<div class="col-sm-8">
<input type="text" class="form-control" name="ignoreidle" value="<?php echo $ignoreidle; ?>">
<input type="text" class="form-control" name="rankup_ignore_idle_time" value="<?php echo $cfg['rankup_ignore_idle_time']; ?>">
<script>
$("input[name='ignoreidle']").TouchSpin({
$("input[name='rankup_ignore_idle_time']").TouchSpin({
min: 0,
max: 65535,
verticalbuttons: true,
@@ -234,10 +251,10 @@ if (isset($_POST['update']) && isset($db_csrf[$_POST['csrf_token']])) {
<div class="form-group">
<label class="col-sm-4 control-label" data-toggle="modal" data-target="#wichdbiddesc"><?php echo $lang['wichdbid']; ?><i class="help-hover glyphicon glyphicon-question-sign"></i></label>
<div class="col-lg-8">
<?PHP if ($resetbydbchange == 1) {
echo '<input class="switch-animate" type="checkbox" checked data-size="mini" name="resetbydbchange" value="',$resetbydbchange,'">';
<?PHP if ($cfg['rankup_client_database_id_change_switch'] == 1) {
echo '<input class="switch-animate" type="checkbox" checked data-size="mini" name="rankup_client_database_id_change_switch" value="',$cfg['rankup_client_database_id_change_switch'],'">';
} else {
echo '<input class="switch-animate" type="checkbox" data-size="mini" name="resetbydbchange" value="',$resetbydbchange,'">';
echo '<input class="switch-animate" type="checkbox" data-size="mini" name="rankup_client_database_id_change_switch" value="',$cfg['rankup_client_database_id_change_switch'],'">';
} ?>
</div>
</div>
@@ -247,10 +264,10 @@ if (isset($_POST['update']) && isset($db_csrf[$_POST['csrf_token']])) {
<div class="form-group">
<label class="col-sm-4 control-label" data-toggle="modal" data-target="#cleancdesc"><?php echo $lang['cleanc']; ?><i class="help-hover glyphicon glyphicon-question-sign"></i></label>
<div class="col-sm-8">
<?PHP if ($cleanclients == 1) {
echo '<input class="switch-animate" type="checkbox" checked data-size="mini" name="cleanclients" value="',$cleanclients,'">';
<?PHP if ($cfg['rankup_clean_clients_switch'] == 1) {
echo '<input class="switch-animate" type="checkbox" checked data-size="mini" name="rankup_clean_clients_switch" value="',$cfg['rankup_clean_clients_switch'],'">';
} else {
echo '<input class="switch-animate" type="checkbox" data-size="mini" name="cleanclients" value="',$cleanclients,'">';
echo '<input class="switch-animate" type="checkbox" data-size="mini" name="rankup_clean_clients_switch" value="',$cfg['rankup_clean_clients_switch'],'">';
} ?>
</div>
</div>
@@ -258,9 +275,9 @@ if (isset($_POST['update']) && isset($db_csrf[$_POST['csrf_token']])) {
<div class="form-group">
<label class="col-sm-4 control-label" data-toggle="modal" data-target="#cleanpdesc"><?php echo $lang['cleanp']; ?><i class="help-hover glyphicon glyphicon-question-sign"></i></label>
<div class="col-sm-8">
<input type="text" class="form-control" name="cleanperiod" value="<?php echo $cleanperiod; ?>">
<input type="text" class="form-control" name="rankup_clean_clients_period" value="<?php echo $cfg['rankup_clean_clients_period']; ?>">
<script>
$("input[name='cleanperiod']").TouchSpin({
$("input[name='rankup_clean_clients_period']").TouchSpin({
min: 0,
max: 9223372036854775807,
verticalbuttons: true,
@@ -276,9 +293,9 @@ if (isset($_POST['update']) && isset($db_csrf[$_POST['csrf_token']])) {
<div class="form-group">
<label class="col-sm-4 control-label" data-toggle="modal" data-target="#wiverifydesc"><?php echo $lang['wiverify']; ?><i class="help-hover glyphicon glyphicon-question-sign"></i></label>
<div class="col-sm-8">
<input type="text" class="form-control" name="registercid" value="<?php echo $registercid; ?>">
<input type="text" class="form-control" name="teamspeak_verification_channel_id" value="<?php echo $cfg['teamspeak_verification_channel_id']; ?>">
<script>
$("input[name='registercid']").TouchSpin({
$("input[name='teamspeak_verification_channel_id']").TouchSpin({
min: 0,
max: 16777215,
verticalbuttons: true,
@@ -292,7 +309,7 @@ if (isset($_POST['update']) && isset($db_csrf[$_POST['csrf_token']])) {
<div class="form-group">
<label class="col-sm-4 control-label" data-toggle="modal" data-target="#wiboostdesc"><?php echo $lang['wiboost']; ?><i class="help-hover glyphicon glyphicon-question-sign"></i></label>
<div class="col-sm-8">
<textarea class="form-control" data-pattern="^([1-9][0-9]{0,9}=>[0-9]{0,9}=>[1-9][0-9]{0,9},)*[1-9][0-9]{0,9}=>[0-9]{0,9}=>[1-9][0-9]{0,9}$" data-error="Wrong definition, please look at description for more details. No comma at ending!" rows="5" name="boost" maxlength="999"><?php echo $config['boost']; ?></textarea>
<textarea class="form-control" data-pattern="^([1-9][0-9]{0,9}=>[0-9]{0,9}=>[1-9][0-9]{0,9},)*[1-9][0-9]{0,9}=>[0-9]{0,9}=>[1-9][0-9]{0,9}$" data-error="Wrong definition, please look at description for more details. No comma at ending!" rows="5" name="rankup_boost_definition" maxlength="999"><?php $implode_boost = ''; foreach ($cfg['rankup_boost_definition'] as $r) { $implode_boost .= $r['group']."=>".$r['factor']."=>".$r['time'].","; } $implode_boost = substr($implode_boost, 0, -1); echo $implode_boost; ?></textarea>
<div class="help-block with-errors"></div>
</div>
</div>

View File

@@ -37,7 +37,7 @@ if (isset($_POST['logout'])) {
exit;
}
if (!isset($_SESSION[$rspathhex.'username']) || $_SESSION[$rspathhex.'username'] != $webuser || $_SESSION[$rspathhex.'password'] != $webpass || $_SESSION[$rspathhex.'clientip'] != getclientip()) {
if (!isset($_SESSION[$rspathhex.'username']) || $_SESSION[$rspathhex.'username'] != $cfg['webinterface_user'] || $_SESSION[$rspathhex.'password'] != $cfg['webinterface_pass'] || $_SESSION[$rspathhex.'clientip'] != getclientip()) {
header("Location: //".$_SERVER['HTTP_HOST'].rtrim(dirname($_SERVER['PHP_SELF']), '/\\'));
exit;
}

View File

@@ -15,8 +15,8 @@ session_start();
require_once('../other/config.php');
require_once('../other/phpcommand.php');
function enter_logfile($logpath,$timezone,$loglevel,$logtext,$norotate = false) {
$file = $logpath.'ranksystem.log';
function enter_logfile($cfg,$loglevel,$logtext,$norotate = false) {
$file = $cfg['logs_path'].'ranksystem.log';
if ($loglevel == 1) {
$loglevel = " CRITICAL ";
} elseif ($loglevel == 2) {
@@ -31,17 +31,17 @@ function enter_logfile($logpath,$timezone,$loglevel,$logtext,$norotate = false)
$loglevel = " DEBUG ";
}
$loghandle = fopen($file, 'a');
fwrite($loghandle, DateTime::createFromFormat('U.u', number_format(microtime(true), 6, '.', ''))->setTimeZone(new DateTimeZone($timezone))->format("Y-m-d H:i:s.u ").$loglevel.$logtext."\n");
fwrite($loghandle, DateTime::createFromFormat('U.u', number_format(microtime(true), 6, '.', ''))->setTimeZone(new DateTimeZone($cfg['logs_timezone']))->format("Y-m-d H:i:s.u ").$loglevel.$logtext."\n");
fclose($loghandle);
if($norotate == false && filesize($file) > 5242880) {
$loghandle = fopen($file, 'a');
fwrite($loghandle, DateTime::createFromFormat('U.u', number_format(microtime(true), 6, '.', ''))->setTimeZone(new DateTimeZone($timezone))->format("Y-m-d H:i:s.u ")." NOTICE Logfile filesie of 5 MiB reached.. Rotate logfile.\n");
fwrite($loghandle, DateTime::createFromFormat('U.u', number_format(microtime(true), 6, '.', ''))->setTimeZone(new DateTimeZone($cfg['logs_timezone']))->format("Y-m-d H:i:s.u ")." NOTICE Logfile filesie of 5 MiB reached.. Rotate logfile.\n");
fclose($loghandle);
$file2 = "$file.old";
if (file_exists($file2)) unlink($file2);
rename($file, $file2);
$loghandle = fopen($file, 'a');
fwrite($loghandle, DateTime::createFromFormat('U.u', number_format(microtime(true), 6, '.', ''))->setTimeZone(new DateTimeZone($timezone))->format("Y-m-d H:i:s.u ")." NOTICE Rotated logfile...\n");
fwrite($loghandle, DateTime::createFromFormat('U.u', number_format(microtime(true), 6, '.', ''))->setTimeZone(new DateTimeZone($cfg['logs_timezone']))->format("Y-m-d H:i:s.u ")." NOTICE Rotated logfile...\n");
fclose($loghandle);
}
}
@@ -63,38 +63,35 @@ function getclientip() {
return false;
}
if(($last_access = $mysqlcon->query("SELECT `last_access`,`count_access` FROM `$dbname`.`config`")->fetchAll()) === false) {
$err_msg .= print_r($mysqlcon->errorInfo(), true);
}
if(($last_access[0]['last_access'] + 1) >= time()) {
$again = $last_access[0]['last_access'] + 2 - time();
$err_msg = sprintf($lang['errlogin2'],$again);
if(($cfg['webinterface_access_last'] + 1) >= time()) {
$waittime = $cfg['webinterface_access_last'] + 2 - time();
$err_msg = sprintf($lang['errlogin2'],$waittime);
$err_lvl = 3;
} elseif ($last_access[0]['count_access'] >= 10) {
enter_logfile($logpath,$timezone,3,sprintf($lang['brute'], getclientip()));
} elseif ($cfg['webinterface_access_count'] >= 10) {
enter_logfile($cfg,3,sprintf($lang['brute'], getclientip()));
$err_msg = $lang['errlogin3'];
$err_lvl = 3;
$bantime = time() + 299;
if($mysqlcon->exec("UPDATE `$dbname`.`config` SET `last_access`='$bantime',`count_access`='0'") === false) { }
} elseif (isset($_POST['username']) && $_POST['username'] == $webuser && password_verify($_POST['password'], $webpass)) {
$_SESSION[$rspathhex.'username'] = $webuser;
$_SESSION[$rspathhex.'password'] = $webpass;
if($mysqlcon->exec("INSERT INTO `$dbname`.`cfg_params` (`param`,`value`) VALUES ('webinterface_access_last','{$bantime}'),('webinterface_access_count','0') ON DUPLICATE KEY UPDATE `value`=VALUES(`value`)") === false) { }
} elseif (isset($_POST['username']) && $_POST['username'] == $cfg['webinterface_user'] && password_verify($_POST['password'], $cfg['webinterface_pass'])) {
$_SESSION[$rspathhex.'username'] = $cfg['webinterface_user'];
$_SESSION[$rspathhex.'password'] = $cfg['webinterface_pass'];
$_SESSION[$rspathhex.'clientip'] = getclientip();
$_SESSION[$rspathhex.'newversion'] = $newversion;
enter_logfile($logpath,$timezone,6,sprintf($lang['brute2'], getclientip()));
if($mysqlcon->exec("UPDATE `$dbname`.`config` SET `count_access`='0'") === false) { }
$_SESSION[$rspathhex.'newversion'] = $cfg['version_latest_available'];
enter_logfile($cfg,6,sprintf($lang['brute2'], getclientip()));
if($mysqlcon->exec("INSERT INTO `$dbname`.`cfg_params` (`param`,`value`) VALUES ('webinterface_access_count','0') ON DUPLICATE KEY UPDATE `value`=VALUES(`value`)") === false) { }
header("Location: //".$_SERVER['HTTP_HOST'].rtrim(dirname($_SERVER['PHP_SELF']), '/\\')."/bot.php");
exit;
} elseif(isset($_POST['username'])) {
$nowtime = time();
enter_logfile($logpath,$timezone,5,sprintf($lang['brute1'], getclientip(), $_POST['username']));
if($mysqlcon->exec("UPDATE `$dbname`.`config` SET `last_access`='$nowtime',`count_access`=`count_access` + 1") === false) { }
enter_logfile($cfg,5,sprintf($lang['brute1'], getclientip(), $_POST['username']));
$cfg['webinterface_access_count']++;
if($mysqlcon->exec("INSERT INTO `$dbname`.`cfg_params` (`param`,`value`) VALUES ('webinterface_access_last','{$nowtime}'),('webinterface_access_count','{$cfg['webinterface_access_count']}') ON DUPLICATE KEY UPDATE `value`=VALUES(`value`)") === false) { }
$err_msg = $lang['errlogin'];
$err_lvl = 3;
}
if(isset($_SESSION[$rspathhex.'username']) && $_SESSION[$rspathhex.'username'] == $webuser && $_SESSION[$rspathhex.'password'] == $webpass) {
if(isset($_SESSION[$rspathhex.'username']) && $_SESSION[$rspathhex.'username'] == $cfg['webinterface_user'] && $_SESSION[$rspathhex.'password'] == $cfg['webinterface_pass']) {
header("Location: //".$_SERVER['HTTP_HOST'].rtrim(dirname($_SERVER['PHP_SELF']), '/\\')."/bot.php");
exit;
}

View File

@@ -37,7 +37,7 @@ if (isset($_POST['logout'])) {
exit;
}
if (!isset($_SESSION[$rspathhex.'username']) || $_SESSION[$rspathhex.'username'] != $webuser || $_SESSION[$rspathhex.'password'] != $webpass || $_SESSION[$rspathhex.'clientip'] != getclientip()) {
if (!isset($_SESSION[$rspathhex.'username']) || $_SESSION[$rspathhex.'username'] != $cfg['webinterface_user'] || $_SESSION[$rspathhex.'password'] != $cfg['webinterface_pass'] || $_SESSION[$rspathhex.'clientip'] != getclientip()) {
header("Location: //".$_SERVER['HTTP_HOST'].rtrim(dirname($_SERVER['PHP_SELF']), '/\\'));
exit;
}
@@ -56,14 +56,14 @@ if (($db_csrf = $mysqlcon->query("SELECT * FROM `$dbname`.`csrf_token` WHERE `se
}
if (isset($_POST['update']) && isset($db_csrf[$_POST['csrf_token']])) {
$rankupmsg = addslashes($_POST['rankupmsg']);
$servernews = addslashes($_POST['servernews']);
$nextupinfomsg1 = addslashes($_POST['nextupinfomsg1']);
$nextupinfomsg2 = addslashes($_POST['nextupinfomsg2']);
$nextupinfomsg3 = addslashes($_POST['nextupinfomsg3']);
$nextupinfo = $_POST['nextupinfo'];
if (isset($_POST['msgtouser'])) $msgtouser = 1; else $msgtouser = 0;
if ($mysqlcon->exec("UPDATE `$dbname`.`config` SET `msgtouser`='$msgtouser',`rankupmsg`='$rankupmsg',`servernews`='$servernews',`nextupinfo`='$nextupinfo',`nextupinfomsg1`='$nextupinfomsg1',`nextupinfomsg2`='$nextupinfomsg2',`nextupinfomsg3`='$nextupinfomsg3'") === false) {
$cfg['rankup_message_to_user'] = addslashes($_POST['rankup_message_to_user']);
$cfg['stats_server_news'] = addslashes($_POST['stats_server_news']);
$cfg['rankup_next_message_1'] = addslashes($_POST['rankup_next_message_1']);
$cfg['rankup_next_message_2'] = addslashes($_POST['rankup_next_message_2']);
$cfg['rankup_next_message_3'] = addslashes($_POST['rankup_next_message_3']);
$cfg['rankup_next_message_mode'] = $_POST['rankup_next_message_mode'];
if (isset($_POST['rankup_message_to_user_switch'])) $cfg['rankup_message_to_user_switch'] = 1; else $cfg['rankup_message_to_user_switch'] = 0;
if ($mysqlcon->exec("INSERT INTO `$dbname`.`cfg_params` (`param`,`value`) VALUES ('rankup_message_to_user_switch','{$cfg['rankup_message_to_user_switch']}'),('rankup_message_to_user','{$cfg['rankup_message_to_user']}'),('stats_server_news','{$cfg['stats_server_news']}'),('rankup_next_message_mode','{$cfg['rankup_next_message_mode']}'),('rankup_next_message_1','{$cfg['rankup_next_message_1']}'),('rankup_next_message_2','{$cfg['rankup_next_message_2']}'),('rankup_next_message_3','{$cfg['rankup_next_message_3']}') 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 {
@@ -71,11 +71,11 @@ if (isset($_POST['update']) && isset($db_csrf[$_POST['csrf_token']])) {
type="submit" class="btn btn-primary" name="restart"><i class="fa fa-fw fa-refresh"></i>&nbsp;'.$lang['wibot7'].'</button></form>');
$err_lvl = NULL;
}
$rankupmsg = $_POST['rankupmsg'];
$servernews = $_POST['servernews'];
$nextupinfomsg1 = $_POST['nextupinfomsg1'];
$nextupinfomsg2 = $_POST['nextupinfomsg2'];
$nextupinfomsg3 = $_POST['nextupinfomsg3'];
$cfg['rankup_message_to_user'] = $_POST['rankup_message_to_user'];
$cfg['stats_server_news'] = $_POST['stats_server_news'];
$cfg['rankup_next_message_1'] = $_POST['rankup_next_message_1'];
$cfg['rankup_next_message_2'] = $_POST['rankup_next_message_2'];
$cfg['rankup_next_message_3'] = $_POST['rankup_next_message_3'];
} elseif(isset($_POST['update'])) {
echo '<div class="alert alert-danger alert-dismissible">',$lang['errcsrf'],'</div>';
rem_session_ts3($rspathhex);
@@ -101,17 +101,17 @@ if (isset($_POST['update']) && isset($db_csrf[$_POST['csrf_token']])) {
<div class="form-group">
<label class="col-sm-4 control-label" data-toggle="modal" data-target="#wimsgusrdesc"><?php echo $lang['wimsgusr']; ?><i class="help-hover glyphicon glyphicon-question-sign"></i></label>
<div class="col-sm-8">
<?PHP if ($msgtouser == 1) {
echo '<input id="switch-animate" type="checkbox" checked data-size="mini" name="msgtouser" value="',$msgtouser,'">';
<?PHP if ($cfg['rankup_message_to_user_switch'] == 1) {
echo '<input id="switch-animate" type="checkbox" checked data-size="mini" name="rankup_message_to_user_switch" value="',$cfg['rankup_message_to_user_switch'],'">';
} else {
echo '<input id="switch-animate" type="checkbox" data-size="mini" name="msgtouser" value="',$msgtouser,'">';
echo '<input id="switch-animate" type="checkbox" data-size="mini" name="rankup_message_to_user_switch" value="',$cfg['rankup_message_to_user_switch'],'">';
} ?>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label" data-toggle="modal" data-target="#wimsgmsgdesc"><?php echo $lang['wimsgmsg']; ?><i class="help-hover glyphicon glyphicon-question-sign"></i></label>
<div class="col-sm-8">
<textarea class="form-control" rows="5" name="rankupmsg" maxlength="500"><?php echo $rankupmsg; ?></textarea>
<textarea class="form-control" rows="5" name="rankup_message_to_user" maxlength="500"><?php echo $cfg['rankup_message_to_user']; ?></textarea>
</div>
</div>
</div>
@@ -120,7 +120,7 @@ if (isset($_POST['update']) && isset($db_csrf[$_POST['csrf_token']])) {
<div class="form-group">
<label class="col-sm-4 control-label" data-toggle="modal" data-target="#wimsgsndesc"><?php echo $lang['wimsgsn']; ?><i class="help-hover glyphicon glyphicon-question-sign"></i></label>
<div class="col-sm-8">
<textarea class="form-control" rows="15" name="servernews" maxlength="5000"><?php echo $servernews; ?></textarea>
<textarea class="form-control" rows="15" name="stats_server_news" maxlength="5000"><?php echo $cfg['stats_server_news']; ?></textarea>
</div>
</div>
</div>
@@ -131,11 +131,11 @@ if (isset($_POST['update']) && isset($db_csrf[$_POST['csrf_token']])) {
<div class="form-group">
<label class="col-sm-4 control-label" data-toggle="modal" data-target="#winxinfodesc"><?php echo $lang['winxinfo']; ?><i class="help-hover glyphicon glyphicon-question-sign"></i></label>
<div class="col-sm-8">
<select class="selectpicker show-tick form-control" id="basic" name="nextupinfo">
<select class="selectpicker show-tick form-control" id="basic" name="rankup_next_message_mode">
<?PHP
echo '<option value="0"'; if($nextupinfo=="0") echo " selected=selected"; echo '>',$lang['winxmode1'],'</option>';
echo '<option value="1"'; if($nextupinfo=="1") echo " selected=selected"; echo '>',$lang['winxmode2'],'</option>';
echo '<option value="2"'; if($nextupinfo=="2") echo " selected=selected"; echo '>',$lang['winxmode3'],'</option>';
echo '<option value="0"'; if($cfg['rankup_next_message_mode']=="0") echo " selected=selected"; echo '>',$lang['winxmode1'],'</option>';
echo '<option value="1"'; if($cfg['rankup_next_message_mode']=="1") echo " selected=selected"; echo '>',$lang['winxmode2'],'</option>';
echo '<option value="2"'; if($cfg['rankup_next_message_mode']=="2") echo " selected=selected"; echo '>',$lang['winxmode3'],'</option>';
?>
</select>
</div>
@@ -143,19 +143,19 @@ if (isset($_POST['update']) && isset($db_csrf[$_POST['csrf_token']])) {
<div class="form-group">
<label class="col-sm-4 control-label" data-toggle="modal" data-target="#winxmsgdesc1"><?php echo $lang['winxmsg1']; ?><i class="help-hover glyphicon glyphicon-question-sign"></i></label>
<div class="col-sm-8">
<textarea class="form-control" rows="5" name="nextupinfomsg1" maxlength="500"><?php echo $nextupinfomsg1; ?></textarea>
<textarea class="form-control" rows="5" name="rankup_next_message_1" maxlength="500"><?php echo $cfg['rankup_next_message_1']; ?></textarea>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label" data-toggle="modal" data-target="#winxmsgdesc2"><?php echo $lang['winxmsg2']; ?><i class="help-hover glyphicon glyphicon-question-sign"></i></label>
<div class="col-sm-8">
<textarea class="form-control" rows="5" name="nextupinfomsg2" maxlength="500"><?php echo $nextupinfomsg2; ?></textarea>
<textarea class="form-control" rows="5" name="rankup_next_message_2" maxlength="500"><?php echo $cfg['rankup_next_message_2']; ?></textarea>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label" data-toggle="modal" data-target="#winxmsgdesc3"><?php echo $lang['winxmsg3']; ?><i class="help-hover glyphicon glyphicon-question-sign"></i></label>
<div class="col-sm-8">
<textarea class="form-control" rows="5" name="nextupinfomsg3" maxlength="500"><?php echo $nextupinfomsg3; ?></textarea>
<textarea class="form-control" rows="5" name="rankup_next_message_3" maxlength="500"><?php echo $cfg['rankup_next_message_3']; ?></textarea>
</div>
</div>
</div>

View File

@@ -8,16 +8,16 @@ if((time() - $job_check['last_update']['timestamp']) < 259200 && !isset($_SESSIO
}
?>
<!DOCTYPE html>
<html lang="<?PHP echo $language; ?>">
<html lang="<?PHP echo $cfg['default_language']; ?>">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="version" content="<?PHP echo $currvers; ?>">
<meta name="version" content="<?PHP echo $cfg['version_current_using']; ?>">
<link rel="icon" href="../tsicons/rs.png">
<title>TS-N.NET Ranksystem</title>
<link href="../libs/combined_wi.css?v=<?PHP echo $currvers; ?>" rel="stylesheet">
<script src="../libs/combined_wi.js?v=<?PHP echo $currvers; ?>"></script>
<link href="../libs/combined_wi.css?v=<?PHP echo $cfg['version_current_using']; ?>" rel="stylesheet">
<script src="../libs/combined_wi.js?v=<?PHP echo $cfg['version_current_using']; ?>"></script>
<script>
$(function() {
$('.required-icon').tooltip({
@@ -48,8 +48,8 @@ if((time() - $job_check['last_update']['timestamp']) < 259200 && !isset($_SESSIO
<div id="wrapper">
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-header">
<a class="navbar-brand" href="index.php">TSN Ranksystem - Webinterface <?PHP echo $currvers;?></a>
<?PHP if(isset($_SESSION[$rspathhex.'newversion']) && version_compare($_SESSION[$rspathhex.'newversion'], $currvers, '>') && $_SESSION[$rspathhex.'newversion'] != '') {
<a class="navbar-brand" href="index.php">TSN Ranksystem - Webinterface <?PHP echo $cfg['version_current_using'];?></a>
<?PHP if(isset($_SESSION[$rspathhex.'newversion']) && version_compare($_SESSION[$rspathhex.'newversion'], $cfg['version_current_using'], '>') && $_SESSION[$rspathhex.'newversion'] != '') {
echo '<a class="navbar-brand" href="//ts-n.net/ranksystem.php?changelog" target="_blank">'.$lang['winav9'].' ['.$_SESSION[$rspathhex.'newversion'].']</a>';
} ?>
</div>
@@ -69,7 +69,7 @@ if((time() - $job_check['last_update']['timestamp']) < 259200 && !isset($_SESSIO
} else {
echo '<li><a href="//',$_SERVER['SERVER_NAME'],':',$_SERVER['SERVER_PORT'],substr(dirname($_SERVER['SCRIPT_NAME']),0,-12),'stats/"><i class="fa fa-fw fa-bar-chart"></i>&nbsp;',$lang['winav6'],'</a></li>';
}
if(isset($_SESSION[$rspathhex.'username']) && $_SESSION[$rspathhex.'username'] == $webuser && $_SESSION[$rspathhex.'password'] == $webpass) { ?>
if(isset($_SESSION[$rspathhex.'username']) && $_SESSION[$rspathhex.'username'] == $cfg['webinterface_user'] && $_SESSION[$rspathhex.'password'] == $cfg['webinterface_pass']) { ?>
<li>
<a href="changepassword.php"><i class="fa fa-lock"></i>&nbsp;<?PHP echo $lang['pass2']; ?></a>
</li>
@@ -96,6 +96,9 @@ if((time() - $job_check['last_update']['timestamp']) < 259200 && !isset($_SESSIO
<li>
<a href="?lang=en"><span class="flag-icon flag-icon-gb"></span>&nbsp;&nbsp;EN - English</a>
</li>
<li>
<a href="?lang=es"><span class="flag-icon flag-icon-es"></span>&nbsp;&nbsp;ES - español</a>
</li>
<li>
<a href="?lang=fr"><span class="flag-icon flag-icon-fr"></span>&nbsp;&nbsp;FR - français</a>
</li>
@@ -169,7 +172,7 @@ if((time() - $job_check['last_update']['timestamp']) < 259200 && !isset($_SESSIO
</div>
</nav>
<?PHP
if($adminuuid==NULL && $_SESSION[$rspathhex.'username'] == $webuser && !isset($err_msg)) {
if($cfg['webinterface_admin_client_unique_id_list'] == NULL && $_SESSION[$rspathhex.'username'] == $cfg['webinterface_user'] && !isset($err_msg)) {
$err_msg = $lang['winav11']; $err_lvl = 3;
}

View File

@@ -37,7 +37,7 @@ if (isset($_POST['logout'])) {
exit;
}
if (!isset($_SESSION[$rspathhex.'username']) || $_SESSION[$rspathhex.'username'] != $webuser || $_SESSION[$rspathhex.'password'] != $webpass || $_SESSION[$rspathhex.'clientip'] != getclientip()) {
if (!isset($_SESSION[$rspathhex.'username']) || $_SESSION[$rspathhex.'username'] != $cfg['webinterface_user'] || $_SESSION[$rspathhex.'password'] != $cfg['webinterface_pass'] || $_SESSION[$rspathhex.'clientip'] != getclientip()) {
header("Location: //".$_SERVER['HTTP_HOST'].rtrim(dirname($_SERVER['PHP_SELF']), '/\\'));
exit;
}
@@ -56,26 +56,19 @@ if (($db_csrf = $mysqlcon->query("SELECT * FROM `$dbname`.`csrf_token` WHERE `se
}
if (isset($_POST['update']) && isset($db_csrf[$_POST['csrf_token']])) {
if (isset($_POST['iphash'])) {
if($iphash != 1) {
$err_msg2 = $lang['wisvinfo1'];
$err_lvl2 = 2;
}
$iphash = 1;
} else {
if($iphash == 1) {
$err_msg2 = $lang['wisvinfo1'];
$err_lvl2 = 2;
}
$iphash = 0;
if ($_POST['rankup_hash_ip_addresses_mode'] != $cfg['rankup_hash_ip_addresses_mode']) {
$err_msg2 = $lang['wisvinfo1'];
$err_lvl2 = 2;
}
$timezone = $_POST['timezone'];
$timeformat = $_POST['dateformat'];
$logpath = addslashes($_POST['logpath']);
$language = $_POST['languagedb'];
$_SESSION[$rspathhex.'language'] = $_POST['languagedb'];
$adminuuid = $_POST['adminuuid'];
if ($mysqlcon->exec("UPDATE `$dbname`.`config` SET `timezone`='$timezone',`dateformat`='$timeformat',`logpath`='$logpath',`language`='$language',`adminuuid`='$adminuuid',`iphash`='$iphash'") === false) {
$cfg['rankup_hash_ip_addresses_mode'] = $_POST['rankup_hash_ip_addresses_mode'];
$cfg['logs_timezone'] = $_POST['logs_timezone'];
$cfg['default_date_format'] = $_POST['default_date_format'];
$cfg['logs_path'] = addslashes($_POST['logs_path']);
$cfg['default_language'] = $_SESSION[$rspathhex.'language'] = $_POST['default_language'];
unset($lang); $lang = set_language($cfg['default_language']);
$cfg['webinterface_admin_client_unique_id_list'] = $_POST['webinterface_admin_client_unique_id_list'];
if ($mysqlcon->exec("INSERT INTO `$dbname`.`cfg_params` (`param`,`value`) VALUES ('logs_timezone','{$cfg['logs_timezone']}'),('default_date_format','{$cfg['default_date_format']}'),('logs_path','{$cfg['logs_path']}'),('default_language','{$cfg['default_language']}'),('webinterface_admin_client_unique_id_list','{$cfg['webinterface_admin_client_unique_id_list']}'),('rankup_hash_ip_addresses_mode','{$cfg['rankup_hash_ip_addresses_mode']}') 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 {
@@ -83,29 +76,31 @@ if (isset($_POST['update']) && isset($db_csrf[$_POST['csrf_token']])) {
type="submit" class="btn btn-primary" name="restart"><i class="fa fa-fw fa-refresh"></i>&nbsp;'.$lang['wibot7'].'</button></form>');
$err_lvl = NULL;
}
$logpath = $_POST['logpath'];
$config['adminuuid'] = $_POST['adminuuid'];
if(!isset($language) || $language == "en") {
$cfg['webinterface_admin_client_unique_id_list'] = array_flip(explode(',', $cfg['webinterface_admin_client_unique_id_list']));
$cfg['logs_path'] = $_POST['logs_path'];
if(!isset($cfg['default_language']) || $cfg['default_language'] == "en") {
require_once(substr(dirname(__FILE__),0,-12).'languages/core_en.php');
} elseif($language == "ar") {
} elseif($cfg['default_language'] == "ar") {
require_once(substr(dirname(__FILE__),0,-12).'languages/core_ar.php');
} elseif($language == "cz") {
} elseif($cfg['default_language'] == "cz") {
require_once(substr(dirname(__FILE__),0,-12).'languages/core_cz.php');
} elseif($language == "de") {
} elseif($cfg['default_language'] == "de") {
require_once(substr(dirname(__FILE__),0,-12).'languages/core_de.php');
} elseif($language == "fr") {
} elseif($cfg['default_language'] == "es") {
require_once(substr(dirname(__FILE__),0,-12).'languages/core_es.php');
} elseif($cfg['default_language'] == "fr") {
require_once(substr(dirname(__FILE__),0,-12).'languages/core_fr.php');
} elseif($language == "it") {
} elseif($cfg['default_language'] == "it") {
require_once(substr(dirname(__FILE__),0,-12).'languages/core_it.php');
} elseif($language == "nl") {
} elseif($cfg['default_language'] == "nl") {
require_once(substr(dirname(__FILE__),0,-12).'languages/core_nl.php');
} elseif($language == "pl") {
} elseif($cfg['default_language'] == "pl") {
require_once(substr(dirname(__FILE__),0,-12).'languages/core_pl.php');
} elseif($language == "ro") {
} elseif($cfg['default_language'] == "ro") {
require_once(substr(dirname(__FILE__),0,-12).'languages/core_ro.php');
} elseif($language == "ru") {
} elseif($cfg['default_language'] == "ru") {
require_once(substr(dirname(__FILE__),0,-12).'languages/core_ru.php');
} elseif($language == "pt") {
} elseif($cfg['default_language'] == "pt") {
require_once(substr(dirname(__FILE__),0,-12).'languages/core_pt.php');
}
} elseif(isset($_POST['update'])) {
@@ -132,12 +127,12 @@ if (isset($_POST['update']) && isset($db_csrf[$_POST['csrf_token']])) {
<div class="form-group">
<label class="col-sm-4 control-label" data-toggle="modal" data-target="#witimedesc"><?php echo $lang['witime']; ?><i class="help-hover glyphicon glyphicon-question-sign"></i></label>
<div class="col-sm-8">
<select class="selectpicker show-tick form-control" data-live-search="true" name="timezone">
<select class="selectpicker show-tick form-control" data-live-search="true" name="logs_timezone">
<?PHP
$timezonearr = DateTimeZone::listIdentifiers();
foreach ($timezonearr as $timez) {
if ($timez == $timezone) {
echo '<option value="'.$timezone,'" selected=selected>',$timezone,'</option>';
if ($timez == $cfg['logs_timezone']) {
echo '<option value="'.$cfg['logs_timezone'],'" selected=selected>',$cfg['logs_timezone'],'</option>';
} else {
echo '<option value="',$timez,'">',$timez,'</option>';
}
@@ -149,13 +144,13 @@ if (isset($_POST['update']) && isset($db_csrf[$_POST['csrf_token']])) {
<div class="form-group">
<label class="col-sm-4 control-label" data-toggle="modal" data-target="#widaformdesc"><?php echo $lang['widaform']; ?><i class="help-hover glyphicon glyphicon-question-sign"></i></label>
<div class="col-sm-8">
<input type="text" class="form-control" name="dateformat" value="<?php echo $timeformat; ?>">
<input type="text" class="form-control" name="default_date_format" value="<?php echo $cfg['default_date_format']; ?>">
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label" data-toggle="modal" data-target="#wilogdesc"><?php echo $lang['wilog']; ?><i class="help-hover glyphicon glyphicon-question-sign"></i></label>
<div class="col-sm-8 required-field-block">
<input type="text" class="form-control" data-pattern=".*(\/|\\)$" data-error="The Logpath must end with / or \" name="logpath" value="<?php echo $logpath; ?>" required>
<input type="text" class="form-control" data-pattern=".*(\/|\\)$" data-error="The Logpath must end with / or \" name="logs_path" value="<?php echo $cfg['logs_path']; ?>" required>
<div class="help-block with-errors"></div>
<div class="required-icon"><div class="text">*</div></div>
</div>
@@ -163,19 +158,20 @@ if (isset($_POST['update']) && isset($db_csrf[$_POST['csrf_token']])) {
<div class="form-group">
<label class="col-sm-4 control-label" data-toggle="modal" data-target="#wivlangdesc"><?php echo $lang['wivlang']; ?><i class="help-hover glyphicon glyphicon-question-sign"></i></label>
<div class="col-sm-8">
<select class="selectpicker show-tick form-control" name="languagedb">
<select class="selectpicker show-tick form-control" name="default_language">
<?PHP
echo '<option data-subtext="العربية" value="ar"'.($language === 'ar' ? ' selected="selected"' : '').'>AR</option>';
echo '<option data-subtext="čeština" value="cz"'.($language === 'cz' ? ' selected="selected"' : '').'>CZ</option>';
echo '<option data-subtext="Deutsch" value="de"'.($language === 'de' ? ' selected="selected"' : '').'>DE</option>';
echo '<option data-subtext="English" value="en"'.($language === 'en' ? ' selected="selected"' : '').'>EN</option>';
echo '<option data-subtext="français" value="fr"'.($language === 'fr' ? ' selected="selected"' : '').'>FR</option>';
echo '<option data-subtext="Italiano" value="it"'.($language === 'it' ? ' selected="selected"' : '').'>IT</option>';
echo '<option data-subtext="Nederlands" value="nl"'.($language === 'nl' ? ' selected="selected"' : '').'>NL</option>';
echo '<option data-subtext="polski" value="pl"'.($language === 'pl' ? ' selected="selected"' : '').'>PL</option>';
echo '<option data-subtext="Română" value="ro"'.($language === 'ro' ? ' selected="selected"' : '').'>RO</option>';
echo '<option data-subtext="Pусский" value="ru"'.($language === 'ru' ? ' selected="selected"' : '').'>RU</option>';
echo '<option data-subtext="Português" value="pt"'.($language === 'pt' ? ' selected="selected"' : '').'>PT</option>';
echo '<option data-subtext="العربية" value="ar"'.($cfg['default_language'] === 'ar' ? ' selected="selected"' : '').'>AR</option>';
echo '<option data-subtext="čeština" value="cz"'.($cfg['default_language'] === 'cz' ? ' selected="selected"' : '').'>CZ</option>';
echo '<option data-subtext="Deutsch" value="de"'.($cfg['default_language'] === 'de' ? ' selected="selected"' : '').'>DE</option>';
echo '<option data-subtext="English" value="en"'.($cfg['default_language'] === 'en' ? ' selected="selected"' : '').'>EN</option>';
echo '<option data-subtext="español" value="es"'.($cfg['default_language'] === 'es' ? ' selected="selected"' : '').'>ES</option>';
echo '<option data-subtext="français" value="fr"'.($cfg['default_language'] === 'fr' ? ' selected="selected"' : '').'>FR</option>';
echo '<option data-subtext="Italiano" value="it"'.($cfg['default_language'] === 'it' ? ' selected="selected"' : '').'>IT</option>';
echo '<option data-subtext="Nederlands" value="nl"'.($cfg['default_language'] === 'nl' ? ' selected="selected"' : '').'>NL</option>';
echo '<option data-subtext="polski" value="pl"'.($cfg['default_language'] === 'pl' ? ' selected="selected"' : '').'>PL</option>';
echo '<option data-subtext="Română" value="ro"'.($cfg['default_language'] === 'ro' ? ' selected="selected"' : '').'>RO</option>';
echo '<option data-subtext="Pусский" value="ru"'.($cfg['default_language'] === 'ru' ? ' selected="selected"' : '').'>RU</option>';
echo '<option data-subtext="Português" value="pt"'.($cfg['default_language'] === 'pt' ? ' selected="selected"' : '').'>PT</option>';
?>
</select>
</div>
@@ -185,8 +181,8 @@ if (isset($_POST['update']) && isset($db_csrf[$_POST['csrf_token']])) {
<div class="form-group">
<label class="col-sm-4 control-label" data-toggle="modal" data-target="#wiadmuuiddesc"><?php echo $lang['wiadmuuid']; ?><i class="help-hover glyphicon glyphicon-question-sign"></i></label>
<div class="col-sm-8 required-field-block">
<textarea class="form-control" data-pattern="^([A-Za-z0-9\\\/\+]{27}=,)*([A-Za-z0-9\\\/\+]{27}=)$" data-error="Check all unique IDs are correct and your list do not ends with a comma!" rows="1" name="adminuuid" maxlength="500"><?php echo $config['adminuuid']; ?></textarea>
<div class="help-block with-errors"></div>
<textarea class="form-control" data-pattern="^([A-Za-z0-9\\\/\+]{27}=,)*([A-Za-z0-9\\\/\+]{27}=)$" data-error="Check all unique IDs are correct and your list do not ends with a comma!" rows="1" name="webinterface_admin_client_unique_id_list" maxlength="500"><?php if(!empty($cfg['webinterface_admin_client_unique_id_list'])) echo implode(',',array_flip($cfg['webinterface_admin_client_unique_id_list'])); ?></textarea>
<div class="help-block with-errors"></div>
<div class="required-icon"><div class="text">*</div></div>
</div>
</div>
@@ -194,11 +190,14 @@ if (isset($_POST['update']) && isset($db_csrf[$_POST['csrf_token']])) {
<div class="form-group">
<label class="col-sm-4 control-label" data-toggle="modal" data-target="#wishcolhadesc"><?php echo $lang['wishcolha']; ?><i class="help-hover glyphicon glyphicon-question-sign"></i></label>
<div class="col-sm-8">
<?PHP if ($iphash == 1) {
echo '<input class="switch-animate" type="checkbox" checked data-size="mini" name="iphash" value="',$iphash,'">';
} else {
echo '<input class="switch-animate" type="checkbox" data-size="mini" name="iphash" value="',$iphash,'">';
} ?>
<select class="selectpicker show-tick form-control basic" name="rankup_hash_ip_addresses_mode">
<?PHP
echo '<option data-subtext="[recommended]" value="2"'; if($cfg['rankup_hash_ip_addresses_mode']=="2") echo " selected=selected"; echo '>',$lang['wishcolha2'],'</option>';
echo '<option value="1"'; if($cfg['rankup_hash_ip_addresses_mode']=="1") echo " selected=selected"; echo '>',$lang['wishcolha1'],'</option>';
echo '<option data-divider="true">&nbsp;</option>';
echo '<option value="0"'; if($cfg['rankup_hash_ip_addresses_mode']=="0") echo " selected=selected"; echo '>',$lang['wishcolha0'],'</option>';
?>
</select>
</div>
</div>
</div>

View File

@@ -15,8 +15,8 @@ session_start();
require_once('../other/config.php');
require_once('../other/phpcommand.php');
function enter_logfile($logpath,$timezone,$loglevel,$logtext) {
$file = $logpath.'ranksystem.log';
function enter_logfile($cfg,$loglevel,$logtext,$norotate = false) {
$file = $cfg['logs_path'].'ranksystem.log';
if ($loglevel == 1) {
$loglevel = " CRITICAL ";
} elseif ($loglevel == 2) {
@@ -27,27 +27,22 @@ function enter_logfile($logpath,$timezone,$loglevel,$logtext) {
$loglevel = " NOTICE ";
} elseif ($loglevel == 5) {
$loglevel = " INFO ";
} elseif ($loglevel == 6) {
$loglevel = " DEBUG ";
}
$input = DateTime::createFromFormat('U.u', number_format(microtime(true), 6, '.', ''))->setTimeZone(new DateTimeZone($timezone))->format("Y-m-d H:i:s.u ").$loglevel.$logtext."\n";
$loghandle = fopen($file, 'a');
fwrite($loghandle, $input);
if (filesize($file) > 5242880) {
fwrite($loghandle, DateTime::createFromFormat('U.u', number_format(microtime(true), 6, '.', ''))->setTimeZone(new DateTimeZone($timezone))->format("Y-m-d H:i:s.u ")." NOTICE Logfile filesie of 5 MiB reached.. Rotate logfile.\n");
fwrite($loghandle, DateTime::createFromFormat('U.u', number_format(microtime(true), 6, '.', ''))->setTimeZone(new DateTimeZone($timezone))->format("Y-m-d H:i:s.u ")." NOTICE Restart Bot to continue with new log file...\n");
fwrite($loghandle, DateTime::createFromFormat('U.u', number_format(microtime(true), 6, '.', ''))->setTimeZone(new DateTimeZone($cfg['logs_timezone']))->format("Y-m-d H:i:s.u ").$loglevel.$logtext."\n");
fclose($loghandle);
if($norotate == false && filesize($file) > 5242880) {
$loghandle = fopen($file, 'a');
fwrite($loghandle, DateTime::createFromFormat('U.u', number_format(microtime(true), 6, '.', ''))->setTimeZone(new DateTimeZone($cfg['logs_timezone']))->format("Y-m-d H:i:s.u ")." NOTICE Logfile filesie of 5 MiB reached.. Rotate logfile.\n");
fclose($loghandle);
$file2 = "$file.old";
if (file_exists($file2)) unlink($file2);
rename($file, $file2);
if (substr(php_uname(), 0, 7) == "Windows") {
exec("del /F ".substr(__DIR__,0,-12).'logs/pid');
$WshShell = new COM("WScript.Shell");
$oExec = $WshShell->Run("cmd /C ".$phpcommand." ".substr(__DIR__,0,-12)."worker.php start", 0, false);
exit;
} else {
exec("rm -f ".substr(__DIR__,0,-12).'logs/pid');
exec($phpcommand." ".substr(__DIR__,0,-12)."worker.php start");
exit;
}
$loghandle = fopen($file, 'a');
fwrite($loghandle, DateTime::createFromFormat('U.u', number_format(microtime(true), 6, '.', ''))->setTimeZone(new DateTimeZone($cfg['logs_timezone']))->format("Y-m-d H:i:s.u ")." NOTICE Rotated logfile...\n");
fclose($loghandle);
}
}
@@ -68,7 +63,7 @@ function getclientip() {
return false;
}
if(($last_access = $mysqlcon->query("SELECT `last_access`,`count_access` FROM `$dbname`.`config`")->fetchAll()) === false) {
if ($last_access = $mysqlcon->query("SELECT * FROM `$dbname`.`cfg_params` WHERE `param` IN ('webinterface_access_last','webinterface_access_count')")->fetchAll(PDO::FETCH_KEY_PAIR) === false) {
$err_msg .= print_r($mysqlcon->errorInfo(), true);
}
@@ -85,49 +80,48 @@ if (($db_csrf = $mysqlcon->query("SELECT * FROM `$dbname`.`csrf_token` WHERE `se
$err_lvl = 3;
}
if (($last_access[0]['last_access'] + 1) >= time()) {
$again = $last_access[0]['last_access'] + 2 - time();
if (($last_access['webinterface_access_last'] + 1) >= time()) {
$again = $last_access['webinterface_access_last'] + 2 - time();
$err_msg = sprintf($lang['errlogin2'],$again);
$err_lvl = 3;
} elseif (isset($_POST['resetpw']) && isset($db_csrf[$_POST['csrf_token']]) && ($adminuuid==NULL || count($adminuuid) == 0)) {
} elseif (isset($_POST['resetpw']) && isset($db_csrf[$_POST['csrf_token']]) && ($cfg['webinterface_admin_client_unique_id_list']==NULL || count($cfg['webinterface_admin_client_unique_id_list']) == 0)) {
$err_msg = $lang['wirtpw1']; $err_lvl=3;
} elseif (isset($_POST['resetpw']) && isset($db_csrf[$_POST['csrf_token']])) {
$nowtime = time();
if($mysqlcon->exec("UPDATE `$dbname`.`config` SET `last_access`='$nowtime',`count_access`=`count_access` + 1") === false) { }
$newcount = $last_access['webinterface_access_count'] + 1;
if($mysqlcon->exec("INSERT INTO `$dbname`.`cfg_params` (`param`,`value`) VALUES ('webinterface_access_last','{$nowtime}'),('webinterface_access_count','{$newcount}') ON DUPLICATE KEY UPDATE `value`=VALUES(`value`)") === false) { }
require_once(substr(__DIR__,0,-12).'libs/ts3_lib/TeamSpeak3.php');
try {
if($ts['tsencrypt'] == 1) {
$ts3 = TeamSpeak3::factory("serverquery://".rawurlencode($ts['user']).":".rawurlencode($ts['pass'])."@".$ts['host'].":".$ts['query']."/?server_port=".$ts['voice']."&ssh=1");
if($cfg['teamspeak_query_encrypt_switch'] == 1) {
$ts3 = TeamSpeak3::factory("serverquery://".rawurlencode($cfg['teamspeak_query_user']).":".rawurlencode($cfg['teamspeak_query_pass'])."@".$cfg['teamspeak_host_address'].":".$cfg['teamspeak_query_port']."/?server_port=".$cfg['teamspeak_voice_port']."&ssh=1");
} else {
$ts3 = TeamSpeak3::factory("serverquery://".rawurlencode($ts['user']).":".rawurlencode($ts['pass'])."@".$ts['host'].":".$ts['query']."/?server_port=".$ts['voice']."&blocking=0");
$ts3 = TeamSpeak3::factory("serverquery://".rawurlencode($cfg['teamspeak_query_user']).":".rawurlencode($cfg['teamspeak_query_pass'])."@".$cfg['teamspeak_host_address'].":".$cfg['teamspeak_query_port']."/?server_port=".$cfg['teamspeak_voice_port']."&blocking=0");
}
try {
usleep($slowmode);
usleep($cfg['teamspeak_query_command_delay']);
$ts3->selfUpdate(array('client_nickname' => "Ranksystem - Reset Password"));
} catch (Exception $e) { }
usleep($slowmode);
usleep($cfg['teamspeak_query_command_delay']);
$allclients = $ts3->clientList();
$adminuuid_flipped = array_flip($adminuuid);
$pwd = substr(str_shuffle("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789#*+;:-_~?=%&$<24>!()"),0,12);
$webpass = password_hash($pwd, PASSWORD_DEFAULT);
$cfg['webinterface_pass'] = password_hash($pwd, PASSWORD_DEFAULT);
foreach ($allclients as $client) {
if(in_array($client['client_unique_identifier'] , $adminuuid)) {
if(in_array($client['client_unique_identifier'] , $cfg['webinterface_admin_client_unique_id_list'])) {
$checkuuid = 1;
if($client['connection_client_ip'] == getclientip()) {
$checkip = 1;
if($mysqlcon->exec("UPDATE `$dbname`.`config` SET `webpass`='$webpass',`last_access`='0'") === false) {
if($mysqlcon->exec("INSERT INTO `$dbname`.`cfg_params` (`param`,`value`) VALUES ('webinterface_pass','{$cfg['webinterface_pass']}'),('webinterface_access_last','0') ON DUPLICATE KEY UPDATE `value`=VALUES(`value`)") === false) {
$err_msg = $lang['isntwidbmsg'].print_r($mysqlcon->errorInfo(), true); $err_lvl = 3;
} else {
try {
usleep($slowmode);
$ts3->clientGetByUid($client['client_unique_identifier'])->message(sprintf($lang['wirtpw4'], $webuser, $pwd, '[URL=http'.(!empty($_SERVER['HTTPS'])?"s":"").'://'.$_SERVER['SERVER_NAME'].dirname($_SERVER['SCRIPT_NAME']).']','[/URL]'));
usleep($cfg['teamspeak_query_command_delay']);
$ts3->clientGetByUid($client['client_unique_identifier'])->message(sprintf($lang['wirtpw4'], $cfg['webinterface_user'], $pwd, '[URL=http'.(!empty($_SERVER['HTTPS'])?"s":"").'://'.$_SERVER['SERVER_NAME'].dirname($_SERVER['SCRIPT_NAME']).']','[/URL]'));
$err_msg = sprintf($lang['wirtpw5'],'<a href="http'.(!empty($_SERVER['HTTPS'])?"s":"").'://'.$_SERVER['SERVER_NAME'].dirname($_SERVER['SCRIPT_NAME']).'/">','</a>'); $err_lvl = 1;
enter_logfile($logpath,$timezone,3,sprintf($lang['wirtpw6'],getclientip()));
enter_logfile($cfg,3,sprintf($lang['wirtpw6'],getclientip()));
} catch (Exception $e) {
$err_msg = $lang['errorts3'].$e->getCode().': '.$e->getMessage(); $err_lvl = 3;
}

View File

@@ -37,7 +37,7 @@ if (isset($_POST['logout'])) {
exit;
}
if (!isset($_SESSION[$rspathhex.'username']) || $_SESSION[$rspathhex.'username'] != $webuser || $_SESSION[$rspathhex.'password'] != $webpass || $_SESSION[$rspathhex.'clientip'] != getclientip()) {
if (!isset($_SESSION[$rspathhex.'username']) || $_SESSION[$rspathhex.'username'] != $cfg['webinterface_user'] || $_SESSION[$rspathhex.'password'] != $cfg['webinterface_pass'] || $_SESSION[$rspathhex.'clientip'] != getclientip()) {
header("Location: //".$_SERVER['HTTP_HOST'].rtrim(dirname($_SERVER['PHP_SELF']), '/\\'));
exit;
}
@@ -56,22 +56,23 @@ if (($db_csrf = $mysqlcon->query("SELECT * FROM `$dbname`.`csrf_token` WHERE `se
}
if (isset($_POST['update']) && isset($db_csrf[$_POST['csrf_token']])) {
if (isset($_POST['showexcld'])) $showexcld = 1; else $showexcld = 0;
if (isset($_POST['showcolrg'])) $showcolrg = 1; else $showcolrg = 0;
if (isset($_POST['showcolcld'])) $showcolcld = 1; else $showcolcld = 0;
if (isset($_POST['showcoluuid'])) $showcoluuid = 1; else $showcoluuid = 0;
if (isset($_POST['showcoldbid'])) $showcoldbid = 1; else $showcoldbid = 0;
if (isset($_POST['showcolls'])) $showcolls = 1; else $showcolls = 0;
if (isset($_POST['showcolot'])) $showcolot = 1; else $showcolot = 0;
if (isset($_POST['showcolit'])) $showcolit = 1; else $showcolit = 0;
if (isset($_POST['showcolat'])) $showcolat = 1; else $showcolat = 0;
if (isset($_POST['showcolas'])) $showcolas = 1; else $showcolas = 0;
if (isset($_POST['showcolnx'])) $showcolnx = 1; else $showcolnx = 0;
if (isset($_POST['showcolsg'])) $showcolsg = 1; else $showcolsg = 0;
if (isset($_POST['showhighest'])) $showhighest = 1; else $showhighest = 0;
if (isset($_POST['showgrpsince'])) $showgrpsince = 1; else $showgrpsince = 0;
if (isset($_POST['shownav'])) $shownav = 1; else $shownav = 0;
if ($mysqlcon->exec("UPDATE `$dbname`.`config` SET `showexcld`='$showexcld',`showcolrg`='$showcolrg',`showcolcld`='$showcolcld',`showcoluuid`='$showcoluuid',`showcoldbid`='$showcoldbid',`showcolls`='$showcolls',`showcolot`='$showcolot',`showcolit`='$showcolit',`showcolat`='$showcolat',`showcolas`='$showcolas',`showcolnx`='$showcolnx',`showcolsg`='$showcolsg',`showhighest`='$showhighest',`showgrpsince`='$showgrpsince',`shownav`='$shownav'") === false) {
if (isset($_POST['stats_column_rank_switch'])) $cfg['stats_column_rank_switch'] = 1; else $cfg['stats_column_rank_switch'] = 0;
if (isset($_POST['stats_column_client_name_switch'])) $cfg['stats_column_client_name_switch'] = 1; else $cfg['stats_column_client_name_switch'] = 0;
if (isset($_POST['stats_column_unique_id_switch'])) $cfg['stats_column_unique_id_switch'] = 1; else $cfg['stats_column_unique_id_switch'] = 0;
if (isset($_POST['stats_column_client_db_id_switch'])) $cfg['stats_column_client_db_id_switch'] = 1; else $cfg['stats_column_client_db_id_switch'] = 0;
if (isset($_POST['stats_column_last_seen_switch'])) $cfg['stats_column_last_seen_switch'] = 1; else $cfg['stats_column_last_seen_switch'] = 0;
if (isset($_POST['stats_column_online_time_switch'])) $cfg['stats_column_online_time_switch'] = 1; else $cfg['stats_column_online_time_switch'] = 0;
if (isset($_POST['stats_column_idle_time_switch'])) $cfg['stats_column_idle_time_switch'] = 1; else $cfg['stats_column_idle_time_switch'] = 0;
if (isset($_POST['stats_column_active_time_switch'])) $cfg['stats_column_active_time_switch'] = 1; else $cfg['stats_column_active_time_switch'] = 0;
if (isset($_POST['stats_column_current_server_group_switch'])) $cfg['stats_column_current_server_group_switch'] = 1; else $cfg['stats_column_current_server_group_switch'] = 0;
if (isset($_POST['stats_column_next_rankup_switch'])) $cfg['stats_column_next_rankup_switch'] = 1; else $cfg['stats_column_next_rankup_switch'] = 0;
if (isset($_POST['stats_column_next_server_group_switch'])) $cfg['stats_column_next_server_group_switch'] = 1; else $cfg['stats_column_next_server_group_switch'] = 0;
if (isset($_POST['stats_column_current_group_since_switch'])) $cfg['stats_column_current_group_since_switch'] = 1; else $cfg['stats_column_current_group_since_switch'] = 0;
if (isset($_POST['stats_show_excepted_clients_switch'])) $cfg['stats_show_excepted_clients_switch'] = 1; else $cfg['stats_show_excepted_clients_switch'] = 0;
if (isset($_POST['stats_show_clients_in_highest_rank_switch'])) $cfg['stats_show_clients_in_highest_rank_switch'] = 1; else $cfg['stats_show_clients_in_highest_rank_switch'] = 0;
if (isset($_POST['stats_show_site_navigation_switch'])) $cfg['stats_show_site_navigation_switch'] = 1; else $cfg['stats_show_site_navigation_switch'] = 0;
if ($mysqlcon->exec("INSERT INTO `$dbname`.`cfg_params` (`param`,`value`) VALUES ('stats_column_rank_switch','{$cfg['stats_column_rank_switch']}'),('','{$cfg['stats_column_client_name_switch']}'),('stats_column_unique_id_switch','{$cfg['stats_column_unique_id_switch']}'),('stats_column_client_db_id_switch','{$cfg['stats_column_client_db_id_switch']}'),('stats_column_last_seen_switch','{$cfg['stats_column_last_seen_switch']}'),('stats_column_online_time_switch','{$cfg['stats_column_online_time_switch']}'),('stats_column_idle_time_switch','{$cfg['stats_column_idle_time_switch']}'),('stats_column_active_time_switch','{$cfg['stats_column_active_time_switch']}'),('stats_column_current_server_group_switch','{$cfg['stats_column_current_server_group_switch']}'),('stats_column_current_group_since_switch','{$cfg['stats_column_current_group_since_switch']}'),('stats_column_next_rankup_switch','{$cfg['stats_column_next_rankup_switch']}'),('stats_column_next_server_group_switch','{$cfg['stats_column_next_server_group_switch']}'),('stats_show_excepted_clients_switch','{$cfg['stats_show_excepted_clients_switch']}'),('stats_show_clients_in_highest_rank_switch','{$cfg['stats_show_clients_in_highest_rank_switch']}'),('stats_show_site_navigation_switch','{$cfg['stats_show_site_navigation_switch']}') 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 {
@@ -103,120 +104,120 @@ if (isset($_POST['update']) && isset($db_csrf[$_POST['csrf_token']])) {
<div class="form-group">
<label class="col-sm-4 control-label" data-toggle="modal" data-target="#wishcolrgdesc"><?php echo $lang['wishcolrg']; ?><i class="help-hover glyphicon glyphicon-question-sign"></i></label>
<div class="col-sm-8">
<?PHP if ($showcolrg == 1) {
echo '<input class="switch-animate" type="checkbox" checked data-size="mini" name="showcolrg" value="',$showcolrg,'">';
<?PHP if ($cfg['stats_column_rank_switch'] == 1) {
echo '<input class="switch-animate" type="checkbox" checked data-size="mini" name="stats_column_rank_switch" value="',$cfg['stats_column_rank_switch'],'">';
} else {
echo '<input class="switch-animate" type="checkbox" data-size="mini" name="showcolrg" value="',$showcolrg,'">';
echo '<input class="switch-animate" type="checkbox" data-size="mini" name="stats_column_rank_switch" value="',$cfg['stats_column_rank_switch'],'">';
} ?>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label" data-toggle="modal" data-target="#wishcolclddesc"><?php echo $lang['wishcolcld']; ?><i class="help-hover glyphicon glyphicon-question-sign"></i></label>
<div class="col-sm-8">
<?PHP if ($showcolcld == 1) {
echo '<input class="switch-animate" type="checkbox" checked data-size="mini" name="showcolcld" value="',$showcolcld,'">';
<?PHP if ($cfg['stats_column_client_name_switch'] == 1) {
echo '<input class="switch-animate" type="checkbox" checked data-size="mini" name="stats_column_client_name_switch" value="',$cfg['stats_column_client_name_switch'],'">';
} else {
echo '<input class="switch-animate" type="checkbox" data-size="mini" name="showcolcld" value="',$showcolcld,'">';
echo '<input class="switch-animate" type="checkbox" data-size="mini" name="stats_column_client_name_switch" value="',$cfg['stats_column_client_name_switch'],'">';
} ?>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label" data-toggle="modal" data-target="#wishcoluuiddesc"><?php echo $lang['wishcoluuid']; ?><i class="help-hover glyphicon glyphicon-question-sign"></i></label>
<div class="col-sm-8">
<?PHP if ($showcoluuid == 1) {
echo '<input class="switch-animate" type="checkbox" checked data-size="mini" name="showcoluuid" value="',$showcoluuid,'">';
<?PHP if ($cfg['stats_column_unique_id_switch'] == 1) {
echo '<input class="switch-animate" type="checkbox" checked data-size="mini" name="stats_column_unique_id_switch" value="',$cfg['stats_column_unique_id_switch'],'">';
} else {
echo '<input class="switch-animate" type="checkbox" data-size="mini" name="showcoluuid" value="',$showcoluuid,'">';
echo '<input class="switch-animate" type="checkbox" data-size="mini" name="stats_column_unique_id_switch" value="',$cfg['stats_column_unique_id_switch'],'">';
} ?>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label" data-toggle="modal" data-target="#wishcoldbiddesc"><?php echo $lang['wishcoldbid']; ?><i class="help-hover glyphicon glyphicon-question-sign"></i></label>
<div class="col-sm-8">
<?PHP if ($showcoldbid == 1) {
echo '<input class="switch-animate" type="checkbox" checked data-size="mini" name="showcoldbid" value="',$showcoldbid,'">';
<?PHP if ($cfg['stats_column_client_db_id_switch'] == 1) {
echo '<input class="switch-animate" type="checkbox" checked data-size="mini" name="stats_column_client_db_id_switch" value="',$cfg['stats_column_client_db_id_switch'],'">';
} else {
echo '<input class="switch-animate" type="checkbox" data-size="mini" name="showcoldbid" value="',$showcoldbid,'">';
echo '<input class="switch-animate" type="checkbox" data-size="mini" name="stats_column_client_db_id_switch" value="',$cfg['stats_column_client_db_id_switch'],'">';
} ?>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label" data-toggle="modal" data-target="#wishcollsdesc"><?php echo $lang['wishcolls']; ?><i class="help-hover glyphicon glyphicon-question-sign"></i></label>
<div class="col-sm-8">
<?PHP if ($showcolls == 1) {
echo '<input class="switch-animate" type="checkbox" checked data-size="mini" name="showcolls" value="',$showcolls,'">';
<?PHP if ($cfg['stats_column_last_seen_switch'] == 1) {
echo '<input class="switch-animate" type="checkbox" checked data-size="mini" name="stats_column_last_seen_switch" value="',$cfg['stats_column_last_seen_switch'],'">';
} else {
echo '<input class="switch-animate" type="checkbox" data-size="mini" name="showcolls" value="',$showcolls,'">';
echo '<input class="switch-animate" type="checkbox" data-size="mini" name="stats_column_last_seen_switch" value="',$cfg['stats_column_last_seen_switch'],'">';
} ?>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label" data-toggle="modal" data-target="#wishcolotdesc"><?php echo $lang['wishcolot']; ?><i class="help-hover glyphicon glyphicon-question-sign"></i></label>
<div class="col-sm-8">
<?PHP if ($showcolot == 1) {
echo '<input class="switch-animate" type="checkbox" checked data-size="mini" name="showcolot" value="',$showcolot,'">';
<?PHP if ($cfg['stats_column_online_time_switch'] == 1) {
echo '<input class="switch-animate" type="checkbox" checked data-size="mini" name="stats_column_online_time_switch" value="',$cfg['stats_column_online_time_switch'],'">';
} else {
echo '<input class="switch-animate" type="checkbox" data-size="mini" name="showcolot" value="',$showcolot,'">';
echo '<input class="switch-animate" type="checkbox" data-size="mini" name="stats_column_online_time_switch" value="',$cfg['stats_column_online_time_switch'],'">';
} ?>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label" data-toggle="modal" data-target="#wishcolitdesc"><?php echo $lang['wishcolit']; ?><i class="help-hover glyphicon glyphicon-question-sign"></i></label>
<div class="col-sm-8">
<?PHP if ($showcolit == 1) {
echo '<input class="switch-animate" type="checkbox" checked data-size="mini" name="showcolit" value="',$showcolit,'">';
<?PHP if ($cfg['stats_column_idle_time_switch'] == 1) {
echo '<input class="switch-animate" type="checkbox" checked data-size="mini" name="stats_column_idle_time_switch" value="',$cfg['stats_column_idle_time_switch'],'">';
} else {
echo '<input class="switch-animate" type="checkbox" data-size="mini" name="showcolit" value="',$showcolit,'">';
echo '<input class="switch-animate" type="checkbox" data-size="mini" name="stats_column_idle_time_switch" value="',$cfg['stats_column_idle_time_switch'],'">';
} ?>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label" data-toggle="modal" data-target="#wishcolatdesc"><?php echo $lang['wishcolat']; ?><i class="help-hover glyphicon glyphicon-question-sign"></i></label>
<div class="col-sm-8">
<?PHP if ($showcolat == 1) {
echo '<input class="switch-animate" type="checkbox" checked data-size="mini" name="showcolat" value="',$showcolat,'">';
<?PHP if ($cfg['stats_column_active_time_switch'] == 1) {
echo '<input class="switch-animate" type="checkbox" checked data-size="mini" name="stats_column_active_time_switch" value="',$cfg['stats_column_active_time_switch'],'">';
} else {
echo '<input class="switch-animate" type="checkbox" data-size="mini" name="showcolat" value="',$showcolat,'">';
echo '<input class="switch-animate" type="checkbox" data-size="mini" name="stats_column_active_time_switch" value="',$cfg['stats_column_active_time_switch'],'">';
} ?>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label" data-toggle="modal" data-target="#wishcolasdesc"><?php echo $lang['wishcolas']; ?><i class="help-hover glyphicon glyphicon-question-sign"></i></label>
<div class="col-sm-8">
<?PHP if ($showcolas == 1) {
echo '<input class="switch-animate" type="checkbox" checked data-size="mini" name="showcolas" value="',$showcolas,'">';
<?PHP if ($cfg['stats_column_current_server_group_switch'] == 1) {
echo '<input class="switch-animate" type="checkbox" checked data-size="mini" name="stats_column_current_server_group_switch" value="',$cfg['stats_column_current_server_group_switch'],'">';
} else {
echo '<input class="switch-animate" type="checkbox" data-size="mini" name="showcolas" value="',$showcolas,'">';
echo '<input class="switch-animate" type="checkbox" data-size="mini" name="stats_column_current_server_group_switch" value="',$cfg['stats_column_current_server_group_switch'],'">';
} ?>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label" data-toggle="modal" data-target="#wishcolgsdesc"><?php echo $lang['wishcolgs']; ?><i class="help-hover glyphicon glyphicon-question-sign"></i></label>
<div class="col-sm-8">
<?PHP if ($showgrpsince == 1) {
echo '<input class="switch-animate" type="checkbox" checked data-size="mini" name="showgrpsince" value="',$showgrpsince,'">';
<?PHP if ($cfg['stats_column_current_group_since_switch'] == 1) {
echo '<input class="switch-animate" type="checkbox" checked data-size="mini" name="stats_column_current_group_since_switch" value="',$cfg['stats_column_current_group_since_switch'],'">';
} else {
echo '<input class="switch-animate" type="checkbox" data-size="mini" name="showgrpsince" value="',$showgrpsince,'">';
echo '<input class="switch-animate" type="checkbox" data-size="mini" name="stats_column_current_group_since_switch" value="',$cfg['stats_column_current_group_since_switch'],'">';
} ?>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label" data-toggle="modal" data-target="#wishcolnxdesc"><?php echo $lang['wishcolnx']; ?><i class="help-hover glyphicon glyphicon-question-sign"></i></label>
<div class="col-sm-8">
<?PHP if ($showcolnx == 1) {
echo '<input class="switch-animate" type="checkbox" checked data-size="mini" name="showcolnx" value="',$showcolnx,'">';
<?PHP if ($cfg['stats_column_next_rankup_switch'] == 1) {
echo '<input class="switch-animate" type="checkbox" checked data-size="mini" name="stats_column_next_rankup_switch" value="',$cfg['stats_column_next_rankup_switch'],'">';
} else {
echo '<input class="switch-animate" type="checkbox" data-size="mini" name="showcolnx" value="',$showcolnx,'">';
echo '<input class="switch-animate" type="checkbox" data-size="mini" name="stats_column_next_rankup_switch" value="',$cfg['stats_column_next_rankup_switch'],'">';
} ?>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label" data-toggle="modal" data-target="#wishcolsgdesc"><?php echo $lang['wishcolsg']; ?><i class="help-hover glyphicon glyphicon-question-sign"></i></label>
<div class="col-sm-8">
<?PHP if ($showcolsg == 1) {
echo '<input class="switch-animate" type="checkbox" checked data-size="mini" name="showcolsg" value="',$showcolsg,'">';
<?PHP if ($cfg['stats_column_next_server_group_switch'] == 1) {
echo '<input class="switch-animate" type="checkbox" checked data-size="mini" name="stats_column_next_server_group_switch" value="',$cfg['stats_column_next_server_group_switch'],'">';
} else {
echo '<input class="switch-animate" type="checkbox" data-size="mini" name="showcolsg" value="',$showcolsg,'">';
echo '<input class="switch-animate" type="checkbox" data-size="mini" name="stats_column_next_server_group_switch" value="',$cfg['stats_column_next_server_group_switch'],'">';
} ?>
</div>
</div>
@@ -227,20 +228,20 @@ if (isset($_POST['update']) && isset($db_csrf[$_POST['csrf_token']])) {
<div class="form-group">
<label class="col-sm-4 control-label" data-toggle="modal" data-target="#wishexclddesc"><?php echo $lang['wishexcld']; ?><i class="help-hover glyphicon glyphicon-question-sign"></i></label>
<div class="col-sm-8">
<?PHP if ($showexcld == 1) {
echo '<input class="switch-animate" type="checkbox" checked data-size="mini" name="showexcld" value="',$showexcld,'">';
<?PHP if ($cfg['stats_show_excepted_clients_switch'] == 1) {
echo '<input class="switch-animate" type="checkbox" checked data-size="mini" name="stats_show_excepted_clients_switch" value="',$cfg['stats_show_excepted_clients_switch'],'">';
} else {
echo '<input class="switch-animate" type="checkbox" data-size="mini" name="showexcld" value="',$showexcld,'">';
echo '<input class="switch-animate" type="checkbox" data-size="mini" name="stats_show_excepted_clients_switch" value="',$cfg['stats_show_excepted_clients_switch'],'">';
} ?>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label" data-toggle="modal" data-target="#wishhiclddesc"><?php echo $lang['wishhicld']; ?><i class="help-hover glyphicon glyphicon-question-sign"></i></label>
<div class="col-sm-8">
<?PHP if ($showhighest == 1) {
echo '<input class="switch-animate" type="checkbox" checked data-size="mini" name="showhighest" value="',$showhighest,'">';
<?PHP if ($cfg['stats_show_clients_in_highest_rank_switch'] == 1) {
echo '<input class="switch-animate" type="checkbox" checked data-size="mini" name="stats_show_clients_in_highest_rank_switch" value="',$cfg['stats_show_clients_in_highest_rank_switch'],'">';
} else {
echo '<input class="switch-animate" type="checkbox" data-size="mini" name="showhighest" value="',$showhighest,'">';
echo '<input class="switch-animate" type="checkbox" data-size="mini" name="stats_show_clients_in_highest_rank_switch" value="',$cfg['stats_show_clients_in_highest_rank_switch'],'">';
} ?>
</div>
</div>
@@ -248,10 +249,10 @@ if (isset($_POST['update']) && isset($db_csrf[$_POST['csrf_token']])) {
<div class="form-group">
<label class="col-sm-4 control-label" data-toggle="modal" data-target="#wishnavdesc"><?php echo $lang['wishnav']; ?><i class="help-hover glyphicon glyphicon-question-sign"></i></label>
<div class="col-sm-8">
<?PHP if ($shownav == 1) {
echo '<input class="switch-animate" type="checkbox" checked data-size="mini" name="shownav" value="',$shownav,'">';
<?PHP if ($cfg['stats_show_site_navigation_switch'] == 1) {
echo '<input class="switch-animate" type="checkbox" checked data-size="mini" name="stats_show_site_navigation_switch" value="',$cfg['stats_show_site_navigation_switch'],'">';
} else {
echo '<input class="switch-animate" type="checkbox" data-size="mini" name="shownav" value="',$shownav,'">';
echo '<input class="switch-animate" type="checkbox" data-size="mini" name="stats_show_site_navigation_switch" value="',$cfg['stats_show_site_navigation_switch'],'">';
} ?>
</div>
</div>

View File

@@ -37,7 +37,7 @@ if (isset($_POST['logout'])) {
exit;
}
if (!isset($_SESSION[$rspathhex.'username']) || $_SESSION[$rspathhex.'username'] != $webuser || $_SESSION[$rspathhex.'password'] != $webpass || $_SESSION[$rspathhex.'clientip'] != getclientip()) {
if (!isset($_SESSION[$rspathhex.'username']) || $_SESSION[$rspathhex.'username'] != $cfg['webinterface_user'] || $_SESSION[$rspathhex.'password'] != $cfg['webinterface_pass'] || $_SESSION[$rspathhex.'clientip'] != getclientip()) {
header("Location: //".$_SERVER['HTTP_HOST'].rtrim(dirname($_SERVER['PHP_SELF']), '/\\'));
exit;
}
@@ -56,17 +56,17 @@ if (($db_csrf = $mysqlcon->query("SELECT * FROM `$dbname`.`csrf_token` WHERE `se
}
if (isset($_POST['update']) && isset($db_csrf[$_POST['csrf_token']])) {
$tshost = $_POST['tshost'];
$tsquery = $_POST['tsquery'];
if (isset($_POST['tsencrypt'])) $tsencrypt = 1; else $tsencrypt = 0;
$tsvoice = $_POST['tsvoice'];
$tsuser = $_POST['tsuser'];
$tspass = $_POST['tspass'];
$queryname = $_POST['queryname'];
$defchid = $_POST['defchid'];
$slowmode = $_POST['slowmode'];
$avatar_delay= $_POST['avatar_delay'];
if ($mysqlcon->exec("UPDATE `$dbname`.`config` SET `tshost`='$tshost',`tsencrypt`='$tsencrypt',`tsquery`='$tsquery',`tsvoice`='$tsvoice',`tsuser`='$tsuser',`tspass`='$tspass',`queryname`='$queryname',`slowmode`='$slowmode',`defchid`='$defchid',`avatar_delay`='$avatar_delay'; DELETE FROM `$dbname`.`csrf_token` WHERE `token`='".$_POST['csrf_token']."'") === false) {
$cfg['teamspeak_host_address'] = $_POST['teamspeak_host_address'];
$cfg['teamspeak_query_port'] = $_POST['teamspeak_query_port'];
if (isset($_POST['teamspeak_query_encrypt_switch'])) $cfg['teamspeak_query_encrypt_switch'] = 1; else $cfg['teamspeak_query_encrypt_switch'] = 0;
$cfg['teamspeak_voice_port'] = $_POST['teamspeak_voice_port'];
$cfg['teamspeak_query_user'] = $_POST['teamspeak_query_user'];
$cfg['teamspeak_query_pass'] = $_POST['teamspeak_query_pass'];
$cfg['teamspeak_query_nickname'] = $_POST['teamspeak_query_nickname'];
$cfg['teamspeak_default_channel_id'] = $_POST['teamspeak_default_channel_id'];
$cfg['teamspeak_query_command_delay'] = $_POST['teamspeak_query_command_delay'];
$cfg['teamspeak_avatar_download_delay']= $_POST['teamspeak_avatar_download_delay'];
if ($mysqlcon->exec("INSERT INTO `$dbname`.`cfg_params` (`param`,`value`) VALUES ('teamspeak_host_address','{$cfg['teamspeak_host_address']}'),('teamspeak_query_encrypt_switch','{$cfg['teamspeak_query_encrypt_switch']}'),('teamspeak_query_port','{$cfg['teamspeak_query_port']}'),('teamspeak_voice_port','{$cfg['teamspeak_voice_port']}'),('teamspeak_query_user','{$cfg['teamspeak_query_user']}'),('teamspeak_query_pass','{$cfg['teamspeak_query_pass']}'),('teamspeak_query_nickname','{$cfg['teamspeak_query_nickname']}'),('teamspeak_default_channel_id','{$cfg['teamspeak_default_channel_id']}'),('teamspeak_query_command_delay','{$cfg['teamspeak_query_command_delay']}'),('teamspeak_avatar_download_delay','{$cfg['teamspeak_avatar_download_delay']}') 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 {
@@ -74,12 +74,6 @@ if (isset($_POST['update']) && isset($db_csrf[$_POST['csrf_token']])) {
type="submit" class="btn btn-primary" name="restart"><i class="fa fa-fw fa-refresh"></i>&nbsp;'.$lang['wibot7'].'</button></form>');
$err_lvl = NULL;
}
$ts['host'] = $_POST['tshost'];
$ts['query'] = $_POST['tsquery'];
$ts['tsencrypt']= $tsencrypt;
$ts['voice'] = $_POST['tsvoice'];
$ts['user'] = $_POST['tsuser'];
$ts['pass'] = $_POST['tspass'];
} elseif(isset($_POST['update'])) {
echo '<div class="alert alert-danger alert-dismissible">',$lang['errcsrf'],'</div>';
rem_session_ts3($rspathhex);
@@ -105,7 +99,7 @@ if (isset($_POST['update']) && isset($db_csrf[$_POST['csrf_token']])) {
<div class="form-group required-field-block">
<label class="col-sm-4 control-label" data-toggle="modal" data-target="#wits3hostdesc"><?php echo $lang['wits3host']; ?><i class="help-hover glyphicon glyphicon-question-sign"></i></label>
<div class="col-sm-8">
<input type="text" class="form-control" data-pattern="^[^.]+[^:]*$" data-error="Do not enter the port inside this field. You should enter the port (e.g. 9987) inside the TS3-Voice-Port!" name="tshost" value="<?php echo $ts['host']; ?>" maxlength="64" required>
<input type="text" class="form-control" data-pattern="^[^.]+[^:]*$" data-error="Do not enter the port inside this field. You should enter the port (e.g. 9987) inside the TS3-Voice-Port!" name="teamspeak_host_address" value="<?php echo $cfg['teamspeak_host_address']; ?>" maxlength="64" required>
<div class="required-icon"><div class="text">*</div></div>
<div class="help-block with-errors"></div>
</div>
@@ -113,19 +107,19 @@ if (isset($_POST['update']) && isset($db_csrf[$_POST['csrf_token']])) {
<div class="form-group">
<label class="col-sm-4 control-label" data-toggle="modal" data-target="#wits3encryptdesc"><?php echo $lang['wits3encrypt']; ?><i class="help-hover glyphicon glyphicon-question-sign"></i></label>
<div class="col-sm-8">
<?PHP if ($ts['tsencrypt'] == 1) {
echo '<input class="switch-animate" type="checkbox" checked data-size="mini" name="tsencrypt" value="',$ts['tsencrypt'],'">';
<?PHP if ($cfg['teamspeak_query_encrypt_switch'] == 1) {
echo '<input class="switch-animate" type="checkbox" checked data-size="mini" name="teamspeak_query_encrypt_switch" value="',$cfg['teamspeak_query_encrypt_switch'],'">';
} else {
echo '<input class="switch-animate" type="checkbox" data-size="mini" name="tsencrypt" value="',$ts['tsencrypt'],'">';
echo '<input class="switch-animate" type="checkbox" data-size="mini" name="teamspeak_query_encrypt_switch" value="',$cfg['teamspeak_query_encrypt_switch'],'">';
} ?>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label" data-toggle="modal" data-target="#wits3querydesc"><?php echo $lang['wits3query']; ?><i class="help-hover glyphicon glyphicon-question-sign"></i></label>
<div class="col-sm-8 required-field-block-spin">
<input type="text" class="form-control" name="tsquery" value="<?php echo $ts['query']; ?>" required>
<input type="text" class="form-control" name="teamspeak_query_port" value="<?php echo $cfg['teamspeak_query_port']; ?>" required>
<script>
$("input[name='tsquery']").TouchSpin({
$("input[name='teamspeak_query_port']").TouchSpin({
min: 0,
max: 65535,
verticalbuttons: true,
@@ -138,9 +132,9 @@ if (isset($_POST['update']) && isset($db_csrf[$_POST['csrf_token']])) {
<div class="form-group">
<label class="col-sm-4 control-label" data-toggle="modal" data-target="#wits3voicedesc"><?php echo $lang['wits3voice']; ?><i class="help-hover glyphicon glyphicon-question-sign"></i></label>
<div class="col-sm-8 required-field-block-spin">
<input type="text" class="form-control" name="tsvoice" value="<?php echo $ts['voice']; ?>" required>
<input type="text" class="form-control" name="teamspeak_voice_port" value="<?php echo $cfg['teamspeak_voice_port']; ?>" required>
<script>
$("input[name='tsvoice']").TouchSpin({
$("input[name='teamspeak_voice_port']").TouchSpin({
min: 0,
max: 65535,
verticalbuttons: true,
@@ -158,14 +152,14 @@ if (isset($_POST['update']) && isset($db_csrf[$_POST['csrf_token']])) {
<div class="form-group">
<label class="col-sm-4 control-label" data-toggle="modal" data-target="#wits3querusrdesc"><?php echo $lang['wits3querusr']; ?><i class="help-hover glyphicon glyphicon-question-sign"></i></label>
<div class="col-sm-8 required-field-block">
<input type="text" class="form-control" name="tsuser" value="<?php echo $ts['user']; ?>" required>
<input type="text" class="form-control" name="teamspeak_query_user" value="<?php echo $cfg['teamspeak_query_user']; ?>" required>
<div class="required-icon"><div class="text">*</div></div>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label" data-toggle="modal" data-target="#wits3querpwdesc"><?php echo $lang['wits3querpw']; ?><i class="help-hover glyphicon glyphicon-question-sign"></i></label>
<div class="col-sm-8 required-field-block">
<input type="password" class="form-control" name="tspass" id="tspass" value="<?php echo $ts['pass']; ?>" data-toggle="password" data-placement="before" required>
<input type="password" class="form-control" name="teamspeak_query_pass" value="<?php echo $cfg['teamspeak_query_pass']; ?>" data-toggle="password" data-placement="before" required>
<div class="required-icon"><div class="text">*</div></div>
</div>
</div>
@@ -177,7 +171,7 @@ if (isset($_POST['update']) && isset($db_csrf[$_POST['csrf_token']])) {
<div class="form-group">
<label class="col-sm-4 control-label" data-toggle="modal" data-target="#wits3qnmdesc"><?php echo $lang['wits3qnm']; ?><i class="help-hover glyphicon glyphicon-question-sign"></i></label>
<div class="col-sm-8 required-field-block">
<input type="text" class="form-control" name="queryname" value="<?php echo $queryname; ?>" maxlength="30" required>
<input type="text" class="form-control" name="teamspeak_query_nickname" value="<?php echo $cfg['teamspeak_query_nickname']; ?>" maxlength="30" required>
<div class="required-icon"><div class="text">*</div></div>
</div>
</div>
@@ -185,9 +179,9 @@ if (isset($_POST['update']) && isset($db_csrf[$_POST['csrf_token']])) {
<div class="form-group">
<label class="col-sm-4 control-label" data-toggle="modal" data-target="#wits3dchdesc"><?php echo $lang['wits3dch']; ?><i class="help-hover glyphicon glyphicon-question-sign"></i></label>
<div class="col-sm-8">
<input type="text" class="form-control" name="defchid" value="<?php echo $defchid; ?>">
<input type="text" class="form-control" name="teamspeak_default_channel_id" value="<?php echo $cfg['teamspeak_default_channel_id']; ?>">
<script>
$("input[name='defchid']").TouchSpin({
$("input[name='teamspeak_default_channel_id']").TouchSpin({
min: 0,
max: 2147483647,
verticalbuttons: true,
@@ -200,15 +194,15 @@ if (isset($_POST['update']) && isset($db_csrf[$_POST['csrf_token']])) {
<div class="form-group">
<label class="col-sm-4 control-label" data-toggle="modal" data-target="#wits3smdesc"><?php echo $lang['wits3sm']; ?><i class="help-hover glyphicon glyphicon-question-sign"></i></label>
<div class="col-sm-8">
<select class="selectpicker show-tick form-control" id="basic" name="slowmode">
<select class="selectpicker show-tick form-control" id="basic" name="teamspeak_query_command_delay">
<?PHP
echo '<option data-subtext="[recommended]" value="0"'; if($slowmode=="0") echo ' selected="selected"'; echo '>disabled (Realtime)</option>';
echo '<option data-subtext="[recommended]" value="0"'; if($cfg['teamspeak_query_command_delay']=="0") echo ' selected="selected"'; echo '>disabled (Realtime)</option>';
echo '<option data-divider="true">&nbsp;</option>';
echo '<option data-subtext="(0,2 seconds)" value="200000"'; if($slowmode=="200000") echo ' selected="selected"'; echo '>Low delay</option>';
echo '<option data-subtext="(0,5 seconds)" value="500000"'; if($slowmode=="500000") echo ' selected="selected"'; echo '>Middle delay</option>';
echo '<option data-subtext="(1,0 seconds)" value="1000000"'; if($slowmode=="1000000") echo ' selected="selected"'; echo '>High delay</option>';
echo '<option data-subtext="(2,0 seconds)" value="2000000"'; if($slowmode=="2000000") echo ' selected="selected"'; echo '>Huge delay</option>';
echo '<option data-subtext="(5,0 seconds)" value="5000000"'; if($slowmode=="5000000") echo ' selected="selected"'; echo '>Ultra delay</option>';
echo '<option data-subtext="(0,2 seconds)" value="200000"'; if($cfg['teamspeak_query_command_delay']=="200000") echo ' selected="selected"'; echo '>Low delay</option>';
echo '<option data-subtext="(0,5 seconds)" value="500000"'; if($cfg['teamspeak_query_command_delay']=="500000") echo ' selected="selected"'; echo '>Middle delay</option>';
echo '<option data-subtext="(1,0 seconds)" value="1000000"'; if($cfg['teamspeak_query_command_delay']=="1000000") echo ' selected="selected"'; echo '>High delay</option>';
echo '<option data-subtext="(2,0 seconds)" value="2000000"'; if($cfg['teamspeak_query_command_delay']=="2000000") echo ' selected="selected"'; echo '>Huge delay</option>';
echo '<option data-subtext="(5,0 seconds)" value="5000000"'; if($cfg['teamspeak_query_command_delay']=="5000000") echo ' selected="selected"'; echo '>Ultra delay</option>';
?>
</select>
</div>
@@ -217,9 +211,9 @@ if (isset($_POST['update']) && isset($db_csrf[$_POST['csrf_token']])) {
<div class="form-group">
<label class="col-sm-4 control-label" data-toggle="modal" data-target="#wits3avatdesc"><?php echo $lang['wits3avat']; ?><i class="help-hover glyphicon glyphicon-question-sign"></i></label>
<div class="col-sm-8">
<input type="text" class="form-control" name="avatar_delay" value="<?php echo $avatar_delay; ?>">
<input type="text" class="form-control" name="teamspeak_avatar_download_delay" value="<?php echo $cfg['teamspeak_avatar_download_delay']; ?>">
<script>
$("input[name='avatar_delay']").TouchSpin({
$("input[name='teamspeak_avatar_download_delay']").TouchSpin({
min: 0,
max: 65535,
verticalbuttons: true,