INFiltration:WebTools:readme.txt
Written by Kai Dietrich   
Wednesday, 03 January 2007
INF_WebTools
============
(c) 2004 by Kai "Cleeus[JgKdo]" Dietrich and Jochen "[121st]jbJOGI" Bühler

What are the INF_WebTools?
--------------------------
The INF_WebTools package is a set of (serverside) WebApplications for the UT-Mod  INFiltration 
(http://www.sentrystudios.net/ or http://infiltration.sentrystudios.net/) and some additional
bash and PHP/MySQL scripts.
It consists of 3 parts: WebStat, WebCtrl and WebAdmin

- WebStat accepts a HTTP GET request with parameters and then returns information
according to the paramters.
- WebCtrl accepts a HTTP GET request with parameters and the executes something inside of UT.
- WebAdmin is a new version of the INF WebAdmin (called NG-WebAdmin) and has support for 
mutators (via plugins), the configuration of WebStat and WebCtrl and more (faster loading, 
more options).

If you combine these tools with some php or shell scripts you have a powerfull combination
to eg. remote-control your server or include live server data into you homepage. All you 
have to do is to assemble a HTTP GET request and parse the reply from the server.

How do I install the package on my server?
------------------------------------------
1. shutdown your UCC server
2. The first step is to bring the files to the right place. Normally you will just have to 
extract your archive to the right place. If not then:
- copy the INF_WebTools.u, INF_WebTools.ini and INF_WebTools.int to your /ut/System directory
- copy the .uhtm and .css file(s) to /ut/Infiltration/NGWeb

3. Edit you Infiltration.ini:
a)
replace:
[UWeb.WebServer]
Applications[0]=INF_Admin.INFServerAdmin
ApplicationPaths[0]=/ServerAdmin
Applications[1]=INF_Admin.INFImageServer
ApplicationPaths[1]=/Images
with:
[UWeb.WebServer]
Applications[0]=INF_WebTools.INFw_WebAdmin
ApplicationPaths[0]=/ServerAdmin
Applications[1]=INF_WebTools.INFw_WebStat
ApplicationPaths[1]=/Stat
Applications[2]=INF_WebTools.INFw_WebCtrl
ApplicationPaths[2]=/Ctrl

b)
replace:
[UWeb.WebResponse]
IncludePath=../Infiltration/Web
with:
[UWeb.WebResponse]
IncludePath=../Infiltration/NGWeb

4. assure that
[UWeb.WebServer]
bEnabled
is set to True (this will enable all listed WebApplications)
Do NOT!!! make the INF_WebTools package a serverpackage.

5. IMPORTANT!!!
Set the admin users and passwords for WebCtrl and NG-WebAdmin in the INF_WebTools.ini

6. restart your server

The initial startup of the server is slower then normal since the server
has to bind some ports. The mapchange still works as fast as usual.

How do I use WebCtrl?
---------------------
Send a HTTP request to http://127.0.0.1:9090/Ctrl/ (replace 127.0.0.1 with the IP of your 
gameserver and 9090 with the listen port of your UWeb-Server)
WebCtrl accepts 2 parameters:
'action' - specifies what you want to do
'do' - general purpose parameter

The following actions are supported:
exec - performs the content of 'do' as a UT-ConsoleCommand on the server
       (with Level.ConsoleCommand(do); ).
       Note: This is the most powerfull tool if you use it right.
kick - kicks the player named 'do' from the server
kickban - kickbans the player named 'do' from the server
summon    - creates the actor named 'do' at a random position in the map (uses pathnodes)
log - puts the content of 'do' into the UT-Log
myip - returns your own IP
echo - returns the content of 'do' (for debuging purposes)
addbots - adds 'do' bots
webstat_register - makes the WebStat instance (if running) register itself with the master servers
webadmin_template - makes the WebAdmin instance (if running) apply a new template to the server
resetgame - resets the game/rounds (Level.Game.ResetGame)

examples:
http://127.0.0.1:9090/Ctrl/?action=kick&do=l33t-5n1p3r
http://127.0.0.1:9090/Ctrl/?action=exec&do=set+Engine.GameInfo+GamePassword+pw4war
http://127.0.0.1:9090/Ctrl/?action=exec&do=exit

howto apply a template to a server:
http://127.0.0.1:9090/Ctrl/?action=webadmin_template&do=EAS+-+Respawns
http://127.0.0.1:9090/Ctrl/?action=resetgame
http://127.0.0.1:9090/Ctrl/?action=exec&do=servertravel+EAS-INF-Tuscany.unr \
    %3Fgame%3DINF_GameTypes.INFg_EAS%3Fmutator%3DINF_Mutators.RollingM67

How do I use WebStat?
---------------------
Send a HTTP request to http://127.0.0.1:80/Stat/ (replace 127.0.0.1 with the IP of your  
gameserver and 80 with the listen port of your UWeb-Server)
WebStat is a little bit more complicated. It accepts multiple parameters and which ones 
depends on the gamemode of your server. WebStat has a so called GameModeInterface (GMI) 
for each supported GameType. These classes are all derived from INFw_GameModeInterface and 
it is very likely that a certain GMI is also derived from INFw_GMI_default which supports 
the basic UT information and therefore works for all GameModes (more or less good).
When a new map is loading, WebStat creates a new instance of either the GMI it decides to 
fit best, or, if you want, The GMI class you specified in the .ini. This means, as a 
programmer you could add a GMI-class to your new gamemode mutator and it is also supported 
by WebStat.
In the following i will explain the accepted parameters for the built-in classes:
INFw_GMI_default:
all=1    -     shows everything
sli=1    -    shows info about WebStat itself (used seperator, version, currently used GMIclass, ...)
mpi=1    -    shows info about the current map (map name and filename, ...)
emp=1    -    shows info about the mapcycle, camos and maplist settings
gai=1    -    shows info about the current game mode
sri=1    -    shows info about the servers basic setting like the servername, passworded?, maxplayers
esi=1    -    shows extended server info like MaxClientRate, TickRate, mutatorlist, mapcycle
mti=1    -    shows info about the current running match
pli=1    -    shows info about the players (names, frags, pings, ...)
txt=1    -    shows additional info about the server given by the admin

INFw_GMI_TDM:
everything GMI_default supports
gas=1    -    shows game settings (like number of rounds to play, timelimits, ...)
emi=1    -    shows extended match info (team stats, camos, ...)

INFw_GMI_CTF:
everything GMI_TDM supports

INFw_GMI_EAS
everything GMI_CTF supports

examples:
http://127.0.0.1:9090/Stat/?all=1
http://127.0.0.1:9090/Stat/?mti=1&pli=1&sri=1&esi=1

MasterServers? Huu? What?
-------------------------
WebStat supports a MasterServer concept. This means it can send a heartbeat to a maximum 
of 32 MasterServers which you can specify in the .ini or via the NG-WebAdmin. This server 
can then create a serverlist and use the WebStat of these gameservers. Now you could say, 
that we already have this via the GameSpy protocoll, but GameSpy uses UDP. WebStat instead 
uses HTTP (TCP) and therefore a masterserver can be simple PHP+MySQL WebSpace. Also TCP is 
much faster then UDP in PHP.

Basically WebStat generates a HTTP GET requests with 2 parameters:
?port=1234&path=/Stat/
"port" is the port the gameservers webserver is listening on.
"path" is the path under which the webstat application can be found.

If the masterserver receives such a request, it can stripe the IP out of the socket. With  
this it has all that is needed to query the gameserver via udp and/or tcp.

NG-WebAdmin Plugins
-------------------
The new NG-WebAdmin has plugin support. This means every mutator programmer can write an   
addition to the webadmin without replacing it or hacking into it.
To write such a plugin you need to create a seperate package (because of package 
dependancies) which will be serverside only. This package will be dependant from 
INF_WebTools and you mutators, your mutators will stay indepentant.
In this new package you create a new class and derive it from INF_WebTool.INFwa_Plugin. 
Inside this class you need to define the files your plugin will support and give the links 
for the navigation menu. Now you can implement one or more new pages for all your 
published mutators.
The integration into the NG-WebAdmin is done by an .int file. Look at the INF_WebTools.int 
which comes with this package, it's pretty much self-explanatory.
To use such a plugin you just have to activate it under 'Plugins' in the menu, restart 
your server (either by an automatical ar manual mapchange) and resfresh your browser 
window.

Security?
---------
WebStat, WebCtrl and NG-WebAdmin support the same security concepts.
These concepts are:
1. username/password limitation - required for WebCtrl, optional for WebStat
2. IP Policies - You can specify certain rules that work nearly the same way the UT 
policies work except that you have and additional rule called 'TRUST' which disables the 
following MaxConnectionsPerIntervall restriction:
3. max connections per intervall - you can specify how man requests 
(ini:MaxRequestsPerIntervall) your server should accept in a given intervall 
(ini:RequestsIntervall).

UT Server Technology
--------------------
I do strongly recommend to use the UT4.51 Patch from www.utpg.org for the server. 4.51 
allows (besides alot of other IMPORTANT!!! improvements and security fixes) the access of 
array-elements via the set and get console command which makes WebCtrl an even more 
powerfull tool. UT4.51 also fixes the UWeb Server under Linux.

Troubleshooting
---------------
In case the server doesn't register properly, check the followins things:
- WebStat mustn't have a password to be accessible for the masterserver
- Your UDP/GameSpy querying has to work, otherwise the masterserver thinks your server is invalid
- If you'r server runs behind a firewall, check if you opened the proper ports
(usually 7777 UDP for the Game, 7778 for GameSpy, 80 for the WebTools - you can set these  
ports to a different number if you want)
- Are the masterserver addresses correct?
A masterserver address is a normal http URI in the form of http://hostname:port/path
eg. http://www.combatmaps.de:80/WebStat/register_server.php

More questions?
---------------
read the code ;)
Or ask me via ICQ, email or the INFiltration Forums.
(http://forums.beyondunreal.com/forumdisplay.php?s=&forumid=19)

Suggestions?
------------
You can send suggestions directly to me (
 This e-mail address is being protected from spam bots, you need JavaScript enabled to view it
 ) or post them on the INFiltration  
Forums. (http://forums.beyondunreal.com/forumdisplay.php?s=&forumid=19)

Credits:
--------
UnrealScript Code written by:
- Cleeus[JgKdo]
- Harper[JgKdo]
- Exorzist[JgKdo]
PHP/MySQL scripts by:
- [121st]jbJOGI
- Cleeus[JgKdo]
Thanks to:
- Beppo for the permission to modify his webadmin
- The INF Team for this great mod
- Dirtfinger[FOOL], XploD[FOOL], [121st]PsyGer, {GD}Odie3, [C22]Dragoon, 
[C22]Mort and  shan for testing
Last Updated ( Wednesday, 03 January 2007 )