JTS3ServerMod Hosting Edition
Web Interface
Programmer: Stefan Martens

E-Mail:
info@stefan1200.de

Homepage:
http://www.stefan1200.de


This is just an additional readme file to the web interface. Please read the bot readme file first!


-= Additional copyright =-
In addition to the bot readme file:
This web interface use icons from the free Silk icon set 1.3.
You can download this from the following website: http://www.famfamfam.com/lab/icons/silk/


-= Information =-
This web interface allows you to create, configure and control virtual bot instances.
You can also register users to this web interface, to allow them to create, configure and control its own bots.
It is possible to allow or disallow guest registration to the web interface and bot creation by normal users.


-= Different Admin Levels =-
This web interface has two different admin levels:
- (Full) Administrator / database value adminlevel at table jts3servermodwebui_users: 2
- Restricted Administrator / database value adminlevel at table jts3servermodwebui_users: 1
The full administrator can do everything.

The restricted administrator can't do the following things:
- Delete or edit user accounts
- Create new administrator accounts
- Set new default bot settings (for the bot creation page)
- Change web interface settings

If bot creation is disabled for normal users, restricted bot administrators can create a new bot only on the server
of the saved default bot settings. They can choose the virtual server port / id, but they can't change or see
the server address or query login details.


-= System requirements (Server) =-
The following things you need:
- Hosting Edition of the JTS3ServerMod with enabled MySQL mode and Query Interface.
- Webspace with PHP 5.4+ support with Session (more details below), Socket (fsockopen), mbstring, Mail (more details below) and MySQLi support enabled.
- To support the SSH query interface of the TS3 server 3.3.0 or newer you need the PECL libssh2 library for PHP (optional, more details below).
- If using Apache web server, please activate mod_access_compat (Apache 2.4) or mod_authz_host (Apache 2.2).
- For security reasons you should disable the PHP setting allow_url_include.
- MySQL database version 5.5.3 or higher. Tested it also successfully with MariaDB 10.1.3.


-= System requirements (Client) =-
Any modern browser supporting HTML, CSS and JavaScript on Smartphone, Tablet or PC.
Should work on every browser released after the year 2012.
Internet Explorer 9 and older are not supported! Windows 7 users should update to Internet Explorer 11,
Windows Vista and XP users please use another browser!
Tested on Firefox (Windows, current version), Chrome (Windows and Android, current version) and Internet Explorer 11 (Windows).
All browsers which use a newer version of the Gecko, Blink or Trident Engine should work.
Never tested the WebKit Engine, but since Blink is a WebKit fork, it should work too.


-= Installation =-
First you have to enable some stuff at the JTS3ServerMod.
Open the JTS3ServerMod_InstanceManager.cfg config file,
now make sure that you configure the MySQL support and the Query Interface of the JTS3ServerMod.
Activate both features by setting telnet_enable and mysql_enable to 1!
Don't forget to set a password with at least 6 characters at telnet_password or the Query Interface will be disabled.
Also make sure that you enable the following setting:
telnet_run_forever = 1
This is needed for the web interface or the JTS3ServerMod process will quit if all virtual bot instances are stopped.
Also make sure, that you put the IP address of the Web Interface to the setting:
telnet_whitelist = 
If the JTS3ServerMod and the Web Interface runs on the same machine, use 127.0.0.1 here.
Set a MySQL account at mysql_user and mysql_password with the following permissions to the database you set at mysql_database:
SELECT, INSERT, UPDATE and DELETE.
You can add yourself to the bot_fulladmin_list. All other config files of the bot can be ignored!
If you have this steps done don't start the bot. You have to install the web interface first.

Now put the web interface files to a webspace and make sure that PHP has write permissions in the config directory.
Open the file install.php with your browser. Put all needed informations in that form and save them.
Important: If your MySQL database is empty, make sure that you enable the option "Create tables in database?"!
Make sure that the Web Interface and the JTS3ServerMod use the same MySQL database.
The MySQL account of the Web Interface needs the following permissions to the specified database:
ALTER, CREATE, DELETE, DROP, INSERT, SELECT, SHOW and UPDATE.
If no error occur you can now login with the admin login details you specified at the installation
using your browser on index.php. After login you should choose "Settings" at the top menu.
Configure the Web Interface on this page and make sure to enter the right information for the Query Interface of the JTS3ServerMod.

The last step is starting the bot. You can read in the bot readme file how this work.
If the Web Interface has problems while connecting to the JTS3ServerMod, always check the JTS3ServerMod_InstanceManager.log file too.

As soon as everything is running, just disable the maintenance mode in the web interface settings. That's it, have fun.


-= Useful information =-
The bot and webinterface don't have to be on the same machine, but they have to share the same MySQL database.
Of course the webinterface and/or bot can use a MySQL database on a remote server.
Please check first if remote access has to be enabled at the webserver or MySQL database.

If you have problems after login to stay logged in at the web interface,
make sure that you set the following settings at the php.ini file of your web server containing the web interface:
session.save_handler = files
session.save_path = to a valid and write able path
session.use_cookies = 1

If the web interface can't send mails on a Linux web server, please read the following manual,
to know how to configure the PHP mail function:
https://www.stefan1200.de/forum/index.php?topic=387.0

If you get internal server errors (code 500) while using the install.php, make sure that you have installed
the PHP MySQLi module and activated the Apache mod_access_compat (Apache 2.4) or mod_authz_host (Apache 2.2) module.

If you get an "Call to undefined function mb_internal_encoding()" error, make sure that you activated the PHP mbstring module.

You can get the PECL libssh2 library for PHP from this website: https://pecl.php.net/package/ssh2
Make sure you install the right library for your operating system and PHP version.
If you need the .dll file for Windows and PHP 5.6, get them from here: https://phpfashion.com/php-ssh2-dll-for-php-5-6-and-7-0
The php_ssh2.dll or php_ssh2.so file has to be in the PHP ext directory and has to be activated in the php.ini file.


-= Updating Web Interface =-
Important: As always: Do a database backup every time before you update!
If you made own modifications to the web interface, you have to do them again after updating the web interface!

Since Web Interface 3.0 / Build 3000 it is very easy to update the web interface.
Just replace all files of the web interface, open the web interface in your Browser and login as administrator.
If you are already logged in, make sure that you visit the bot list page first!
You may have to accept a message, that an automatic database update is needed, done. No more steps to do!

I try to write down every changed and added files of the update in the changelog_webinterface.txt.
But this is only important for you, if you made changes to the files.
If all files are still original, just replace them all.