The online racing simulator
Err.... never noticed that before:

Is it a normal behaviour that the "Airio Script v5.0.7 by mc0676: DB Updated SuccessFully" confirmation is sent to the public Airio chat?
Sure, if u want disable it simple edit script.php and delete this line at the end of the file:

echo "Airio Script v5.0.7 by mc0676: DB Updated SuccessFully";
Thanks, but I need this echo to verify if the script worked on a manually call.

However EQ suggested to call the script in the in the cfg. Will test it
Uhm if u put him in CFG i think that chat message will not displayed.
According con new kind of Airio files (tab separated) i've created under suggestion of EQ Worry a new script (u can see attached in first post) to manage this kind of file.

It works in this way:
- first copy in local from remote airio file (so u'll see in your web space two new files: cr.txt and un.txt);
- then manage and convert them in db.

Please report bug if u find one.

Thanks in advance.
THX Michele, seems to work great for us!
To be honest tab seperated works much much better than the current scripting setup.

You use far too much memory because all vars are being filled at once @file load.

Its much better to process line by line and tab separated files contain all information of a driver line by line.


// reading the txt file generated from Airio
$lines = file($file);

foreach ($lines as $line_num => $line) {
$cr_array = preg_split ("/[\s]*[\t][\s]*/", $line);

$username = $cr_array[0];
$trackname = $cr_array[1];
$carname = $cr_array[2];
...
...

Interesting, thanks for suggestion.
Thanks mate, in the same server script load was reduced from about 35 to 8 seconds, incredibile.

Thanked in readme.txt file.
Quote :from about 35 to 8 seconds, incredibile.

Sppeeeddd

Even further optimization is possible when you do not empty all data from database but records last_update ..

Like this...

// getting file modification date
$file_lastupdate = filectime($file);

Log it like this @end..

$sql = "update airiotable_lastupdate set lastupdate='$file_lastupdate'";
mysql_query ($sql, $db);

Reading it again when processing new data;

$sql = "SELECT lastupdate FROM `airiotable_lastupdate`";
$lastupdate = mysql_result( mysql_query ($sql, $db) ,0);

Use field which I requested to change by EQ Worry;

$last_update_crrecord = $cr_array[32];

And only do insert or updates on the database table based on timestamp;

if ($last_update_crrecord >= $lastupdate) {
//print_r($cr_array);

$sq = "SELECT *
FROM `airiotable`
WHERE `username` = '$username'
AND `trackname` = '$trackname'
AND `carname` = '$carname'";
$sql = (stripslashes($sq));
//echo $sql."\r\n";
$result = mysql_query($sql, $db);

if (mysql_num_rows($result)==0) {
$sq = "insert into airiotable (username, trackname, PB, PBtime, carname, totallaps, pointsc, champspt, PBsplit1time, PBsplit2time, PBsplit3time, PBsplit4time, TBsector1time, TBsector2time, TBsector3time, TBsector4time) VALUES ('$username', '$trackname', '$PB', '$PBtime', '$carname', $totallaps, $pointsc, $champspt, '$PBsplit1time', '$PBsplit2time', '$PBsplit3time', '$PBsplit4time', '$TBsector1time', '$TBsector2time', '$TBsector3time', '$TBsector4time')";
$sql = (stripslashes($sq));
//echo $sql."\r\n";
mysql_query($sql, $db);
}
else {
$sq = "update airiotable set PB='$PB', PBtime='$PBtime', carname='$carname', totallaps=$totallaps, pointsc=$pointsc, champspt=$champspt, PBsplit1time='$PBsplit1time', PBsplit2time='$PBsplit2time', PBsplit3time='$PBsplit3time', PBsplit4time='$PBsplit4time', TBsector1time='$TBsector1time', TBsector2time='$TBsector2time', TBsector3time='$TBsector3time', TBsector4time='$TBsector4time' WHERE username='$username' AND trackname='$trackname' AND `carname` = '$carname'";
$sql = (stripslashes($sq));
//echo $sql."\r\n";
mysql_query($sql, $db);
}

}

Right now you refresh all MySQL data every time and MySQL don't like that
[6.0.0 > 5.0.7 TAB]
- new ordering system based on date of pb too (THIS VERSION SUPPORT ONLY TAB_SEPARATED Airio Files)
Quote from michele0676 :[6.0.0 > 5.0.7 TAB]
- new ordering system based on date of pb too (THIS VERSION SUPPORT ONLY TAB_SEPARATED Airio Files)

Hummm..thanks, but how I upgrade old ones? Simply copy these new php-files to server? Should I change old Airio database?
File changed are:
tab_script.php
page.php
page2.php

then u've to update table structure, because there a new column.
Quote from michele0676 :
then u've to update table structure, because there a new column.

I added this new "time" column manually to database (between champsptt and PBsplit1time and now all works fine.
Many thanks to you and continue the good work!
Nice
v6.0.1 is out, in 6.0.0 there was a minor bug in page.php and page2.php, simple owerwrite these files.
Sry.
I've got a problem

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '<!-- v6.0.0 --> CREATE TABLE IF NOT EXISTS 'airiotable' ( `username` varch' at line 1

Anyone got this error too?
Quote from KassadGLA :I've got a problem

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '<!-- v6.0.0 --> CREATE TABLE IF NOT EXISTS 'airiotable' ( `username` varch' at line 1

Anyone got this error too?

'<!-- v6.0.0 --> CREATE TABLE IF NOT EXISTS 'airiotable' (`username`, `varch`'

I would imagine that would fix it.
no, it says that all the code is 1 line and all the line have wrong syntaxis and doesn't work
Delete this:
<!-- v6.0.0 -->

in your sql form.
#98 - [d9]
hallo michele0676,

thanx for your nice work. i have few suggestions/requests for future development of your scripts:

i dont completely understand, why the table creation script (mysql instructions.txt) is used manually and it is not a part/included of code and is not automatically used (detection if table does not exist yet)? - i am sorry if it was already discussed or explained.

i am uploading stats to my web hosting at some intervals by ftp upload function of airio (zipped archive) - is there any chance you can add some function to directly handle of that zip archive, or i overlooked another possibility to upload 2 required stat files separately by airio on hosting server (sorry then again )?

eventually i have improvement idea inspired by this - http://lfs.deadmen.co.uk/airiostats/ - something like quick links to the most used or last used combos placed on main frame

with regards

d9
Thank u mate, but since my script is unsupported from mine from a long time.

Reason as many, the first is this "LFS develop" sleeping that is very booring and annoying so since i'm locking for other SIMS from some months.
hey...
I try to launch AirioScript v 5.07 but I have this problems

Warning: file() [function.file]: URL file-access is disabled in the server configuration in ............../script.php on line 21

Warning: file(direct link to Airio.sta.cr.txt) [function.file]: failed to open stream: no suitable wrapper could be found in ............../script.php on line 21

Warning: file() [function.file]: URL file-access is disabled in the server configuration in ............../script.php on line 159

Warning: file(direct link to Airio.sta.un.txt) [function.file]: failed to open stream: no suitable wrapper could be found in ............../script.php on line 159
Airio Script v5.0.7 by mc0676: DB Updated SuccessFully

line 21 -> $var2 = file($file);
line 159 -> $var3 = file($file2);

i changed script.php file permision is 774 is it correct?

Does this warnings mean that server where is AirioScript block files or there where are cr.txt and un.txt?

In config.php i have
$file = "here direct link to Airio.sta.cr.txt";
$file2 = "here direct link to Airio.sta.un.txt";

Had anybody that kind of problems?

FGED GREDG RDFGDR GSFDG