TSN RANKSYSTEM

A PHP Bot that assigns time-based server groups
on your TeamSpeak server.

Download

The TSN Ranksystem is an open source project,
it is free to use under the GNU GPLv3 license.

Download the latest version:
DOWNLOAD (Version:1.3.7)
 

MD5: ddacbe1f5bbdec1789287500fa893e71

Do you like this tool?

Then you might want to sponsor a beer for the developer.

This enables them to develop new features more smoothly! ;-)
Donate (via PayPal)

Features

The TSN Ranksystem brings two components:

1) A TeamSpeak Bot &
2) A Website with:
- a statistics page (demo) &
- a web interface (demo)


TeamSpeak Bot
The TeamSpeak bot connects to the TeamSpeak server over the official TS3 Query interface. The bot does all back-end (background) jobs. It collects the online & active time of the TS3 user, calculates all statistics and collects several other data. It is also available for chat commands. And sure, it gives the server groups to the clients (e.g. military ranks, level, prestiges).

Statistics Page
On the public statistics page are several data available. There are displayed statistics about clients and the server.
It is much as powerful to describe all. To name only a few things:
- You'll find a ranking list, to get the most active users.
- It has also a server usage graph, which shows the online clients and channel per time.
- Client statistics about: online & active time, versions, nationalities, platforms, used slots, and much more...

Web Interface
With the web interface, you can easily control the bot. It is an access secured site for the administrators of the Ranksystem. They can manage the bot, like start and stop them. All parameters are defined in this place to individually configure the Ranksystem for the needed of your TS3 server. Sure, it is well documented directly inside the web interface.

Installation on Linux

1) Requirements

Before you can start running the TSN Ranksystem Bot on your TeamSpeak server, we need to check the requirements of your environment.

 

For the statistics page and to be able to run the Bot in a PHP process, we need a webspace (webserver).

 PHP 5.5.0 or higher
 PHP with privileges for the command "exec"
 PHP with unlimited script execution time; especially you should check this on a webhosting
 required PHP extensions:
- PHP PDO extension
- PHP PDO MySQL driver
- PHP cURL extension
- PHP Zip extension
- PHP OpenSSL extension
- PHP SSH2 extension
- PHP mbstring extension

 network connection to the TS3 ServerQuery of your TS3 server on TCP; default port 10011
 network connection to ts-ranksystem.com (IP: 164.132.201.2) on TCP port 443
 optional: job scheduler (for automatically restart the Bot) like a cronjob

The database will storage all information. This is necessary to get a real time statistic page.

 MySQL (or derivative like MariaDB)
 requires its own database
 required privileges:
- Data:
SELECT, INSERT, UPDATE, DELETE
- Structure:
CREATE, ALTER, INDEX, DROP

To connect with the TeamSpeak 3 server, we need access to the TS3 ServerQuery interface.

 Network connection between the webspace and the TS3 ServerQuery
 TS3 ServerQuery User with following permissions:
- b_virtualserver_info_view
- b_virtualserver_client_list
- b_virtualserver_client_dblist
- b_virtualserver_client_dbsearch
- b_virtualserver_client_dbinfo
- b_virtualserver_notify_register
- b_virtualserver_servergroup_list
- b_virtualserver_servergroup_client_list
- i_group_member_add_power
- i_group_member_remove_power
- b_icon_manage
- b_client_remoteaddress_view
- i_client_private_textmessage_power
- i_ft_file_browse_power
- i_ft_file_download_power

 

2) Download & Unzip

Download and unzip the file ranksystem_latest.zip.

 

3) Upload to webspace

Upload the whole unzipped folder to a directory on your webspace and grant permissions to the user of your webserver.

 

4) Run install process

Open the "install.php" on your browser and follow the instructions https://your.url/ranksystem-folder/install.php.

 

5) Configure webinterface

Configure the TSN Ranksystem about the webinterface https://your.url/ranksystem-folder/webinterface/.
For each parameter you'll find a documentation by mouse click on it.

 

6) Start Bot

Start the TSN Ranksystem Bot via the webinterface.

 

7) Add cronjob (optional)

Optional: Create a cronjob to be sure, the Bot is running 24/7. This will restart the Bot automatically, e.g. on a database restart.

Open a SSH session to the host machine of your webserver.

Enter the command crontab -e, go to editing mode (in VIM you need to press i).

Paste the following in a new line:

*/10 * * * * sudo -u www-data php /path_to_your_webspace/path_to_the_ranksystem/worker.php check >/dev/null 2>&1

Configure the path, where your TSN Ranksystem is located and replace www-data with the user of your webserver.

Save and quit the crontab (in VIM :wq).

Installation on Windows

1) Requirements

Before you can start running the TSN Ranksystem Bot on your TeamSpeak server, we need to check the requirements of your environment.

 

For the statistics page and to be able to run the Bot in a PHP process, we need a webspace (webserver).

 PHP 5.5.0 or higher
 PHP with privileges for the command "exec"
 PHP with unlimited script execution time; especially you should check this on a webhosting
 required PHP extensions:
- PHP PDO extension
- PHP PDO MySQL driver
- PHP COM extension
- PHP cURL extension
- PHP OpenSSL extension
- PHP SSH2 extension
- PHP mbstring extension

 network connection to the TS3 ServerQuery of your TS3 server on TCP; default port 10011
 network connection to ts-ranksystem.com (IP: 164.132.201.2) on TCP port 443
 optional: job scheduler (for automatically restart the Bot) like a task scheduler

The database will storage all information. This is necessary to get a real time statistic page.

 MySQL (or derivative like MariaDB)
 requires its own database
 required privileges:
- Data:
SELECT, INSERT, UPDATE, DELETE
- Structure:
CREATE, ALTER, INDEX, DROP

To connect with the TeamSpeak 3 server, we need access to the TS3 ServerQuery interface.

 Network connection between the webspace and the TS3 ServerQuery
 TS3 ServerQuery User with following permissions:
- b_virtualserver_info_view
- b_virtualserver_client_list
- b_virtualserver_client_dblist
- b_virtualserver_client_dbsearch
- b_virtualserver_client_dbinfo
- b_virtualserver_notify_register
- b_virtualserver_servergroup_list
- b_virtualserver_servergroup_client_list
- i_group_member_add_power
- i_group_member_remove_power
- b_icon_manage
- b_client_remoteaddress_view
- i_client_private_textmessage_power
- i_ft_file_browse_power
- i_ft_file_download_power

 

2) Download & Unzip

Download and unzip the file ranksystem_latest.zip.

 

3) Upload to webspace

Upload the whole unzipped folder to a directory on your webspace and grant permissions to the user of your webserver.

 

4) Run install process

Open the "install.php" on your browser and follow the instructions https://your.url/ranksystem-folder/install.php.

 

5) Set PHP Path

Set the path to the php.exe (PHP installation) inside the other\phpcommand.php. Examples you'll find inside this file.

 

6) Configure webinterface

Configure the TSN Ranksystem about the webinterface https://your.url/ranksystem-folder/webinterface/.
For each parameter you'll find a documentation by mouse click on it.

 

7) Start Bot

Start the TSN Ranksystem Bot via the webinterface.

 

8) Add new Task (optional)

Optional: Create a task inside the task scheduler to be sure, the Bot is running 24/7. This will restart the Bot automatically, e.g. on a database restart.

Windows help how to create a new task.

Add the following options:

C:\path\to\php.exe -f C:\path\to\Ranksystem\worker.php check

Configure the path, where you find your PHP installation and also the path where your TSN Ranksystem is located.

Get a hosting

When you are not able to host the TSN Ranksystem yourself, you can ask here for a hosting.

The hosting is absolutely free. If you want to support this service, donations are welcome. ;-)

If we accept your request, the hosting will remain as long as the Bot is running and able to connect to your TS3 server. Bots, which are offline for more than one week (=inactive) will be deactivated and after one additional week deleted.


Request a hosting

With the hosting we take the part of the requirements of the webspace and the database.
- You still need access to the TS3 server via ServerQuery; ServerQuery credentials (username and password) are required!
- Be sure your TS3 server allows a connection from our IP address 164.132.201.2.
- You should whitelist these IP also inside the query_ip_whitelist.txt, which you'll find inside the TS3 server installation directory.

 
 
 

After submitting your request it could take a few hours to create the hosting, cause we check each one manually! You will definitely get an answer. In case of accepting we will send you all needed information (hosting credentials & guide) via email.

Bot Commands

CommandParameterBot-AdminDescription
!help
!info
!cmd
!commands
- none -- / -Get a list of valid bot commands
Since version 1.3.0 it will sends you here.
!version- none -- / -Returns the current version under which the Ranksystem runs.
!update
!checkupdate
- none -requiredPerforms a check for new available updates.
Since the Ranksystem updates itself automatically, the update
process will be started as soon as a new version detected.
!next
!nextup
- none -- / -This checks the user-related required time to reach the
next higher rank. The investigated time will be sent as a private
chat message to the user.
!restart
!reboot
- none -requiredInitiates a reboot of the Ranksystem bot.
!shutdown
!quit
!stop
- none -requiredInitiates a shutdown of the Ranksystem bot.
!log
!logs
Parameter 1
number of log entries
expect number between 1 and 999

Example:
!log 5
This will give you the last 5 log lines.
requiredGet the last few log entries of the Ranksystem-Log
via private chat message.
!runtime
!runtimes
- none -- / -Get the last 10 runtimes of the Ranksystem bot.
Each value represents the needed duration for one round
of the bot, measured in seconds.
!uptime
!online
- none -- / -The bot sends the time of the last (re)start and
also calculates the online time.
!memory- none -- / -Get the needed memory the Ranksystem bot is using inside the PHP process.
PHP brings a overhead, so the PHP process on the system needs more memory.
!clean- none -requiredStarts the process of cleaning the user database.
It only takes effect when the function 'clean clients' is activated.
!reloadgroups
!reloadicons
- none -requiredCleans the group cache.
All server groups will be reloaded from the TS3 server and associated with this the group icons will be re-downloaded.
Also the server icon will be re-downloaded.
 

Changelog

Explanation

!   Note          (bigger) change you should notice of; in some cases there are things to do
*   Information   for your information, but there is nothing you need to do; changed something works in background
+   Feature       added a new feature or enhanced a feature
-   Bugfix        fixed a bug or corrected something
 
 

1.3.8 - NOT YET RELEASED

beta-1 * changed icon download as TS-iconid instead of servergroup-database-ID (needed for upcoming things)
beta-2 * changed icon download with file extension (determined with MIME-Type) to be able to support all official supported extensions by TeamSpeak (bmp, gif, jpg, pbm, pgm, png, ppm, svg, xbm, xpm)
beta-5 * updated russian language; thx to bykidi
beta-5 * updated czech language; thx to Stetinac
beta-7 * updated polish language; thx to toster234
beta-3 * little database optimizations; especially on table user_snapshot (reduced storage size to ~half)
beta-5 * added new check for duplicate client database IDs; this is important for the database optimization for table user_snapshot
beta-2 + added support for SVG icons (servergroup and servericon)
beta-6 + added to API an identification via API key; keys can be managed about the Ranskystem webinterface; usage /api/?apikey=XXXXX
beta-1 + added to API a function to get the online user
beta-1 + added check of multiple PHP versions also to the install process; to help to install the needed PHP extensions to the right PHP installation
beta-4 + added check for negative values of online time or idle time of a user (could happened about the administration function, when to much time was manually removed); this user will be set to zero, once with this update
beta-7 + several minor optimizations on the install process
beta-5 - fixed problem, when boost group was removed manually from a user; in this case the Ranksystem did remove the boost-group instantly on giving a new boost-group to the concerned user instead of taking care of the boost-duration
 

1.3.7 (2020-02-14)

! resorted webinterface, since we try to get a better structur, some things were also meaningful by adding the "expert mode"; 
! redesigned a few form fields inside the webinterface; for a better usability we replaced some fields with a drop-down field, where we have the selection (values) from the TeamSpeak server (e.g. client exceptions, servergroup exceptions); this is possible since we added the "easy mode" to the installation routine
* updated FontAwesome library to version 5.12.1
+ added an easy mode for fresh installations; it will display only the "TeamSpeak" site and the "Start / Stop bot" function inside the webinterface, until the bot is started for the first time; this is needed, since some (dropdown) fields will get its data from the TS server
+ added API for third party applications to get information as JSON string; the API is documentated by itself; simple open the URL and follow the instructions; available data are user (+stats), servergroups, serverstats & rank config; (we are curious what kind of ideas you have and what cool shit you will do with it :-P  on questions and also when you have notices, let it know us!)
+ added user friendly option to customize the "boost definition"
+ added "expert mode" inside the webinterface to toggle between a clearly / simply view (default) and the expert view with all functions / parameters
+ added check to prevent negative values on removing time (about the administrate function inside the webinterface); this could happen before, if a too large value was entered
+ added sorting for the servergroup selection inside the webinterface; the sort is now the same as in TeamSpeak; query and template groups are disabled
+ added function to "Select All" or "Deselect All" on multiple choice drop-down fields
- fixed empty error message due installation, when PHP-MySQL isn't installed / enabled
- fixed mistake on administrate function "remove time", when multiple users were selected; each second user got the time added instead of removed
- fixed problem with lost time (donwgrade some user), when the connection to the TeamSpeak server was lost
- fixed continuous download of "new ServerIcon"; happened in the rare case of changing the icon-date without changing the icon itself
- fixed lost check-icon on multiple drop-down boxes, with one of the last bootstrap updates
 

1.3.6 (2020-01-13)

! Hotfix
- fixed wrong check on reset password function (security issue)
 

1.3.5 (2019-12-23)

! Hotfix
- fixed problem loosing the rankup definition on saving options inside the webinteface core-site
 

1.3.4 (2019-12-23)

* optimized check for Bot name; added min-length of 3 characters to avoid errors due connecting virtual server
* updated hungarian language; thx to ExXeL
* little code optimization on reset password function for the webinterface
* updated Bootstrap-select library to version 1.13.9
+ added user friendly option to customize the "rank up definition"
+ added check PHP extension mbstring is loaded
+ added azerbaijan language; thx to G. FARZALIYEV
+ added new configuration parameter for the max. clients (red) line on the server usage graph on the statistics page
- fixed spelling error in russian language; thx to Alexander
- fixed "Undefined offset" on list_rankup.php, when stored servergroup of user (which is longer time offline) isn't existing anymore
 

1.3.3 (2019-07-26)

! new PHP extension mbstring is needed
* optimized SQL statement of building user_snapshots
+ added hungarian language; thx to ExXeL
- fixed handling user nicknames with multibyte characters and a length longer 30
- fixed PHP warning on stats/top sites, when servergroup exception is empty
 

1.3.2 (2019-07-01)

- fixed looping systems, when user nicknames are longer than 28 characters
 

1.3.1 (2019-06-30)

! new TS3 permission 'b_virtualserver_servergroup_client_list' needed for reset function
! new TS3 permission 'b_virtualserver_client_dbsearch' needed for special case cldbid has changed
* performance optimization with optimizing the SQL handling; a few statistic values will be cached inside PHP and only saved to DB, when changes have taken place
* updated jQuery library to version 3.4.1
* updated Bootstrap library to version 3.4.1
* changed Ranksystem log; added few more things to log during startup (loglevel, query-slowmode, update-channel); changed some things to be forced to log during startup, also when bot level is very low
* optimized downloading of servergrous & icons on TS3 errors (e.g. connection lost)
* minor code optimizations
* changed core rankup assigning; now check wrong server groups and remove them; if the current level is missed, correct it and add the server group
* changed navbar inside the webinterface to be more clearly and structured
+ added automatically language support; when you add a file inside the languages folder and it fullfill the name conventions, it will be added automatically; more information you will find inside the /languages/add_new_language.php
+ added check for changed client-database-ID (e.g. happens on restoring a server snapshot) for offline user; This check was still here, but only for online user; cldbid will be updated or the time of the user reset depending on specification of 'Client-database-ID reset'
+ added new function to reset the Ranksystem
+ added bot command !memory
+ added an average looptime to the !runtime command
- fixed "DateTime::__construct()" error on /stats/my_stats.php when boost function is defined with decimal numbers
- fixed "TS3 Error: 0: only available in non-blocking mode" on secured (SSH) TS Query connection
- fixed XSS vulnerability on /stats/ top users via client_nickname
- fixed online status of users; when the last user left the TS server, it stayed online on 'List Rankup' page
- fixed rarely constellation on update servergroups in bot core, when none of this groups have an icon and also no servericon is set
- fixed rarely constellation in bot core, when only user(s) without any country flag (pre-4: or without any platform or without any version) are online
- fixed wrong response on command !clean, that you wouldn't be allowed to use the command despite admin privileges
 
Show older entries

Support

Please report bugs and also feature requests preferred on GitHub.

You can also get support on our public TeamSpeak server ts-n.net.
Contact an admin there (server group: Ranksystem Staff Ranksystem - Staff). Please stay patient, when we don't react immediately. Please give us at least 10-15 minutes to response.

You want to ask for a free hosting? Have a look above to request a hosting.