You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The TSN Ranksystem is an easy to handle Level System to automatically grant ranks (servergroups) to users on a TeamSpeaks3 Server for online time or online activity. You can create your own servergroups, with permissions, icons etc. of your choice, and define these for the Ranksystem. Its open source and so its free to use under the GNU license with version 3.
5
+
The TSN Ranksystem is an easy to handle Level System to automatically grant ranks (servergroups) to users on a TeamSpeak Server for online time or online activity. You can create your own servergroups, with permissions, icons etc. of your choice, and define these for the Ranksystem. Its open source and so its free to use under the GNU license with version 3.
6
6
7
-
#### Official website: [TS-Ranksystem.com](http://ts-ranksystem.com)
7
+
#### Official website: [TS-Ranksystem.com](https://ts-ranksystem.com)
"usage" => "Use \$_GET parameter 'name' and add as value a name or a part of it",
131
139
"example" => "/api/?user&name=Newcomer1989"
132
140
),
141
+
"online" => array(
142
+
"desc" => "Get the online TeamSpeak user",
143
+
"usage" => "Use \$_GET parameter 'online' without any value",
144
+
"example" => "/api/?user&online"
145
+
),
133
146
"part" => array(
134
-
"desc" => "Define, which part of the result you want to get. This is needed, when more then 10 clients are inside the result. At default you will get the first 10 clients. To get the next 10 clients, you will need to answer for part 2.",
147
+
"desc" => "Define, which part of the result you want to get. This is needed, when more then 10 clients are inside the result. At default you will get the first 100 clients. To get the next 100 clients, you will need to answer for part 2.",
135
148
"usage" => "Use \$_GET parameter 'part' and add as value a number above 1",
$dbdata = $mysqlcon->prepare("SELECT `uuid`,`cldbid`,`rank`,`count`,`name`,`idle`,`cldgroup`,`online`,`nextup`,`lastseen`,`grpid`,`except`,`grpsince` FROM `$dbname`.`user` WHERE (`uuid` LIKE :uuid OR `cldbid` LIKE :cldbid OR `name` LIKE :name) LIMIT :start, :limit");
if(($get_db_data = $mysqlcon->query("SELECT * FROM `$dbname`.`user`; SELECT MAX(`timestamp`) AS `timestamp` FROM `$dbname`.`user_snapshot`; SELECT `version`, COUNT(`version`) AS `count` FROM `$dbname`.`user` GROUP BY `version` ORDER BY `count` DESC; SELECT MAX(`timestamp`) AS `timestamp` FROM `$dbname`.`server_usage`; SELECT * FROM `$dbname`.`job_check`; SELECT `uuid` FROM `$dbname`.`stats_user`; SELECT `timestamp` FROM `$dbname`.`user_snapshot` WHERE `timestamp`>$weekago ORDER BY `timestamp` ASC LIMIT 1; SELECT `timestamp` FROM `$dbname`.`user_snapshot` WHERE `timestamp`>$monthago ORDER BY `timestamp` ASC LIMIT 1; SELECT * FROM `$dbname`.`groups`; SELECT * FROM `$dbname`.`addon_assign_groups`; SELECT * FROM `$dbname`.`admin_addtime`; ")) === false) {
423
+
if(($get_db_data = $mysqlcon->query("SELECT * FROM `$dbname`.`user`; SELECT `version`, COUNT(`version`) AS `count` FROM `$dbname`.`user` GROUP BY `version` ORDER BY `count` DESC; SELECT MAX(`timestamp`) AS `timestamp` FROM `$dbname`.`server_usage`; SELECT * FROM `$dbname`.`job_check`; SELECT `uuid` FROM `$dbname`.`stats_user`; SELECT * FROM `$dbname`.`groups`; SELECT * FROM `$dbname`.`addon_assign_groups`; SELECT * FROM `$dbname`.`admin_addtime`; ")) === false) {
401
424
shutdown($mysqlcon,$cfg,1,"Select on DB failed: ".print_r($mysqlcon->errorInfo(), true));
$sqlexec .= "INSERT INTO `$dbname`.`user_snapshot` (`timestamp`,`uuid`,`count`,`idle`) VALUES $allinsertsnap; ";
47
+
$sqlexec .= "DELETE FROM `$dbname`.`user_snapshot` WHERE `id`={$nextid}; INSERT INTO `$dbname`.`user_snapshot` (`id`,`cldbid`,`count`,`idle`) VALUES $allinsertsnap; UPDATE `$dbname`.`job_check` SET `timestamp`={$nextid} WHERE `job_name`='last_snapshot_id'; UPDATE `$dbname`.`job_check` SET `timestamp`={$nowtime} WHERE `job_name`='last_snapshot_time'; ";
if(($snapshot_count_week = $mysqlcon->query("SELECT (SELECT SUM(`count`) FROM `$dbname`.`user_snapshot` WHERE `timestamp`=(SELECT MAX(`timestamp`) FROM `$dbname`.`user_snapshot`)) - (SELECT SUM(`count`) FROM `$dbname`.`user_snapshot` WHERE `timestamp`=(SELECT MIN(`s2`.`timestamp`) AS `value2` FROM (SELECT DISTINCT(`timestamp`) FROM `$dbname`.`user_snapshot` ORDER BY `timestamp` DESC LIMIT 28) AS `s2`, `$dbname`.`user_snapshot` AS `s1` WHERE `s1`.`timestamp`=`s2`.`timestamp`) AND `uuid` IN (SELECT `uuid` FROM `$dbname`.`user`)) AS `count`")->fetch(PDO::FETCH_ASSOC)) === false) {
405
+
if(($snapshot_count_week = $mysqlcon->query("SELECT (SELECT SUM(`count`) FROM `user_snapshot` WHERE `id`={$select_arr['job_check']['last_snapshot_id']['timestamp']}) - (SELECT SUM(`count`) FROM `user_snapshot` WHERE `id`={$weekago}) AS `count`;")->fetch(PDO::FETCH_ASSOC)) === false) {
@@ -442,9 +413,9 @@ function calc_serverstats($ts3,$mysqlcon,$cfg,$dbname,$dbtype,$serverinfo,$selec
442
413
} else {
443
414
$total_online_week = 0;
444
415
}
445
-
if ($entry_snapshot_count['timestamp'] > 119) {
416
+
if ($entry_snapshot_count['id'] > 120) {
446
417
// Calc total_online_month
447
-
if(($snapshot_count_month = $mysqlcon->query("SELECT (SELECT SUM(`count`) FROM `$dbname`.`user_snapshot` WHERE `timestamp`=(SELECT MAX(`timestamp`) FROM `$dbname`.`user_snapshot`)) - (SELECT SUM(`count`) FROM `$dbname`.`user_snapshot` WHERE `timestamp`=(SELECT MIN(`s2`.`timestamp`) AS `value2` FROM (SELECT DISTINCT(`timestamp`) FROM `$dbname`.`user_snapshot` ORDER BY `timestamp` DESC LIMIT 120) AS `s2`, `$dbname`.`user_snapshot` AS `s1` WHERE `s1`.`timestamp`=`s2`.`timestamp`) AND `uuid` IN (SELECT `uuid` FROM `$dbname`.`user`)) AS `count`")->fetch(PDO::FETCH_ASSOC)) === false) {
418
+
if(($snapshot_count_month = $mysqlcon->query("SELECT (SELECT SUM(`count`) FROM `user_snapshot` WHERE `id`={$select_arr['job_check']['last_snapshot_id']['timestamp']}) - (SELECT SUM(`count`) FROM `user_snapshot` WHERE `id`={$monthago}) AS `count`;")->fetch(PDO::FETCH_ASSOC)) === false) {
@@ -455,7 +426,7 @@ function calc_serverstats($ts3,$mysqlcon,$cfg,$dbname,$dbtype,$serverinfo,$selec
455
426
} else {
456
427
$total_online_month = 0;
457
428
}
458
-
$sqlexec .= "UPDATE `$dbname`.`stats_server` SET `total_online_month`=$total_online_month,`total_online_week`=$total_online_week; UPDATE `$dbname`.`job_check` SET `timestamp`=$nowtime WHERE `job_name`='calc_server_stats'; ";
429
+
$sqlexec .= "UPDATE `$dbname`.`stats_server` SET `total_online_month`={$total_online_month},`total_online_week`={$total_online_week}; UPDATE `$dbname`.`job_check` SET `timestamp`={$nowtime} WHERE `job_name`='calc_server_stats'; ";
459
430
460
431
if ($select_arr['job_check']['get_version']['timestamp'] < ($nowtime - 43200)) {
0 commit comments