##########################################################
#							 #
#		UGHStats Web Interface			 #
#		         Version 1.0.0			 #
##########################################################

This guide will help you install UGHStats and the web interface on a Unreal 1 Server of your choice.

======
Credits:
======
Daniel Kelly aka AcidRain - UGHStats stats compiler/Web interface/Database development
Wolf - Netecho listening server/UGHStats mutator for UteamFix10+
Smartball - Modified Netecho listening server/UGHStats mutator for EDM5+
Pitbull - Initial planning/ideas
BrakeDanceJ - Initial planning/ideas
WunSick - Interface designing
TheNerdNetwork.net - Testing/Hosting/Funding for UGHStats Web Interface

=============
Requirements:
=============
Software:
Webserver (preferrably IIS for Windows-This documentation is based on IIS) (or Apache - http://www.apache.org)
PHP 4.x or 5.x (http://www.php.net)
MySQL 4.x or 5.x (http://www.mysql.com)
Java Runtime Environment (http://www.java.com)
Unreal 1 Server running UteamFix 10+ or EDM5+ running on Windows

Hardware:
2 mb disk space MINIMUM 100+ mb disk space RECCOMMENDED (the installation of UGHStats itself is around 2 MB but the database size can increase substantially depending on the amount of players in your server)

===================
Note before Install
===================
Some parts of this can run on Windows or Linux, but we prefer Windows for this install.

This ENTIRE install is based around IIS running on a Windows computer. If you do not use IIS and use a different webserver, you should use the base directory for HTTP documents at your webserver root.

**** THE THEORY ****
This is how this program works, this will help you along the way in case you just dont get it...

Unreal 1 Server (Match ends) => Data sent to Listening Server => Listening Server Outputs logs to /logs
=> chopper.php retrieves the logs and seperates all of the data out and recalculates the stats database

The Web Interface never changes, just accesses the database for ALL information regarding the query.

**** MYSQL IMPORTANT INFO ****
If you are accessing a database on a remote server, make sure your IP is on the MySQL access-list, or you will get query failed.

**** FIREWALL IMPORTANT INFO ****
Make sure all of your applications are allowed as exceptions for windows firewall, or you are going to have all sorts of issues as this is built entirely of network comms.


=============
Installation:
=============
Assuming you have installed ALL of the above required Software, then you may continue.

There are 3 seperate installations that need to take place. I will explain each one, this is just a simple readme on how to get the stats working, it is up to you to read into other readmes to get the full workings of UGHStats.

Firstly, the Web Interface and the listening server both will share a directory on the physical game server machine. We need to create this, do the following:

Create a directory named "ughstats" (minus parentheses) in the folder: c:\inetpub\wwwroot

***********************************
***Listening Server Installation***
***********************************
First step is to setup the UGHStats listening server to accept stats coming in from Unreal 1 and make them into log files.

*Extraction of Listening server
- Open Listening Server folder
- Open netecho-modified ZIP
- Extract files in this ZIP to c:\inetpub\wwwroot\ughstats

*Installation and Use of Listening server
- Create a directory called "logs" (minus parentheses) in c:\inetpub\wwwroot\ughstats 
- Open config.txt
- Change LogDirectory to c:\inetpub\wwwroot\ughstats\main\logs\ (MUST BE \main\logs otherwise logs will not be read, stored but not read, and MUST have trailing slash)
- Save config.txt

This completes the Listening Server installation, to run this, double click netecho.bat and it will begin accepting Logs.

Keep in mind that this CREATES the logs, if it doesnt run, NO new logs will be produced, and any game data created while the server was NOT running will be lost forever.

**********************************
***Unreal 1 Server Installation***
**********************************
Second step is to install UGHStats onto your Unreal 1 server, allowing Unreal 1 to put out stats.

You need to consult the ReadMe files for UTeamFix or for EDM to install this onto your server. The Listening Server IP is that of your local computer that you installed the Listening Server on. Default port 23.

Here is some ReadMe stuff you will find interesting:

UTeamFix Readme: It is in the Unreal 1 Server directory in the uteamfixfiles directory, these are needed files and readmes. (Note the Running part, everything else is useless for end users)
EDM Readme: http://www.smartball-unreal.com/EDM/Manual/Settings.html (Read under [EDM5_Server.EDMBaseMut] )

********************************
***Web-Interface installation***
********************************
Third and final step is to setup the web-interface to fetch the stats, insert them into the database, and then allow them to be displayed on your website.

There are 2 types of installs here, to make this easier to explain, we will be loading ALL files/folders in Web Server directory, keep that in mind.
Make sure you Read the description before following the directions!!! You can get lost here...

*Install Type 1
I am running UGHStats Web Interface (People will view there stats here), my Unreal 1 Server, my Listening Server, and my MySQL Database on this computer...

You can lay your directory structure out how you want, but this is what we did:

- Create a new directory called "stats" (minus the parentheses) in c:\inetpub\wwwroot
- Copy ALL files as they reside in Web Server directory to c:\inetpub\wwwroot\stats
- Run the automatic installer - http://localhost/stats/setup.php
- After setup is complete it is REALLY important to delete setup.php

After this you will be able to access your stats locally at http://localhost/stats and publicly at http://IPOFCOMPUTER/stats
You may need to port forward port 80 to your local IP for TCP/UDP and give your real IP out, find out here: http://www.whatismyip.com

All done!

*Install Type 2
I am running my Unreal 1 Server and my Listening Server on this computer, The UGHStats Web Interface and MySQL database are on my Webhost's server...

+++++++Things to do on Web Server computer (where the web interface will be)++++++++
- Create a new directory called "stats" (minus the parentheses) on your remote webserver
- Copy ALL files as they reside in Web Server directory to the newly created stats directory
- Run the automatic installer - http://www.MYWEBSITEADDRESS.com/stats/setup.php
- After setup is complete it is REALLY important to delete setup.php
+++++++Things to do on local server (where listening server/unreal 1 server reside)++++++++
- Create a new directory called "stats" (minus the parentheses) in c:\inetpub\wwwroot
- Copy ALL files that reside in Web Server directory to c:\inetpub\wwwroot\stats
- After setup is complete it is REALLY important to delete setup.php

*Developer Hosting
If you have no idea what you are doing, or dont want to set this all up, The Nerd Network Gaming Services can setup, and host your UGHStats Web Interface for you, however, there is a premium that would need to be paid. Dont worry, its not expensive!

***********************************LOG PARSING!!!!!!************************************************
This is a very VERY critical part, as this is how new data will be loaded into your database.

There is 2 ways (1 Linux, and 1 Windows) to import data automatically and 1 way to do it manually...

*Automatically
- Linux - Cron Job - (You need 1 of these two packages installed: GET or lwp-request (unless you have another text webbrowser))
Every 5 minutes
lwp-request: */5 * * * * lwp-request http://IPOFCOMPUTER/stats/chopper.php
GET: */5 * * * * GET http://IPOFCOMPUTER/stats/chopper.php > /dev/null

- Windows - Scheduled Task - (For fast use, you can use the tool UGHUpdater.bat in the Additional Tools folder, it may need modified for your install)
- Copy UGHUpdater.bat from the Additional Tools folder to c:\inetpub\wwwroot\ughstats
- Open Control Panel
- Open Scheduled Tasks
- Double Click Add New Task
- Browse to c:\inetpub\wwwroot\ughstats and select UGHUpdater.bat
- Set how often you want it to run
- Authenticate
- Save

*Manually
- Access http://localhost/stats/chopper.php


==============
Configuration:
==============
There will be more ways to change UGHStats to better fit your needs, but this is the maiden voyage of UGHStats, and it may not be worth adding more features to it.

// config.php
In the config.php there are options that can be changed, all of them as a matter of fact. Please make sure any changes you make are INSIDE the quotes

$dbhost = The IP address of the MySQL server. Typically it is localhost
$dbname = The Database name the UGHStats will be using
$dbuser = The username with ALL privileges that UGHStats will be using
$dbpass = The password for the username that UGHStats will be using
$cfgfrags = Points that a frag is worth it needs to be a positive number
$cfgdeaths = Points that a death is worth. This is usually a negative number (include a - sign)
$cfgsuicides = Points that a suicide is worth. This is usually a higher negative number (include a - sign)
$maxresults = This option is used in the ranking page, it is legacy for the rest of the script however.

===========
Disclaimer:
===========
Please note this software is freeware under the GPL. We hold no responsibility for it. No support is offered, unless it comes from the general public. It was written as a cool toy for the Unreal 1 community, but we cannot support every bit of it.

Also, we cannot, and WILL NOT provide any support for PHP/MySQL/Java/Apache or anything else related to the dependancies of this program. You must read on how to set everything up at the software distributor's website.
