LiveTiming - Live website statistics for iRacing.com events
Developed by: Fernando Birck - www.fergonez.net

############################

1) Instalation instructions:

LiveTiming now offers two broadcasting methods: using a remote PHP file that is stored in a webhost of your choice, or using the internal LiveTiming webserver.
Depending on which mode you decide to go with, you'll have to modify some files. The first one is the JS. Open 'script.js' from the folder 'website\files' into a text editor like Notepad.

You'll see these lines:

	var url = "http://yourip:5050/";
	var autorefresh = 30000;
	
	//var mode = "webserver";
	var mode = "php";
	
##LT Webserver mode

If you want to use the internal webserver, uncomment "mode = webserver" and comment (//) "mode = php". You'll also need to setup the "url", pointing it to your IP address. Port 5050 is the default one, but now you can choose the which port you will use inside the software. Be careful if you chose port 80 or 8080 (standard HTTP server ports), as most residential ISPs block outgoing connections from it.

##PHP mode

If you choose the PHP mode, you only need to make sure you have the line "mode = php" uncomment inside this file. You can leave the rest as it is. As the PHP mode creates a file in the host folder, make sure that folder have writing permissions (chmod). In this mode, you will also need to edit "config.php". Open it up. You'll see these lines:

	$endsession = true;
	$endtime = 120;
	$authkey = "mypassword";
	
$endsession, if set to true, will stop displaying the race stats after certain time without updates from LT server. This time is specified by $endtime variable, in seconds.
$authkey is the authentication key that LT server will use to broadcast the data, which should be the same password used in LT server. This is needed to avoid people from messing up with the statistics.

Then you just have to upload everything from the website folder.

############################

2) Usage

After setting up the javascript files and uploading the website to a host, you need to setup the server, which is pretty straightforward. LiveTiming supports iWrap, so you can use it along other iRacing plugins.

Join an iRacing session (spectator recommended, but not necessary) and then run LiveTiming and connect to the API. Race statistics should be displayed very soon. Then you can start broadcasting that.

#LT Webserver mode
Choose the port (which needs to be the same one configured in the javascript file) and click "Broadcast"

#PHP mode
Choose the interval between updates where the data is sent to the PHP file
Setup your authkey, which should be the same from "config.php"
Point to the "data.php" on your webhost.

############################

3) Troubleshooting

3.1) LiveTiming crashes when connecting to the API

	Make sure the iWrapClient.dll is in the same folder. If the problem persists, run LT as Administrador

3.2) LiveTiming is running but nothing appears at the website

	Give LT some time until it gets all the needed information from iRacing. When the session info appears in LT, it usually means that everything 	is ok. Also make sure you don't have a firewall blocking incoming connections to LT and that port is open in you router (if applies).
	
3.3) I can't see stats from PHP mode

	Check if there's a file "lasttiming" in your host. If not, then there's probably a permission problem. Make sure you run chmod in that folder and give writing permission