View Full Version : How to retrieve LFS World stats?
Victor
12th August 2005, 00:51
Hello stats lovers :)
This thread is for you if you are looking to gather LFS statistics and process them for displaying on your own website. It is for that purpose that I've created the Pubstat system, which is a webbased system where you can request all kinds of LFS racing statistics and information.
If you would like to know how it works, please read the following block of text, which should explain everything to you clearly :
NOTE 1 - if you are just looking to show the status of your host(s) on your webpages then you can use this URL :
Format : htp://www.lfsworld.net/hoststatus/?h=[HOSTNAME]
Example : http://www.lfsworld.net/hoststatus/?h=Blackwood%20XFG%20XRG (http://www.lfsworld.net/hoststatus/?h=Blackwood%20XFG%20XRG)
You can use the output of that URL directly in an iframe, or if you append '&onlycontent' to the URL it will only output the actual content html and exclude the html header stuff.
You can also create your own stylesheets if you want and send them to me so you can use them.
NOTE 2 - as of 6 Nov 2006, identification has become obligatory. You must use the IdentKey or otherwise your Pubstat script will not work! See below for more information.
Live for Speed Pubstats S2 v1.5 (19 Feb 2011)
CHANGELOG :
v1.4 => v1.5
------------
NEW ?action=counters - get global car/track lapcount
NEW ?action=help - displays the full pubstat help text (omitting ?action will do the same)
?action=wr - added timestamp
?action=ch - added optional country filter
?action=teams - added optional team filter to search for only one team instead of downloading the whole list
?action=pb - added fuel data (Given in % of tank capacity)
v1.3 => v1.4
------------
NEW ?s=1/2/3 - alternate output formats can be selected (JSON, PHP Serialized, XML)
NEW ?action=fuel - returns fuel usages of a racer
?action=hl - added timestamp
?action=pb - added split times and timestamp
?action=pst - added racer's country
?action=pst - removed credits
?action=ch - added id_hl
?action=wr - added track and car query options
?action=teams - added team id
?action=hosts - added country code
?action=hl_log - removed 'format' query option. Use the global alternate output formats instead
v1.2 => v1.3
------------
?action=teams - changed teamname & url length from 64 bytes to 128
?action=hl - added split times
?action=ch - added split times
?action=wr - added split times
?action=pst - added details about current or last online activity
-------------------------------------------------------------------------------------
Legend: (all output is in plain text, unless specified otherwise)
-------------------------------------------------------------------------------------
<track> 3 digit representation.
000 (BL_gp), 001 (BL_gp_rev), 410 (KY_national, etc (game order)
<car> 3 character representation.
XFG, XRG, XRT, RB4, FXO, LX4, LX6, MRT, UF1, RAC, FZ5, FOX, XFR, UFR, FO8, FXR, XRR, FZR, BF1
<racer> a valid LFS username
<laptime> a laptime represented in milliseconds
<splitX> a splittime represented in milliseconds
<lapcount> number of laps
<fuel> Fuel needed for a lap. Given in % of tank capacity
<steering> w, m, ks, kn
<flags_hlaps>
1 LEFTHANDDRIVE
8 AUTOGEAR
16 SHIFTER
64 BRAKEHELP
128 AXISCLUTCH
512 AUTOCLUTCH
1024 MOUSESTEER *
2048 KN *
4096 KS *
(*) if not 1024, 2048 or 4096, steering is wheel.
<id_hl> ID used for hotlaps download : http://www.lfsworld.net/get_spr.php?file=<id_hl>
<id_wr> ID used for wr-hotlaps download : http://www.lfsworld.net/get_spr.php?file=<id_wr>&w=1
<log_filter> 1=WR's - 2=top10 - 3=top50 - 4=ALL
<starttime> Unix timestamp (UTC) - used for hotlaps upload log; only display entries newer than <starttime>
<timestamp> Unix timestamp (UTC)
-----------------------------------------------------------------
-----------------------------------------------------------------
Version numbers
---------------------
Since v1.1, Version numbers have been introduced, to make future updates easier while not having to disrupt your existing scripts. If you were already running a script, you don't have to change anything, unless you want to make use of the new features that come with the latest versions.
The current version is v1.5
Version numbers should be indicated in the url, via the "version" variable. If no version variable is given, the latest version will be used.
User-identification (login / Ident-Key)
--------------------------------------------
The option to identify yourself has been introduced in v1.2. From then on identification has been voluntary, but since v1.3, identification is obligatory for all. You cannot use Pubstat without identification. This is not so that we can play big brother - it is so that we get a clearer picture on the usage of Pubstat, since this is a large portion of LFS World traffic.
Identification is also meant to make the Premium Pubstat service possible.
There are two ways to identify yourself:
1) Using an Ident-Key which you can generate on behalf of your account on the LFS World settings pages
You can feed an Ident-Key to the pubstat script via the following variable:
&idk=<Ident-Key>
If you bind an IP address to an Ident-Key, then pubstat will make sure that only that IP address can use that Ident-Key.
or
2) Using your normal web-login (from your LFS account), via the following two url-variables :
&user=<username>
&pass=<password>
== Password Notice ==
<password> may be your password in plain text, or you can md5 it before sending (strongly recommended).
== Password Notice ==
FREE PUBSTAT vs PREMIUM PUBSTAT
------------------------------------
Pubstat usage is free, but there is a tarpit that forces you to wait 5 seconds between your requests.
It is for this reason that the Premium Pubstat version has been made available.
The Premium Pubstat version allows you to place unlimited requests without any tarpit. However each request costs £0.00001 and every MB of data you transfer costs £0.0015.
So if you want to make use of the Premium Pubstat service, you must put some extra money on your LFS account. You can do that from LFS World's "My LFSW Credit" window.
You can indicate in your Pubstat request URL that you want to make use of the Premium service by including the following variable : &ps=1
By doing so (and if you have money on your LFS account), you can place as many requests as you like, without having to wait.
SCRIPT LOCATION and ACTIONS (requests):
---------------------------------------
script url: http://www.lfsworld.net/pubstat/get_stat2.php?version=1.5&idk=<Your_Ident_Key_Here>&action=...
?action=help
------------
(returns this same document)
----------
?action=hl
----------
(get all hotlaps of a racer)
requires: &racer=<racer>
optional: -
returns: <id_hl> <track> <car> <split1> <split2> <split3> <laptime> <flags_hlaps> <timestamp>
----------
?action=ch
----------
(get all entries of a specific hotlap chart)
requires: &track=<track>&car=<car>
optional: &control=<steering>&country=<country>
returns: <id_hl> <split1> <split2> <split3> <laptime> <flags_hlaps> <racername>
----------
?action=wr
----------
(get wr's, either all or by track and/or car)
requires: -
optional: &track=<track>&car=<car>
returns: <id_wr> <track> <car> <split1> <split2> <split3> <laptime> <flags_hlaps> <racername> <timestamp>
----------
?action=pb
----------
(get all online pb's of a racer)
requires: &racer=<racer>
optional: -
returns: <track> <car> <split1> <split2> <split3> <laptime> <lapcount> <timestamp> <fuel>
------------
?action=fuel
------------
(get all fuel/lap tank percentages of a racer)
*NEW as of version 1.4*
requires: &racer=<racer>
optional: -
returns: <track> <car> <fuel>
-----------
?action=pst
-----------
(online statistics of one racer)
requires: &racer=<racer>
optional: -
returns: distance in metres
fuel burnt in cl
laps
hosts joined
wins
second
third
finished
quals
pole
drags
drag wins
country
online status (0 = offline, 1 = spectating, 2 = pits, 3 = in-race)
current / last hostname (or blank line if not online or on hidden host)
last_activity_time(*) (Unix timestamp (UTC))
current / last known track(*)
current / last known car(*)
(*) not always available.
-------------
?action=hosts
-------------
(get host list & information and online racers)
requires: -
optional: -
returns: HOST STRUCT:
HOSTNAME char[32]
TMLT byte[4]
TCRM byte[4] // Track, Config, Reversed, Max players allowed
CARS uint
RULES uint
LAPS byte
QUALMINS byte
COUNTRY char[2]
NROFRACERS byte
RACERNAMES char[24 * NROFRACERS]
LAPS work like this:
L is the given Laps value
0=practice
1-100=laps
101-190=110-1000 laps... 100+(L-100)*10
191-238=1-48 hours... L-190
TMLT means:
Type 0 : old S1 / 1 : new S1 / 2 : S2
Main version times 10 (e.g. 5 means version 0.5)
Letter e.g. 'Y' in 0.5Y
TestId zero : official / non-zero : test patch id
(*) TRC is in numbers:
000 = bl1
001 = bl1r
010 = bl2
..
220 = fe3
221 = fe3r
..
etc.
cars bits:
XFG 1
XRG 2
XRT 4
RB4 8
FXO 16
LX4 32
LX6 64
MRT 128
etc etc
rules bits :
CAN_VOTE 1
CAN_SELECT 2
QUALIFY 4
PRIVATE 8
MODIFIED 16
MIDRACEJOIN 32
MUSTPIT 64
CAN_RESET 128
FCV 256
CRUISE 512
-------------
?action=teams
-------------
(get the entire teams database stored on lfs world)
requires: -
optional: &team=<teamname> (displays only the given team)
returns: TEAM STRUCT:
TID int;
TEAM char [128]
TAG char [6]
COUNTRY char [32]
URL char [128]
BITS int;
INFO_LEN word (2 bytes)
INFO char [INFO_LEN] (Note : urlencoded)
NR_MEMBERS word (2 bytes)
MEMBERS char [24] * NR_MEMBERS
BITS :
// 1 : race
// 2 : drift
// 4 : drag
// 8 : can apply
// 16 : has host
// 32 : Demo
// 64 : S1
// 128 : S2
// 256 : S3
--------------
?action=hl_log
--------------
(get latest entries from the hotlap upload log)
requires: &version=1.2 (or higher)
optional: &log_filter=<log_filter>&lines=[1-150]&control=<steering>&starttime=<starttime>
returns: preformatted text, "<u>18:36/05-01-2006</u> <b>sanxav</b> has uploaded a new hotlap to 4th place: <b>1:56.240</b> on <a href="http://www.lfsworld.net/?win=hotlaps&whichTab=trackcharts&track=as&config=national_rev&car=XFR&racer=sanxav" target="_blank"><b>AS national rev</b> with the <b>xf gtr</b></a>\n"
NOTE - use the alternate output formats to gather raw information instead of the preformatted html-lines
Variables :
<timestamp>
<racername>
<country>
<track>
<car>
<split1>
<split2>
<split3>
<split4>
<pos>
<flags_hlaps>
<id_hl>
----------------
?action=counters
----------------
(get global lapcounts of all cars and tracks)
requires: &type=(car|track)&version=1.4(or higher)
optional: -
returns: <car>|<track> <lapcount>
-------------------
Output compression
-------------------
(The output this script generates can be gzip compressed in 3 ways)
&c=1 gzencode
&c=2 gzcompress
&c=3 gzdeflate
------------------------
Alternate output formats
------------------------
Normally, pubstats will return data in the format as explained above with every ?action.
There is however an option to have the data returned to you in different formats, such as JSON, PHP Serialized and XML.
To select an alternate output type, append one of the following query variables :
&s=1 JSON
&s=2 PHP Serialized
&s=3 XML
NOTE 1 - XML output has a Content-Type: text/xml header, unless c=2 or c=3 is used. With c=1, a Content-Encoding: gzip header is sent, so that for example browsers can understand the compression.
-----
An additional funny is the online-highlights-log-per-country that you can get in .txt format (linux, so with \n line breaks, as is always the case on our sites really) :
http://www.lfsworld.net/highlight_countries/highlights_<Country_Name>.txt
***<Country_Name> Mind the capitals and underscore for spaces.***
Example: http://www.lfsworld.net/highlight_countries/highlights_United_Kingdom.txt
For use on your own site :)
-----
Any questions? Something obvious missing? Please post them in this thread. Thanks and good luck (re)writing your scripts :)
Victor
PS - since version numbers are introduced now, I'll attached every version's "readme" here.
CrazyICE
7th November 2006, 14:34
the timestamp is GMT 0?
traxxion
7th November 2006, 14:54
Something obvious missing?
<car> 3 character representation.
XFG, XRG, XRT, RB4, FXO, LX4, LX6, MRT, UF1, RAC, FZ5, FOX, XFR, UFR, FO8, FXR, XRR, FZR, BF1
? :)
jscorrea
7th November 2006, 17:04
Vic, in this line:
online status (0 = offline, 1 = spectating, 2 = pits, 3 = in-race)
For me appear blank when the racer is offline.
JS
HorsePower
7th November 2006, 17:07
A question here:
I extract host infos from the host list. I get everything right (cars, rules, qual mins, ...).
But reading the LAPS-Byte, I get 0 (=> practice) if no race is started (i.e. if the server is empty or people are in qualifying).
I thought the LAPS byte would just tell me, what the nr of laps in a (possible) race on this server is.
Take a look here (http://hot.german-gamers-club.de/index.php?id=16&lang=0) to see the output of my server script.
Thanks for any help.
Victor
7th November 2006, 17:59
the timestamp is GMT 0?
it's UTC.
Vic, in this line:
online status (0 = offline, 1 = spectating, 2 = pits, 3 = in-race)
For me appear blank when the racer is offline.
JS
Which in turn equals 0 equals offline?
And did you read the (*) note?
A question here:
I extract host infos from the host list. I get everything right (cars, rules, qual mins, ...).
But reading the LAPS-Byte, I get 0 (=> practice) if no race is started (i.e. if the server is empty or people are in qualifying).
I thought the LAPS byte would just tell me, what the nr of laps in a (possible) race on this server is.
Take a look here (http://hot.german-gamers-club.de/index.php?id=16&lang=0) to see the output of my server script.
Thanks for any help.
Laps byte does show what number of laps is set on a host. The value explanations for this byte are noted above in the text. There's nothing more or less about it. That's what it is.
When a server is in qualifying mode, then you should see the QUALMINS byte is not 0 (but LAPS is)
if (qualmins) host is qualifying
else if (laps) race is in progress probably, or about to start
else practise mode
Victor
7th November 2006, 18:04
btw to all, the following line in the PST stat is buggy atm :
current / last car
This will be fixed in patch V, so you might not wanna take this value too seriously just yet.
DANDAMAN05
7th November 2006, 22:51
ok guys. all this looks really interesting, however i am not one for writing scripts. if anyone has a template script i could use i would be ever so greatfull. i hope someone can help.:)
thanks :thumb:
DANDAMAN05
7th November 2006, 23:16
nevermind, spoke to victor already :)
theblackrabbi
10th November 2006, 13:58
Here is a funny question, excuse me for asking but can I put this on a myspace profile?:)
http://www.myspace.com/giggalowbiggalow:)
glyphon
10th November 2006, 16:07
i don't know. what kind of stuff can you add to myspace pages? this is typically done through PHP, although there are some php scripts that generate images with the stats on them...but those still require a host that can process PHP to generate the images.
if you have such a thing, i'm going to be posting an updated version of my script soon that adds in some of the new functionality.
if you just want a simple image that shows if you are online or not, then look to this thread (http://www.lfsforum.net/showthread.php?t=14762)...all you would need to do is copy the url that is in that thread.
example : http://www.lfsworld.net/isonline.NickSpeed.gif -> http://www.lfsworld.net/isonline.NickSpeed.gif
if you want more, and have a host that can run PHP, then my script might work for you.
joshdifabio
11th November 2006, 13:40
Is there any way the hotlap id could also be given when retrieving all the hotlaps from a certain chart? The nation would also be useful, basically everything which you can get from the hotlap log. I doubt this will get added as i don't know if anyone other than myself would want it, but it would also be cool if the drivers' team could be included in the hotlap log and the other hotlap requests.
Thanks, Josh
mosquito25
12th November 2006, 16:28
Maybe I'm wrong, but I think there's a problem ATM.
I think Premium access restriction coud be really usefull, in case of IdentKey pishing. ATM it's quite easy to change from free acces to Premium acces, needs only adding &ps=1 at the end of the URL.
If I can obtain an IdentKey, I can use all credits on the corresponding account, I just have to use this identKey for my requests, with &ps=1. A simple "Allow Premium access (with fees)" checkbox with each IdentKey could solve this problem.
Cheers ;)
Victor
12th November 2006, 16:30
if you're afraid about your identkey being misused, then you should bind an ip address to the identkey and it's safe from tampering basically
mosquito25
12th November 2006, 16:39
U know, in some cases, it's unusable : in France, 80% of ADSL connections use a dynamic IP, like mine. So if I do that, I'll have to update my IP on LFS World twice or more a day (some disconnections) to use mates@tracks or Mysolc (french program). Not really easy.
Victor
12th November 2006, 16:47
ok, but
If I can obtain an IdentKey, I can use all credits on the corresponding account,
How exactly would you get an IdentKey in the first place?
And how would you add a pubstat premium restriction?
A simple "Allow Premium access (with fees)" checkbox with each IdentKey could solve this problem.
No it would not, because then you still have exactly the same situation as now.
The main idea : don't give away your identkey. And phishing for them is overrated imho. How are you going to phish for someone else's idkey, especially if the people you talk about are on their own home networks, to which you have no access to?
mosquito25
12th November 2006, 16:57
How exactly would you get an IdentKey in the first place?
Like creating a free of charge mates@track or Mysolc program, but mine sends IdentKeys by mail. j/k ;)
No it would not, because then you still have exactly the same situation as now.I can have 3 IdentKeys. I create 2, the first one allowing Premium Acces, the 2nd disallowing it. I use the first one only in my own programs or websites, and I don't really care for the 2nd one.
The main idea : don't give away your identkey. And phishing for them is overrated imho. How are you going to phish for someone else's idkey, especially if the people you talk about are on their own home networks, to which you have no access to?I understand your point of view, and I agree with that. But I have to trust programs which need my identkey for normal purposes. I trust mates@tracks and Mysolc, but who knows for next ones?
Victor
12th November 2006, 16:59
So in the end your question is more like, do i entrust 3rd party applications with my identkey?
mosquito25
12th November 2006, 17:15
So in the end your question is more like, do i entrust 3rd party applications with my identkey?
Not really. It's a only a part of the question.
For example, I trust my bank, I have an internet access to my account, I can pay fees using internet & so on.
But if my bank didn't gave me the required security level, I would not use all these features.
For example, besides account, password and https access, they sent me a card with 72 different codes, and ask for one of these codes (randomly) each time I try to make money orders or anything like that. After 3 mistakes, the internet acces to my account is locked, and they send me a mail.
IMO, as you store money on the LFS account, and give users a possibility to use it by a simple URL, you have to give them sufficient security level, and IMO, it's not the case ATM.
Maybe I'm paranoid ;)
Victor
12th November 2006, 17:20
but, you don't use any 3rd party applications for internet banking. The two are hard to compare imo.
I need some time to think about it. In the end, it still comes down to whether you can trust 3rd party applications - no matter how much safety I code for on my side.
You may not use a 3rd party app with Premium Pubstat, so you might be helped with a checkbox that allows you to create Premium IDKeys, but this will not help those that do use a 3rd party app with a Premium IDKey. See the problem?
mosquito25
12th November 2006, 17:33
Now I totally agree with you.
Like I've said above, if I need a Premium Pubstat access, AND use of one or more third party programs, I'll create 2 IndentKeys, one absolutely private for the Premium acces, and the 2nd one, disallowing Premium Acces for all third party programs. And I don't care the 2nd one could be sent by email, used by someone else with an &ps=1, coz the checkbox disallows Premium acces.
IMO default checkbox value is disallow, of course (Yes, I'm really paranoid :D)
15th internet disconnection in 2 hours, f***ing telephone line and f***ing router using 6db noise margin :(
joshdifabio
12th November 2006, 21:45
That's a no then i guess..?
Victor
12th November 2006, 22:15
not for now, no. Could be done with a next version.
joshdifabio
12th November 2006, 22:36
Ok, thanks for the reply.
Josh
HorsePower
13th November 2006, 11:21
EDIT: Solved. And really don't know how. Must have overseen a bug. :x
I think I found a strange thing, which I don't understand:
I'm programming a team tracker for my team, which means that I have to refresh all PB's and HL's of my mates every now and then.
Since I use the free pubstats, I have a certain sleep time between two queries.
Now my strange observations:
If I use uncompressed LFSW output, everything works fine with 6 seconds intervals.
If I use compressed output (tested &c=2 and $c=3), the first query works ok, while from the second query - no matter what interval I use (tested up to 120 seconds) - I get the "can't reload this page that quickly after another" error.What's wrong here? :scratchch
nikka
20th November 2006, 17:10
btw to all, the following line in the PST stat is buggy atm :
current / last car
This will be fixed in patch V, so you might not wanna take this value too seriously just yet.
The "online status" line is not 100% right all the time either.
Victor
20th November 2006, 17:32
That one too is related to the same problem. Will be fixed in patch V. For now you could assume 0 is offline and > 0 is online.
GFresh
21st November 2006, 07:57
Has anyone got a sample script they could share with me, i'm really only just getting into this kind of thing and don't know where to start. If i could look at a sample then i could work it out from there.
Thanks for any help guys!
filur
21st November 2006, 08:41
Has anyone got a sample script they could share with me, i'm really only just getting into this kind of thing and don't know where to start. If i could look at a sample then i could work it out from there.
Thanks for any help guys!
If you're using PHP you might find this useful: http://www.lfsforum.net/showthread.php?t=13328
Latest update here: http://www.lfsforum.net/showthread.php?p=261505#post261505
Viperius
2nd December 2006, 11:12
Quick question regarding the identification keys. I'm updating the LFS module for mUtil ( http://users.pandora.be/viperius/mUtil/ ) as it didn't work anymore with the 1.3 update. It now works again (not yet deployed); however i'm using my own ident key. Is this a problem seeing multiple people will use this program to retrieve the hosts info? The ident key should be coupled to an application instead of a user account in this case. I could off course require the users to enter their own ident key, however that option isn't very user friendly imo.
KayJay
17th December 2006, 01:19
Hi Victor,
I use the hosts action to generate a server status table. With patch U32 I've noticed the the patch version number is missing from the data so all subsequent bytes are out by one. This has generated some wierd output :) I pressume this is a stats issue and not a patch issue.
Patch U32, byte 32 onwards (TML TCRM)
02 05 55 00 01 01 0D
Patch U30, byte 32 onwards (TMLT TCRM)
02 05 55 1E 20 01 01 0D
Do the stats not like hex 20 ;)
Victor
17th December 2006, 09:38
my guess is it's patch related, since after some debugging I see that what I get from LFS are 3 bytes with the latest patch and not 4. So hopefully this'll be fixed soon.
Does this bug really break your output? I can remove these 3-byte TMLT hosts for now if needed.
Victor
17th December 2006, 10:40
ok, it's not patch related. It was me noob long time ago - related :)
It was a wrong data storage type in the db for TMLT values - fixed now.
KayJay
17th December 2006, 16:01
Thanks Victor, that works perfectly now :)
Kind Regards
KayJay
Falcon1
21st January 2007, 10:26
Hi,
I have a script to check for racers currently online at my team's forum.
It used to function properly until today.
The output pubstat gives me is "no output"
I execute the following script "http://lfsworld.net/pubstat/get_stat2.php?action=hosts&idk=...."
What could be wrong?
Knarf
4th February 2007, 13:21
Quick question regarding the identification keys. I'm updating the LFS module for mUtil ( http://users.pandora.be/viperius/mUtil/ ) as it didn't work anymore with the 1.3 update. It now works again (not yet deployed); however i'm using my own ident key. Is this a problem seeing multiple people will use this program to retrieve the hosts info? The ident key should be coupled to an application instead of a user account in this case. I could off course require the users to enter their own ident key, however that option isn't very user friendly imo.
Since I am a big fan of mUtil and waiting for ages for this patch (I even created my own buddy thing for LFS for private use).
The main reason Viperius hasn't released an update is because his questions didn't get answered.
The questions are:
- Is it allowed to create an application using a fixed ident key (in this case Viperius personal key). If this application gets used by hundreds of people will the key get banned for 'excessive use' ?
- Is the non-premium delay based on the ident key or the IP ? If hundreds of people use the same key will they get extremely long waiting times because the key is being used by others. Or is it just the same as before with no key when the delay was based on IP ?
Victor
4th February 2007, 21:36
Since I am a big fan of mUtil and waiting for ages for this patch (I even created my own buddy thing for LFS for private use).
The main reason Viperius hasn't released an update is because his questions didn't get answered.
The questions are:
- Is it allowed to create an application using a fixed ident key (in this case Viperius personal key). If this application gets used by hundreds of people will the key get banned for 'excessive use' ?
- Is the non-premium delay based on the ident key or the IP ? If hundreds of people use the same key will they get extremely long waiting times because the key is being used by others. Or is it just the same as before with no key when the delay was based on IP ?
I don't wanna sound cranky, but what do you think?
1) if someone wants to give his identkey to everybody - it's stupid, but hey if he really wants to, be my guest.
2) the idk tells me a username - that's what it's based on. If hundreds of people use that same key then of course it's not gonna work at all.
he just needs to code an input box where people can enter their own idk. Done.
filur
5th February 2007, 06:55
Ideas. :)
Don't allow premium usage unless a key has been set to allow it.
Add request function to account pages at liveforspeed.net, push button-receive idkey.
LFS(W) command /idkey, put response in clipboard, echo "go paste the key in your app". Don't accept paste from clipboard in LFS until contents have changed.
LFS command line switch /idkey, popup dialog "do you want to request a key", returns key.
Knarf
5th February 2007, 11:34
I don't wanna sound cranky, but what do you think?
I thought it was no problem to do this. Cause in the past I had the following conversation with you
http://users.pandora.be/riptor/victor.png
1) if someone wants to give his identkey to everybody - it's stupid, but hey if he really wants to, be my guest.
Why ? If it is a premium account you pay for others but with other accounts I don't see the problem?
he just needs to code an input box where people can enter their own idk. Done.
What about all those league-websites that have a server-status thing on their mainpage showing who is online at their server at the moment ? Or which drivers of the league are online on which server ? That is also used by lot's of different people and I never have seen such a website ask me for my ident key.
I know it is the webserver doing those requests but infact it is just the same. Multiple users using the same ident key. But if you use a web application it is allowed, and otherwise it is not allowed ?
Dygear
5th February 2007, 12:43
What about all those league-websites that have a server-status thing on their mainpage showing who is online at their server at the moment ? Or which drivers of the league are online on which server ? That is also used by lot's of different people and I never have seen such a website ask me for my ident key.
That is one query to LFSWorld tho via `?action=hosts`. All you have to do is look for the users that way. You can also get the users on your own server that way also. You also could use an InSim application to talk back to your website and give even more information from the server.
We are talking about "programming your way out of a paper box". It's not hard, if you have the right tools, or happen to be handy with some some kind of cutting device (InSim, neat an tidy.), or you could burn a hole in the side (LFSWorld query via hosts command, good but does not tell the full story), or you could impale it hundreds of times until the walls become weak (Get all of the users in your league and query each one of them via ?action=pst, slow and cost more money in the end.).The best solution would be the cutting device.
I woke up on the 'smart arse' side of the bed today.
Victor
5th February 2007, 12:45
like I said, you _can_ share it, but you'll be paying for all usage from everybody using it. If you don't mind that, who am I to stop you?
I know it is the webserver doing those requests but infact it is just the same.
No it's not. A webserver is a centralised place that uses pubstat. It can cache all the requests it makes for optimal usage of the data it retrieves. If 10 people visit the site and see the 'who is online list', the webserver maybe had to make 2 pubstat requests depending on how frequently it wants to update the list.
If you instead have 10 separate clients, then every client will have to make a pubstat request -> more requests.
Additionally, if these 10 people do a simultaneous request on the webserver, it'll work fine.
If 10 separate clients make simultaneous requests, it will work for 1 and fail for the other 9 (if they share 1 identkey).
Of course this last one only applies to the free pubstat - if all 10 clients were to use a premium identkey, then it would still work. But it would also have worked for free if they had used their own identkey.
Anarchi-H
5th February 2007, 13:10
Victor;
Do you think there would be any sense in adding a 'since' parameter that takes a timestamp and returns results for the given pubstat since that timestamp?
I suggest this because for things like pbs, hls and hostlist we are requesting all of the data time and time again when in fact the vast majority of it has not changed. Kinda redundant.
Obviously, this would depend on how your schema is laid out and whether you store a timestamp for the relevant data (which if you dont at present, you should look in to for optimal replication in the future).
As long as you have an index on the timestamp this would reduce database load, web server bandwidth (on both sides) and computational cost (again, on both sides).
Just a thought :scratchch
Knarf
5th February 2007, 16:43
That is one query to LFSWorld tho via `?action=hosts`.
I know... mUtil in my opinion also does just one query (it did not wrote it but I am pretty convinced it only does that 1 request).
@Victor:
If we create a small application that does a ?action=hosts request every ten minutes and cache the result of this query on our own server and let mUtil talk to our cached page that would be ok I presume ? Or do you get banned from pubstat when sending 1 requests 24/7 every 10 minutes ?
Victor
5th February 2007, 17:21
Noone will ever get banned for using the pubstat (well, extremely unlikely anyway). All the tarpitting is put in place to prevent abuse, so use it as you see fit.
CodieMorgan
18th February 2007, 16:10
uhhh.. before I try this....
the script URL...
Should I <?PHP Require_once '<url>'; ?>
Just checking... full example isn't present!
Anarchi-H
18th February 2007, 16:54
uhhh.. before I try this....
the script URL...
Should I <?PHP Require_once '<url>'; ?>
Um ... no. Remote inclusion is bad m'kay? If you make frequent (or any) use of it you should be severely beaten with teaspoons.
See http://www.lfsforum.net/showthread.php?t=13328 for some code that will do it for you. If you want to write your own, you could always just look at the code presented there to see how you may go about it.
Dygear
11th March 2007, 11:59
See http://www.lfsforum.net/showthread.php?t=13328 for some code that will do it for you. If you want to write your own, you could always just look at the code presented there to see how you may go about it.
Awe shucks, you love me, you really love me!
I've done some work on the SDK, but have not updated the on line code with it. I'll get around to it ... just not right away.
vane
1st April 2007, 00:15
is there any html code that i can put on my website that says what server im on? like the thing at the left side that in the column near you username, thanks
oh by the way what is an identikey and what do they do?
Victor
1st April 2007, 00:20
one plain HTML link - nope.
Someone recently asked the same question : http://www.lfsforum.net/showthread.php?t=16687
joshdifabio
5th April 2007, 21:06
Under "?action=hl_log" there is this comment for time:
"// upload-time (unix timestamp, GMT+1 (UK))"
Does this mean the timestamp is given in GMT+1, not UTC / GMT..?
Victor
5th April 2007, 21:12
hmm i guess that's a mistake and should be GMT (EDIT - BST actually) (uk time, so atm UTC + 1)
actually i never thought about it - is the unix timestamp actually utc and does our server's locale interpret it as uk time automatically?
joshdifabio
5th April 2007, 21:22
GMT = UTC. British time at the moment = BST = GMT + 1.
My team's server runs in Finnish time (Currently UTC + 3) but all timestamps are still recorded in UTC. I was under the impression that unix timestamps were usually kept in UTC time.
I would think that the timestamp is actually UTC, otherwise what would happen in October when UK time goes back one hour? You would have later entries in the database having earlier timestamps.
If I understand what you are saying, I would guess you are right. Your server keeps the timestamps in UTC, but I believe the function date(timestamp) will give a date and time in the server's current timezone.
EDIT:
Just to confirm:
http://www.lfsworld.net/pubstat/get_stat2.php?version=1.3&action=hl_log&idk=IDKEY&format=2
gives timestamps in UTC time.
Victor
5th April 2007, 21:25
makes sense :)
joshdifabio
7th April 2007, 17:04
Hi Victor, I have another couple of questions for you ;).
Regarding the hotlap log; is it possible that when you specify a start time, you could, theoretically, miss a hotlap/hotlaps? My thinking behind this is that if, say, you specify starttime=x, where x is the last time you requested the log, and there was a hotlap uploaded in the same second you made the request, but after you did so, it will not then show up on either requests and you will miss it.
Obviously this is unlikely to happen, but I was just wondering if it was possible. If so, I will simply specify a start time of 1 second earlier than my last request, and implement a check for the hotlap IDs. You may think I could just implement this easily and save the trouble of asking... My OCD won't allow this though :p.
Secondly, would it be possible to get an alternative version of this page http://www.lfsworld.net/highlight_countries/highlights.txt which is not preformatted? I.E. track configurations in either the numeric (410) or short (KY2) form, no hyperlink around the username and the lap times in milliseconds? Maybe XML format would be good.
Thanks,
Josh
Dygear
8th April 2007, 10:05
joshdifabio:
If you build it, they will come!
It seems to me, that the LFSWorld is done in PHP. So what you could do is make out an PHP program that will convert the stats for your self and then display it on here. How knows? Vic might just use it!
bdshan
15th May 2007, 13:30
In the lastest test patches car reset is a server side setting. Is there going to be a new rules bit for this option in the host data?
Victor
15th May 2007, 15:24
please let me get back to you on that in a little while. Probably the answer is yes.
CrazyICE
17th May 2007, 16:11
have you changed something in the script.
cause my tools get strange data!
it seems that it have something to do withe all the test patch versions (Patch Wxx)
Victor
18th May 2007, 00:29
no i haven't touched it - too busy moving servers.
Falcon1
18th May 2007, 09:57
When I call the pubstat2 service i get "no output" (yesterday it was working correctly)
Victor
18th May 2007, 10:13
is that with any query? Or for example just the hostlist?
It could be in that case, that your lfsworld.net (or com - best use net) dns has not yet updated.
Ian.H
18th May 2007, 10:23
All's still working fine for me here. My app is still collecting PB and WR data correctly at least.
Regards,
Ian
Victor
18th May 2007, 10:26
just make sure it does connect to the new IP - the old IP is still active as well.
well, it'll go to the new IP anyway, eventually :)
Anarchi-H
18th May 2007, 11:34
Something has changed... First instance I see is today from AS2F was @ 06:52:23 (GMT)
I've trimmed some of the gumph.
[18-May-2007 06:52:23] PHP Warning: Encountered an LFSWorld error! ('no output') in /home/sites/ixulai.co.uk/libs/misc/error.php on line 8
[18-May-2007 06:52:23] http_request Object
(
[_url] => net_url Object
(
[url] => http://www.lfsworld.net/pubstat/get_stat2.php?idk=***&action=hosts&c=2
[protocol] => http
[host] => www.lfsworld.net
[port] => 80
[path] => /pubstat/get_stat2.php
[querystring] => Array
(
[idk] => ***
[action] => hosts
[c] => 2
)
)
[_method] => GET
[_http] => 1.1
[_requestHeaders] => Array
(
[User-Agent] => PEAR HTTP_Request class ( http://pear.php.net/ )
[Connection] => close
[Accept-Encoding] => gzip
[Host] => www.lfsworld.net
)
[_sock] => net_socket Object
(
[addr] => 213.40.196.93
[port] => 80
[timeout] => 5
[lineLength] => 2048
)
[_timeout] => 5
[_response] => http_response Object
(
[_sock] => net_socket Object
(
[addr] => 213.40.196.93
[port] => 80
[timeout] => 5
[lineLength] => 2048
)
[_protocol] => HTTP/1.1
[_code] => 200
[_headers] => Array
(
[date] => Fri, 18 May 2007 05:52:32 GMT
[server] => Apache
[content-length] => 17
[connection] => close
[content-type] => text/plain
)
[_body] => xÚËËWÈ/-)(-
There are plenty more instances of this if you need.
Victor
18th May 2007, 11:55
old ip :
[addr] => 213.40.196.93
new ip :
213.40.20.2
Anarchi-H
18th May 2007, 12:25
That'd be it then :-)
Some more recent debug entries show the dns has updated now and haven't had any obscurities beyond my own code since.
:thumb:
CrazyICE
18th May 2007, 18:02
well, today it's ok again...
hmmm..
Dygear
19th May 2007, 10:02
Temp fix for the old DNS screwing with your program (If your using windows) is to open the hosts file and just add the lfsworld.net and the new ip address. I'm sure that there is something like this in Linux also.
the_angry_angel
19th May 2007, 10:18
Yes. The hosts file, which was "stolen" (borrowed might be a better terminology) from unix in the first place.. hence why it's under etc\hosts in Windows - to mirror /etc/hosts under other OS'.
CrazyICE
11th June 2007, 15:17
well, I often get empty server names etc.
has something changed since the Wxx-Patches and the patch X.
Cause before Wxx-Patches everything was ok?
Is the way the data is send by the script differnent?
hackerx
11th June 2007, 15:29
Noticed that action=wr doesn't return what it should according to spec:
returns: <id_wr> <track> <car> <split1> <split2> <split3> <time> <flags_hlaps> <racername>
...but what I get is:
000 BF1 52100 517 MacEST
010 RB4 65560 517 Kronvall
660 BF1 85500 517 biggie
.....etc
Victor
11th June 2007, 18:11
well, I often get empty server names etc.
has something changed since the Wxx-Patches and the patch X.
Cause before Wxx-Patches everything was ok?
Is the way the data is send by the script differnent?
I haven't touched it. Also I do not see any empty names when i do a request.
You should always include your request url here, because now I've no idea what you're requesting and how.
Noticed that action=wr doesn't return what it should according to spec:
returns: <id_wr> <track> <car> <split1> <split2> <split3> <time> <flags_hlaps> <racername>
...but what I get is:
000 BF1 52100 517 MacEST
010 RB4 65560 517 Kronvall
660 BF1 85500 517 biggie
.....etc
Same as for crazy ice - paste your url here - it works fine for me, so i need to see what you request. I'm guessing you're not using version 1.3 but an older one or so.
hackerx
11th June 2007, 19:28
Oops, now I see there should be "version=1.3" in request now. Sorry. :)
jscorrea
15th June 2007, 14:37
Hello Victor,
Any change in MPR structure?
The times in my result chart is very strange now..:D
Regards
JS
Ian.H
15th June 2007, 15:11
Hello Victor,
Any change in MPR structure?
The times in my result chart is very strange now..:D
Regards
JS
Times are now in milliseconds.. but I've been having an issue with this.. the function I coded which converts WR timestamps just fine doesn't seem to want to play ball with MPR timestamps, but should be the same AFAIA.. but anyway, you'll need to convert them from milliseconds now :)
Regards,
Ian
jscorrea
15th June 2007, 20:44
Ok,
Here the result in miliseconds is:
975765760
The right time em minutes is:
1:16.09
But 975765760ms != 1:16.09
Im lost..
Part of my code:
function data($file)
{
$areas = array("Blackwood" => "BL", "South City" => "SO", "Fern Bay" => "FE", "Autocross" => "AU", "Aston" => "AS", "Kyoto Ring" => "KY", "Westhill" => "WE");
$rp = fopen($file, "rb");
if(fread($rp, 6) == "LFSMPR")
{
fread($rp, 14);
$r["laps"] = hexdec(bin2hex(fread($rp, 1)));
$r["skill"] = hexdec(bin2hex(fread($rp, 1)));
$r["wind"] = hexdec(bin2hex(fread($rp, 1)));
$r["started"] = hexdec(bin2hex(fread($rp, 1)));
$r["version"] = trim(fread($rp, 8));
$r["track"] = trim(fread($rp, 4));
$r["stime"] = hexdec(bin2hex(fread($rp, 4)));
$area = trim(fread($rp, 32));
$config = hexdec(bin2hex(fread($rp, 1)));
$reversed = hexdec(bin2hex(fread($rp, 1)));
$r["ilm"] = hexdec(bin2hex(fread($rp, 1)));
$finished = hexdec(bin2hex(fread($rp, 1)));
$r["finished"] = $finished;
fread($rp, 4);
$fastestlap=9999999;
for($i = 0;$i < $finished; $i++)
//$i > $finished
{
$o[$i]["driver"] = trim(fread($rp, 24));//player name
$o[$i]["plate"] = trim(fread($rp, 8));// plate
$o[$i]["auto"] = trim(fread($rp, 4));//car name
fread($rp, 24);
$o[$i]["laps_c"] = hexdec(bin2hex(fread($rp, 2)))/256;//laps completed
fread($rp, 2);
$o[$i]["maha"] = fread($rp, 1);//confirm flags
$o[$i]["pits"] = hexdec(bin2hex (fread($rp, 1). $pits[$i]));//n pits
fread($rp, 1);
fread($rp, 1);
$o[$i]["ttime"] = hexdec(bin2hex(fread($rp, 4)));//total time
$o[$i]["btime"] = hexdec(bin2hex(fread($rp, 4)));//best time
fread($rp, 4);
}
}
$r["res"] = $o;
return $r;
}
Before patch X:
$o[$i]["ttime"] = msht(fread($rp, 4));//total time
$o[$i]["btime"] = msht(fread($rp, 4));//best time
Help!!!
JS
hackerx
15th June 2007, 20:58
You read the int in wrong byte order.
975765760 = 3A 29 01 00
00 01 29 3A = 76090
jscorrea
16th June 2007, 04:07
Bingo..!
Thanks!!
JS
eakew
11th July 2007, 13:09
Hi
From liveforspeed.es we're right now using the scripts provided to retrieve hotlap info from lfsworld. Right now it's possible to get (hlvc) lap times, split times, driving help used, etc... but no handicap info at all.
Are you planinng to offer that info as well in the near future? That would be very helpful for us, as we're planning to host league events and use the handicap system.
So we need to make sure the drivers are using the correct handicap in their hlvc laps.
Regards.
--==Gogo==--
18th July 2007, 14:29
Hey Victor,
could you add the Flag "Force Cockpit View" when querying data with "?action=hosts", plz!
I'm thinking about something like:
rules bits :
CAN_VOTE 1
CAN_SELECT 2
QUALIFY 4
PRIVATE 8
MODIFIED 16
MIDRACEJOIN 32
MUSTPIT 64
FCV 128
Big Thanks! :)
Victor
18th July 2007, 14:32
it's already there as 256
--==Gogo==--
18th July 2007, 14:39
Wow, that was fast.
And what is 128 for?
Could you update the 1st posting please? Thx.
Victor
18th July 2007, 14:52
i don't know what 128 is for tbh - have to ask scawen. It's not used on lfsworld.
the_angry_angel
18th July 2007, 14:57
At a guess I'd assume "can reset".
Victor
18th July 2007, 21:33
At a guess I'd assume "can reset".
yep, that's confirmed
--==Gogo==--
18th July 2007, 22:19
:thumb:
narcis
20th July 2007, 10:46
Hi, this would be VERY useful for us and I'm sure this will be useful also for other LFS leagues.
http://www.lfsforum.net/showthread.php?t=28019
It is indispensable to have the handicaps information in the data returned by the LFSWorld script (online times and HL times) in order to organize an LFS league with handicaps.
Thanks in advance.
joshdifabio
24th July 2007, 14:22
Victor, is there any chance we could get some kind of unique ID for each team, when requesting the team database?
At the moment, if you are storing a database of teams, and one changes their name, it will appear to be a new team.
Victor
24th July 2007, 17:08
i could add an id, but in a next version of the pubstats. It would break compatibility.
Victor
24th July 2007, 17:09
Hi, this would be VERY useful for us and I'm sure this will be useful also for other LFS leagues.
http://www.lfsforum.net/showthread.php?t=28019
It is indispensable to have the handicaps information in the data returned by the LFSWorld script (online times and HL times) in order to organize an LFS league with handicaps.
Thanks in advance.
Sorry, but I really don't know what you mean.
There are no handicaps for online times. And the handicaps i show for hotlaps are calculated according to the WR times. So if you just get the WR times, then you can calculate the handicaps yourself.
Renku
24th July 2007, 18:22
Sorry, but I really don't know what you mean.
There are no handicaps for online times. And the handicaps i show for hotlaps are calculated according to the WR times. So if you just get the WR times, then you can calculate the handicaps yourself.
I think he meant these (http://www.lfsforum.net/attachment.php?attachmentid=35598&stc=1&d=1185297455) handicaps. I believe this balancing thingy is temporary anyway, dunno how much support it should have.
Kada_CZ
24th July 2007, 19:19
Sorry, but I really don't know what you mean.I think, that narcis (and me too :shy:) would like to retrieve handicap mass and restriction. This information is already in the hotlap SPR file header (bytes 28 and 29), but it would be handy this to apear for example in get_stat2.php?action=hl. Usually it doesn't make sense to apply voluntary restrictions in hotlaps. For our Czech league, we use hotlaps from lfsworld to divide racers into several divisions and we would like to be able to easily check required restrictions for some car. I hope it makes sense now :).
narcis
25th July 2007, 11:12
I think, that narcis (and me too :shy:) would like to retrieve handicap mass and restriction. This information is already in the hotlap SPR file header (bytes 28 and 29), but it would be handy this to apear for example in get_stat2.php?action=hl. Usually it doesn't make sense to apply voluntary restrictions in hotlaps. For our Czech league, we use hotlaps from lfsworld to divide racers into several divisions and we would like to be able to easily check required restrictions for some car. I hope it makes sense now :).
Exactly, this is the idea I am trying to explain, thanks :).
It does not make sense to have mass restriction in online mode, and haven't this restriction in HLVC mode in a league, because the times needed to split racers into several pools wouldn't have mass restrictions, and in the race (online) these same racers would race WITH mass restrictions.
In a league with only one available car, this is not a problem, but using a car group that have GLOBAL handicaps applied (TBO for example), this IS a problem, because the time differences between the group cars will be different in HLVC (pre-race) and online (race).
I think I have explained the problem better :).
Thanks :).
joshdifabio
27th July 2007, 15:50
How about a new function that allows us to retrieve the nationality, real name, date of birth etc. of any racer who has that information in their profile? As this would be a new function, I guess it would not break compatibility?
wimpie
19th August 2007, 15:31
I'm writing an application to get pb's of a couple of drivers, for testing the whole thing i thought i used more then 1 identkey so i asked someone for his identkey but when i fire a query every 2,5 second it returns
can't reload this page that quickly after another
is there also an ip check? Or is there some mistake in my application?
Dygear
21st August 2007, 07:47
I'm writing an application to get pb's of a couple of drivers, for testing the whole thing i thought i used more then 1 identkey so i asked someone for his identkey but when i fire a query every 2,5 second it returns
can't reload this page that quickly after another
is there also an ip check? Or is there some mistake in my application?
I would think that is against the TOS.
nikka
4th September 2007, 15:37
-----------
?action=pst
-----------
(online statistics of one racer)
requires: &racer=<racer>
optional: -
returns: distance in metres
..
..
current / last hostname (or blank line if not online or on hidden host)
last_activity_time(*) (Unix timestamp (UTC))
current / last track(*)
current / last car(*)
Just a quick question to you, Victor... would it be possible for you to revert the last activity information to before the "Phlos is my god" incident?
http://forum.lfs-noobs.org/showols.php
I hate to have this manifest of a script kiddies work on our site..
BBO@BSR
4th September 2007, 15:58
Just a quick question to you, Victor... would it be possible for you to revert the last activity information to before the "Phlos is my god" incident?
http://forum.lfs-noobs.org/showols.php
I hate to have this manifest of a script kiddies work on our site..
For us it worked like this:
Driver had to go online, entered a server, then the info was back to normal.
Victor
4th September 2007, 16:13
Just a quick question to you, Victor... would it be possible for you to revert the last activity information to before the "Phlos is my god" incident?
http://forum.lfs-noobs.org/showols.php
I hate to have this manifest of a script kiddies work on our site..
currently running a cleanup script to write correct values back again. So if you refresh your values tonight, they should be ok again.
nikka
5th September 2007, 15:30
For us it worked like this:
Driver had to go online, entered a server, then the info was back to normal.
Only problem is we have a couple of members on.. uhm.. vacation.
currently running a cleanup script to write correct values back again. So if you refresh your values tonight, they should be ok again.
Yup, seems better now. Last activity time is reverted, but last hostname and last car seems to be blank, last track is 000.
But still way better than it used to be, thanks!
SamH
10th November 2007, 12:48
Vic, I'm trying to import the teams info into our server's database but the ?action=teams appears to have some problems. We think it's sometimes not sending host headers, because what we're often getting is the file getstat2.php as a file. All the other ?name=value pairs are fine, but this one's intermittently burgered.
What I really really would like is to be able to retrieve the team membership of a user.. ?action=teaminfo&user=samh responds with the team information of UKCT, for example. Since we're on the topic, I thought I might as well just field that ;)
[edit] nvm.. I'm an idiot.. the SDK rocks :)
Victor
10th November 2007, 14:04
nm'ing
Dygear
12th November 2007, 07:45
Haha, that's funny. Glad to see people are getting use out of that SDK.
KayJay
11th December 2007, 00:36
Hi Victor,
The FBM car tag isn't displayed in the PB output. Where the car should be it's blank!
The last couple of line from my PB PubStats output shows:
001 FXO 88510 5
500 XFR 106790 16
151 66980 41 <---- this should be '151 FBM 66980 41'
Victor
11th December 2007, 07:41
should be ok again
KayJay
11th December 2007, 08:29
Thanks Victor :D
maczo
25th December 2007, 19:02
Hi,
can anyone point me to the TOS regarding PubStats? I'm looking for information about using 2 IdentKeys on a single IP.
the_angry_angel
26th December 2007, 00:01
I don't believe there's anything written about it, but I believe that the pubstats works not only on ident key, but also on originating IP, from what Victor has said in the past.
CyBex
26th December 2007, 10:27
Hello,
i have seen that the LFS Desktop has some changes. Now it shows how many fuel is required. Did we get the changes in PB request too in the near future? I have start to write my own fuel db, but i can only calculate accurate when the user is driven only on 1 track with 1 car.
Victor
28th December 2007, 19:27
in the next version i can put the new info in there yes. Don't know when that'll be - when there's need for it probably.
kanutron
31st December 2007, 00:18
Have you a release date for next release Victor?
I'm expecting pubstats to be updated with the exciting new features like:
* Online PB Split times, timestamp, etc.
* Hotlap options bits (there has changes since 0.5Y) like handicups usage, clutch, no helps (GC, GB...).
* Host bits, like for cruise option and so on... Or car usage bits for new car FBM (I guessed it, and it works). For car classes (S-S and ALL has new car). ;-)
* Racer profile data (Country, realname, birthdate, etc.)
* Team official ID (I currently using a md5 of the team name to index it on my DB).
Some samples of our usage of pubstats at our team website:
http://mktt.info/lfsw/team
http://mktt.info/lfsw/racer
http://mktt.info/lfsw/team/Michael%2BKnight%2BTribute%2BTeam
http://mktt.info/lfsw/racer/kanutron
BTW, I using this PHP arrays. Some one can confirm that are correct?
$lfsw_cache_cars = array(
'XFG' => array('name'=>'XF GTI' ,'bit'=>1 ,'short_name'=>'XFG'),
'XRG' => array('name'=>'XR GT' ,'bit'=>2 ,'short_name'=>'XRG'),
'XRT' => array('name'=>'XR GT Turbo' ,'bit'=>4 ,'short_name'=>'XRT'),
'RB4' => array('name'=>'RB4 GT' ,'bit'=>8 ,'short_name'=>'RB4'),
'FXO' => array('name'=>'FXO Turbo' ,'bit'=>16 ,'short_name'=>'FXO'),
'LX4' => array('name'=>'LX4' ,'bit'=>32 ,'short_name'=>'LX4'),
'LX6' => array('name'=>'LX6' ,'bit'=>64 ,'short_name'=>'LX6'),
'MRT' => array('name'=>'MTR5' ,'bit'=>128 ,'short_name'=>'MRT'),
'UF1' => array('name'=>'UF 1000' ,'bit'=>256 ,'short_name'=>'UF1'),
'RAC' => array('name'=>'RaceAbout' ,'bit'=>512 ,'short_name'=>'RAC'),
'FZ5' => array('name'=>'FZ50' ,'bit'=>1024 ,'short_name'=>'FZ5'),
'FOX' => array('name'=>'Formula XR' ,'bit'=>2048 ,'short_name'=>'FOX'),
'XFR' => array('name'=>'XF GTR' ,'bit'=>4096 ,'short_name'=>'XFR'),
'UFR' => array('name'=>'UF GTR' ,'bit'=>8192 ,'short_name'=>'UFR'),
'FO8' => array('name'=>'Formula V8' ,'bit'=>16384 ,'short_name'=>'FO8'),
'FXR' => array('name'=>'FXO GTR' ,'bit'=>32768 ,'short_name'=>'FXR'),
'XRR' => array('name'=>'XR GTR' ,'bit'=>65536 ,'short_name'=>'XRR'),
'FZR' => array('name'=>'FZ50 GTR' ,'bit'=>131072 ,'short_name'=>'FZR'),
'BF1' => array('name'=>'BMW Sauber' ,'bit'=>262144 ,'short_name'=>'BF1'),
'FBM' => array('name'=>'Formula BMW' ,'bit'=>524288 ,'short_name'=>'FBM'),
);
$lfsw_cache_cars_classes = array(
'ALL' => array('name'=>'All Cars Allowed' ,'bit'=>1048575 ,'short_name'=>'ALL'),
'STD' => array('name'=>'STD: UF1,XFG,XRG' ,'bit'=>259 ,'short_name'=>'STD'),
'TBO' => array('name'=>'TBO: RB4,FXO,XRT' ,'bit'=>28 ,'short_name'=>'TBO'),
'LRF' => array('name'=>'LRF: LX6,RAC,FZ5' ,'bit'=>1600 ,'short_name'=>'LRF'),
'FWD' => array('name'=>'FWD: UF1,XFG,FXO,UFR,XFR' ,'bit'=>12561 ,'short_name'=>'FWD'),
'GTR' => array('name'=>'GTR: FXR,XRR,FZR' ,'bit'=>229376 ,'short_name'=>'GTR'),
'S-S' => array('name'=>'S-S: MRT,FBM,FOX,FO8,BF1' ,'bit'=>804992 ,'short_name'=>'S-S'),
);
$lfsw_cache_tracks = array(
'BL1' => array('name'=>'Blackwood', 'config'=>'GP Track', 'direction'=>'Standard', 'kms'=>3.3, 'lfsw_code'=>'000', 'short_name'=>'BL1'),
'BL1R'=> array('name'=>'Blackwood', 'config'=>'GP Track', 'direction'=>'Reversed', 'kms'=>3.3, 'lfsw_code'=>'001', 'short_name'=>'BL1R'),
'BL2' => array('name'=>'Blackwood', 'config'=>'Rally Cross', 'direction'=>'Standard', 'kms'=>1.8, 'lfsw_code'=>'010', 'short_name'=>'BL2'),
'BL2R'=> array('name'=>'Blackwood', 'config'=>'Rally Cross', 'direction'=>'Reversed', 'kms'=>1.8, 'lfsw_code'=>'011', 'short_name'=>'BL2R'),
'BL3' => array('name'=>'Blackwood', 'config'=>'Car Park', 'direction'=>'Arena', 'kms'=>0.3, 'lfsw_code'=>'020', 'short_name'=>'BL3'),
'SO1' => array('name'=>'South City', 'config'=>'Classic', 'direction'=>'Standard', 'kms'=>2.0, 'lfsw_code'=>'100', 'short_name'=>'SO1'),
'SO1R'=> array('name'=>'South City', 'config'=>'Classic', 'direction'=>'Reversed', 'kms'=>2.0, 'lfsw_code'=>'101', 'short_name'=>'SO1R'),
'SO2' => array('name'=>'South City', 'config'=>'Sprint Track 1', 'direction'=>'Standard', 'kms'=>2.0, 'lfsw_code'=>'110', 'short_name'=>'SO2'),
'SO2R'=> array('name'=>'South City', 'config'=>'Sprint Track 1', 'direction'=>'Reversed', 'kms'=>2.0, 'lfsw_code'=>'111', 'short_name'=>'SO2R'),
'SO3' => array('name'=>'South City', 'config'=>'Sprint Track 2', 'direction'=>'Standard', 'kms'=>1.3, 'lfsw_code'=>'120', 'short_name'=>'SO3'),
'SO3R'=> array('name'=>'South City', 'config'=>'Sprint Track 2', 'direction'=>'Reversed', 'kms'=>1.3, 'lfsw_code'=>'121', 'short_name'=>'SO3R'),
'SO4' => array('name'=>'South City', 'config'=>'Long', 'direction'=>'Standard', 'kms'=>4.0, 'lfsw_code'=>'130', 'short_name'=>'SO4'),
'SO4R'=> array('name'=>'South City', 'config'=>'Long', 'direction'=>'Reversed', 'kms'=>4.0, 'lfsw_code'=>'131', 'short_name'=>'SO4R'),
'SO5' => array('name'=>'South City', 'config'=>'Town Course', 'direction'=>'Standard', 'kms'=>3.1, 'lfsw_code'=>'140', 'short_name'=>'SO5'),
'SO5R'=> array('name'=>'South City', 'config'=>'Town Course', 'direction'=>'Reversed', 'kms'=>3.1, 'lfsw_code'=>'141', 'short_name'=>'SO5R'),
'SO6' => array('name'=>'South City', 'config'=>'Chicane Route', 'direction'=>'Standard', 'kms'=>2.9, 'lfsw_code'=>'150', 'short_name'=>'SO6'),
'SO6R'=> array('name'=>'South City', 'config'=>'Chicane Route', 'direction'=>'Reversed', 'kms'=>2.9, 'lfsw_code'=>'151', 'short_name'=>'SO6R'),
'FE1' => array('name'=>'Fern Bay', 'config'=>'Club', 'direction'=>'Standard', 'kms'=>1.6, 'lfsw_code'=>'200', 'short_name'=>'FE1'),
'FE1R'=> array('name'=>'Fern Bay', 'config'=>'Club', 'direction'=>'Reversed', 'kms'=>1.6, 'lfsw_code'=>'201', 'short_name'=>'FE1R'),
'FE2' => array('name'=>'Fern Bay', 'config'=>'Green Track', 'direction'=>'Standard', 'kms'=>3.1, 'lfsw_code'=>'210', 'short_name'=>'FE2'),
'FE2R'=> array('name'=>'Fern Bay', 'config'=>'Green Track', 'direction'=>'Reversed', 'kms'=>3.1, 'lfsw_code'=>'211', 'short_name'=>'FE2R'),
'FE3' => array('name'=>'Fern Bay', 'config'=>'Gold Track', 'direction'=>'Standard', 'kms'=>3.5, 'lfsw_code'=>'220', 'short_name'=>'FE3'),
'FE3R'=> array('name'=>'Fern Bay', 'config'=>'Gold Track', 'direction'=>'Reversed', 'kms'=>3.5, 'lfsw_code'=>'221', 'short_name'=>'FE3R'),
'FE4' => array('name'=>'Fern Bay', 'config'=>'Black Track', 'direction'=>'Standard', 'kms'=>6.6, 'lfsw_code'=>'230', 'short_name'=>'FE4'),
'FE4R'=> array('name'=>'Fern Bay', 'config'=>'Black Track', 'direction'=>'Reversed', 'kms'=>6.6, 'lfsw_code'=>'231', 'short_name'=>'FE4R'),
'FE5' => array('name'=>'Fern Bay', 'config'=>'Rally Cross', 'direction'=>'Standard', 'kms'=>2.0, 'lfsw_code'=>'240', 'short_name'=>'FE5'),
'FE5R'=> array('name'=>'Fern Bay', 'config'=>'Rally Cross', 'direction'=>'Reversed', 'kms'=>2.0, 'lfsw_code'=>'241', 'short_name'=>'FE5R'),
'FE6' => array('name'=>'Fern Bay', 'config'=>'RallyX Green', 'direction'=>'Standard', 'kms'=>0.7, 'lfsw_code'=>'250', 'short_name'=>'FE6'),
'FE6R'=> array('name'=>'Fern Bay', 'config'=>'RallyX Green', 'direction'=>'Reversed', 'kms'=>0.7, 'lfsw_code'=>'251', 'short_name'=>'FE6R'),
'AU1' => array('name'=>'Autocross', 'config'=>'Autocross', 'direction'=>'Arena', 'kms'=>0.3, 'lfsw_code'=>'300', 'short_name'=>'AU1'),
'AU2' => array('name'=>'Autocross', 'config'=>'Slod Pad', 'direction'=>'Arena', 'kms'=>0.1, 'lfsw_code'=>'310', 'short_name'=>'AU2'),
'AU3' => array('name'=>'Autocross', 'config'=>'Drag Strip', 'direction'=>'Single Stage', 'kms'=>0.7, 'lfsw_code'=>'320', 'short_name'=>'AU3'),
'AU4' => array('name'=>'Autocross', 'config'=>'8 Lane Drag', 'direction'=>'Single Stage', 'kms'=>0.7, 'lfsw_code'=>'330', 'short_name'=>'AU4'),
'KY1' => array('name'=>'Kyoto Ring', 'config'=>'Oval', 'direction'=>'Standard', 'kms'=>3.0, 'lfsw_code'=>'400', 'short_name'=>'KY1'),
'KY1R'=> array('name'=>'Kyoto Ring', 'config'=>'Oval', 'direction'=>'Reversed', 'kms'=>3.0, 'lfsw_code'=>'401', 'short_name'=>'KY1R'),
'KY2' => array('name'=>'Kyoto Ring', 'config'=>'National', 'direction'=>'Standard', 'kms'=>5.1, 'lfsw_code'=>'410', 'short_name'=>'KY2'),
'KY2R'=> array('name'=>'Kyoto Ring', 'config'=>'National', 'direction'=>'Reversed', 'kms'=>5.1, 'lfsw_code'=>'411', 'short_name'=>'KY2R'),
'KY3' => array('name'=>'Kyoto Ring', 'config'=>'GP Long', 'direction'=>'Standard', 'kms'=>7.4, 'lfsw_code'=>'420', 'short_name'=>'KY3'),
'KY3R'=> array('name'=>'Kyoto Ring', 'config'=>'GP Long', 'direction'=>'Reversed', 'kms'=>7.4, 'lfsw_code'=>'421', 'short_name'=>'KY3R'),
'WE1' => array('name'=>'Westhill', 'config'=>'International', 'direction'=>'Standard', 'kms'=>5.2, 'lfsw_code'=>'500', 'short_name'=>'WE1'),
'WE1R'=> array('name'=>'Westhill', 'config'=>'International', 'direction'=>'Reversed', 'kms'=>5.2, 'lfsw_code'=>'501', 'short_name'=>'WE1R'),
'AS1' => array('name'=>'Aston', 'config'=>'Cadet', 'direction'=>'Standard', 'kms'=>1.9, 'lfsw_code'=>'600', 'short_name'=>'AS1'),
'AS1R'=> array('name'=>'Aston', 'config'=>'Cadet', 'direction'=>'Reversed', 'kms'=>1.9, 'lfsw_code'=>'601', 'short_name'=>'AS1R'),
'AS2' => array('name'=>'Aston', 'config'=>'Club', 'direction'=>'Standard', 'kms'=>3.1, 'lfsw_code'=>'610', 'short_name'=>'AS2'),
'AS2R'=> array('name'=>'Aston', 'config'=>'Club', 'direction'=>'Reversed', 'kms'=>3.1, 'lfsw_code'=>'611', 'short_name'=>'AS2R'),
'AS3' => array('name'=>'Aston', 'config'=>'National', 'direction'=>'Standard', 'kms'=>5.6, 'lfsw_code'=>'620', 'short_name'=>'AS3'),
'AS3R'=> array('name'=>'Aston', 'config'=>'National', 'direction'=>'Reversed', 'kms'=>5.6, 'lfsw_code'=>'621', 'short_name'=>'AS3R'),
'AS4' => array('name'=>'Aston', 'config'=>'Historic', 'direction'=>'Standard', 'kms'=>8.1, 'lfsw_code'=>'630', 'short_name'=>'AS4'),
'AS4R'=> array('name'=>'Aston', 'config'=>'Historic', 'direction'=>'Reversed', 'kms'=>8.1, 'lfsw_code'=>'631', 'short_name'=>'AS4R'),
'AS5' => array('name'=>'Aston', 'config'=>'Grand Prix', 'direction'=>'Standard', 'kms'=>8.8, 'lfsw_code'=>'640', 'short_name'=>'AS5'),
'AS5R'=> array('name'=>'Aston', 'config'=>'Grand Prix', 'direction'=>'Reversed', 'kms'=>8.8, 'lfsw_code'=>'641', 'short_name'=>'AS5R'),
'AS6' => array('name'=>'Aston', 'config'=>'Grand Touring', 'direction'=>'Standard', 'kms'=>8.0, 'lfsw_code'=>'650', 'short_name'=>'AS6'),
'AS6R'=> array('name'=>'Aston', 'config'=>'Grand Touring', 'direction'=>'Reversed', 'kms'=>8.0, 'lfsw_code'=>'651', 'short_name'=>'AS6R'),
'AS7' => array('name'=>'Aston', 'config'=>'North', 'direction'=>'Standard', 'kms'=>5.2, 'lfsw_code'=>'660', 'short_name'=>'AS7'),
'AS7R'=> array('name'=>'Aston', 'config'=>'North', 'direction'=>'Reversed', 'kms'=>5.2, 'lfsw_code'=>'661', 'short_name'=>'AS7R'),
);
$lfsw_cache_tracks['000'] = &$lfsw_cache_tracks['BL1'];
$lfsw_cache_tracks['001'] = &$lfsw_cache_tracks['BL1R'];
$lfsw_cache_tracks['010'] = &$lfsw_cache_tracks['BL2'];
$lfsw_cache_tracks['011'] = &$lfsw_cache_tracks['BL2R'];
$lfsw_cache_tracks['020'] = &$lfsw_cache_tracks['BL3'];
$lfsw_cache_tracks['100'] = &$lfsw_cache_tracks['SO1'];
$lfsw_cache_tracks['101'] = &$lfsw_cache_tracks['SO1R'];
$lfsw_cache_tracks['110'] = &$lfsw_cache_tracks['SO2'];
$lfsw_cache_tracks['111'] = &$lfsw_cache_tracks['SO2R'];
$lfsw_cache_tracks['120'] = &$lfsw_cache_tracks['SO3'];
$lfsw_cache_tracks['121'] = &$lfsw_cache_tracks['SO3R'];
$lfsw_cache_tracks['130'] = &$lfsw_cache_tracks['SO4'];
$lfsw_cache_tracks['131'] = &$lfsw_cache_tracks['SO4R'];
$lfsw_cache_tracks['140'] = &$lfsw_cache_tracks['SO5'];
$lfsw_cache_tracks['141'] = &$lfsw_cache_tracks['SO5R'];
$lfsw_cache_tracks['150'] = &$lfsw_cache_tracks['SO6'];
$lfsw_cache_tracks['151'] = &$lfsw_cache_tracks['SO6R'];
$lfsw_cache_tracks['200'] = &$lfsw_cache_tracks['FE1'];
$lfsw_cache_tracks['201'] = &$lfsw_cache_tracks['FE1R'];
$lfsw_cache_tracks['210'] = &$lfsw_cache_tracks['FE2'];
$lfsw_cache_tracks['211'] = &$lfsw_cache_tracks['FE2R'];
$lfsw_cache_tracks['220'] = &$lfsw_cache_tracks['FE3'];
$lfsw_cache_tracks['221'] = &$lfsw_cache_tracks['FE3R'];
$lfsw_cache_tracks['230'] = &$lfsw_cache_tracks['FE4'];
$lfsw_cache_tracks['231'] = &$lfsw_cache_tracks['FE4R'];
$lfsw_cache_tracks['240'] = &$lfsw_cache_tracks['FE5'];
$lfsw_cache_tracks['241'] = &$lfsw_cache_tracks['FE5R'];
$lfsw_cache_tracks['250'] = &$lfsw_cache_tracks['FE6'];
$lfsw_cache_tracks['251'] = &$lfsw_cache_tracks['FE6R'];
$lfsw_cache_tracks['300'] = &$lfsw_cache_tracks['AU1'];
$lfsw_cache_tracks['310'] = &$lfsw_cache_tracks['AU2'];
$lfsw_cache_tracks['320'] = &$lfsw_cache_tracks['AU3'];
$lfsw_cache_tracks['330'] = &$lfsw_cache_tracks['AU4'];
$lfsw_cache_tracks['400'] = &$lfsw_cache_tracks['KY1'];
$lfsw_cache_tracks['401'] = &$lfsw_cache_tracks['KY1R'];
$lfsw_cache_tracks['410'] = &$lfsw_cache_tracks['KY2'];
$lfsw_cache_tracks['411'] = &$lfsw_cache_tracks['KY2R'];
$lfsw_cache_tracks['420'] = &$lfsw_cache_tracks['KY3'];
$lfsw_cache_tracks['421'] = &$lfsw_cache_tracks['KY3R'];
$lfsw_cache_tracks['500'] = &$lfsw_cache_tracks['WE1'];
$lfsw_cache_tracks['501'] = &$lfsw_cache_tracks['WE1R'];
$lfsw_cache_tracks['600'] = &$lfsw_cache_tracks['AS1'];
$lfsw_cache_tracks['601'] = &$lfsw_cache_tracks['AS1R'];
$lfsw_cache_tracks['610'] = &$lfsw_cache_tracks['AS2'];
$lfsw_cache_tracks['611'] = &$lfsw_cache_tracks['AS2R'];
$lfsw_cache_tracks['620'] = &$lfsw_cache_tracks['AS3'];
$lfsw_cache_tracks['621'] = &$lfsw_cache_tracks['AS3R'];
$lfsw_cache_tracks['630'] = &$lfsw_cache_tracks['AS4'];
$lfsw_cache_tracks['631'] = &$lfsw_cache_tracks['AS4R'];
$lfsw_cache_tracks['640'] = &$lfsw_cache_tracks['AS5'];
$lfsw_cache_tracks['641'] = &$lfsw_cache_tracks['AS5R'];
$lfsw_cache_tracks['650'] = &$lfsw_cache_tracks['AS6'];
$lfsw_cache_tracks['651'] = &$lfsw_cache_tracks['AS6R'];
$lfsw_cache_tracks['660'] = &$lfsw_cache_tracks['AS7'];
$lfsw_cache_tracks['661'] = &$lfsw_cache_tracks['AS7R'];
Ondrejko
31st December 2007, 11:51
doeas anybody know how to create script to show how many registered users from specific nation have LFS license?
something like that http://gracze.liveforspeed.pl/index.php
Victor
2nd January 2008, 20:15
Have you a release date for next release Victor?
I'm expecting pubstats to be updated with the exciting new features like:
* Online PB Split times, timestamp, etc.
* Hotlap options bits (there has changes since 0.5Y) like handicups usage, clutch, no helps (GC, GB...).
* Host bits, like for cruise option and so on... Or car usage bits for new car FBM (I guessed it, and it works). For car classes (S-S and ALL has new car). ;-)
* Racer profile data (Country, realname, birthdate, etc.)
* Team official ID (I currently using a md5 of the team name to index it on my DB).
i'm doing some more lfsworld updates soon, so i'll wait until these are done.
Your list of updates seems good, though i'm not sure about racer profiles.
The hotlap and host bits should already be there like you guessed. That only requires a documentation update. You can find the meaning of the bits in the official LFS InSim docs too btw.
joshdifabio
2nd January 2008, 22:35
... Your list of updates seems good, though i'm not sure about racer profiles. ...
I'd like to be able to get personal data (real name, DoB, nationality etc.) too, though I can understand if you are bothered about possible privacy issues. The data is already publically available to anyone on LFS World though, so maybe there's some other reason you wouldn't want to do it?
Victor
2nd January 2008, 22:43
Biggest problem there is that when you download and store someone's profile, and then that person switches to 'hide real name' and such on lfsworld, you still have his name stored. It no longer leaves a user fully under control over their privacy options.
A small point alongside this is that i feel hesitant supplying a mass download function for these kind of details. That they are visible at lfsworld does not promote mass gathering of data AND as said above, a user has the option to turn it off any time he wants to.
joshdifabio
2nd January 2008, 23:34
That's a good point and something which I hadn't thought of. Maybe you could just make that data available to a few trusted sites, such as icespy (http://icespy.zilium.de), and then insist that those sites checked regularly whether the data had recently become hidden, and if so their site should also hide it.
Anyway, it would be nice if we could get nationalities at least, since those can't be hidden :).
Victor
2nd January 2008, 23:37
i'll have a think about that and see what can and cannot be put in pubstats.
glyphon
2nd January 2008, 23:46
imo, i don't think real names should be part of the pubstats export.
the only reason most people would care about names is if it were for people they actually knew, and in that case that can just write a function to switch the user name to the real name, which is stored in the calling script.
although, as a 2nd thought, could the racer name be added?
that would be helpful for people that use a different racername from their account name. (like myself)
if not, no problem, because i can just sure the same method as above :)
kanutron
3rd January 2008, 02:09
...though i'm not sure about racer profiles.
Ok. :shrug:
You can find the meaning of the bits in the official LFS InSim docs too btw.
Found! So...
function lfsw_get_hotlap_flags_array($bits) {
$tmp = array();
$tmp['lhd'] = ( 1 & $bits) ? TRUE : FALSE; // left hand
$tmp['r2'] = ( 2 & $bits) ? TRUE : FALSE; // was change cut
$tmp['r4'] = ( 4 & $bits) ? TRUE : FALSE; // was chabge blip
$tmp['ag'] = ( 8 & $bits) ? TRUE : FALSE; // autogears
$tmp['sh'] = ( 16 & $bits) ? TRUE : FALSE; // shifter
$tmp['r32'] = ( 32 & $bits) ? TRUE : FALSE; // reserved
$tmp['bh'] = ( 64 & $bits) ? TRUE : FALSE; // brake help
$tmp['cl'] = ( 128 & $bits) ? TRUE : FALSE; // axis clutch
$tmp['pits'] = ( 256 & $bits) ? TRUE : FALSE; // in pits (hotlap?)
$tmp['ac'] = ( 512 & $bits) ? TRUE : FALSE; // autoclutch
$tmp['ms'] = (1024 & $bits) ? TRUE : FALSE; // mouse
$tmp['kn'] = (2048 & $bits) ? TRUE : FALSE; // keyboard no help
$tmp['ks'] = (4096 & $bits) ? TRUE : FALSE; // keyboard stabilished
$tmp['cv'] = (8192 & $bits) ? TRUE : FALSE; // custom view
$tmp['rhd'] = !$tmp['lhd'];
$tmp['w'] = (!$tmp['m'] && !$tmp['kn'] && !$tmp['ks']);
return $tmp;
}
function lfsw_get_host_rules_array($bits) {
$tmp = array();
$tmp['vote'] = ( 1 & $bits) ? TRUE : FALSE;
$tmp['select'] = ( 2 & $bits) ? TRUE : FALSE;
$tmp['qual'] = ( 4 & $bits) ? TRUE : FALSE;
$tmp['private'] = ( 8 & $bits) ? TRUE : FALSE;
$tmp['modified'] = ( 16 & $bits) ? TRUE : FALSE;
$tmp['midrace'] = ( 32 & $bits) ? TRUE : FALSE;
$tmp['mustpit'] = ( 64 & $bits) ? TRUE : FALSE;
$tmp['canreset'] = (128 & $bits) ? TRUE : FALSE;
$tmp['fcv'] = (256 & $bits) ? TRUE : FALSE;
$tmp['cruise'] = (512 & $bits) ? TRUE : FALSE;
return $tmp;
}
function lfsw_get_team_flags_array($bits) {
$tmp = array();
$tmp['race'] = ( 1 & $bits) ? TRUE : FALSE;
$tmp['drift'] = ( 2 & $bits) ? TRUE : FALSE;
$tmp['drag'] = ( 4 & $bits) ? TRUE : FALSE;
$tmp['canapply'] = ( 8 & $bits) ? TRUE : FALSE;
$tmp['hashost'] = ( 16 & $bits) ? TRUE : FALSE;
$tmp['demo'] = ( 32 & $bits) ? TRUE : FALSE;
$tmp['s1'] = ( 64 & $bits) ? TRUE : FALSE;
$tmp['s2'] = (128 & $bits) ? TRUE : FALSE;
$tmp['s3'] = (256 & $bits) ? TRUE : FALSE;
return $tmp;
}
Interesting... custom view flag is already stored in the hotlap. Cool. :D
Dygear
5th January 2008, 19:21
i'll have a think about that and see what can and cannot be put in pubstats.
I happen to disagree with that idea. It's kinda not fair to the smaller sites.
Victor
5th January 2008, 19:25
I happen to disagree with that idea. It's kinda not fair to the smaller sites.
i think you wanted to quote the bit where he mentioned some sites do get the names and some don't?
Dygear
9th January 2008, 14:24
i think you wanted to quote the bit where he mentioned some sites do get the names and some don't?
Yes, that's what I was referring too.
Victor
9th January 2008, 17:02
Well i don't agree with that either, so we're agreed on that :)
jscorrea
18th January 2008, 21:17
Victor,
This script dont work anymore:
http://www.lfsworld.net/pubstat/get_stat2.php?version=1.3&idk=<MY ID KEY>&action=pst&racer=jscorrea
Any problem in pubstats or problem in my idkey?
Regards,
JS
glyphon
18th January 2008, 22:10
Victor,
This script dont work anymore:
http://www.lfsworld.net/pubstat/get_stat2.php?version=1.3&idk=<MY ID KEY>&action=pst&racer=jscorrea
Any problem in pubstats or problem in my idkey?
Regards,
JS
i just tested that link with my IDKey, and it worked. well, i should say that it worked after i removed the space from "version". did you intend for that space to be there? if not, could be the source of your problem.
jscorrea
18th January 2008, 22:28
strange no space...is the forum.
http://www.lfsworld.net/pubstat/get_stat2.php?version=1.3&idk=<MY ID KEY>&action=pst&racer=jscorrea
dont work....quota Exceeded???
This the message:
Identification is required - http://www.lfsforum.net/showthread.php?t=14480
GFresh
19th January 2008, 18:40
Have you left the < and > around the ID key by any chance? if so, remove them.
jscorrea
19th January 2008, 20:14
without <> dont work
This is a problem with my profile...i guess
Regards,
JS
GFresh
19th January 2008, 20:34
Hmm, i tried replicating your error, and adding the < > around the idk resulted in the exact message that you got....
EDIT: Have you tried generating a new idk, then trying that?
jscorrea
19th January 2008, 21:32
Hmm, i tried replicating your error, and adding the < > around the idk resulted in the exact message that you got....
EDIT: Have you tried generating a new idk, then trying that?
Strange works now without <>
Thanks
JS
loconstant
31st January 2008, 09:54
Hi,
I have a small request, with patch Y, the hlvc times where resetted.
Nearly, the same for the online pbs as the olders are greyed.
Is there a possibility to get this info by extending the current pb action command?----------
?action=pb
----------
(get all online pb's of a racer)
requires: &racer=<racer>
optional: -
returns: <track> <car> <time> <lapcount>I would need if possible either the datetime or the version.
Thanks a lot,
Blacklight
11th February 2008, 09:21
Hi folks
I am not a coder by any stretch of the imagination, but I do understand the principle of retrieving data by using the following URL format:
http://www.lfsworld.net/pubstat/get_stat2.php?version=1.3&idk=<Your_Ident_Key_Here>&action=...
I can sucessfully do this from the URL bar in a browser. However, I have no idea how to retrieve this data into a file for caching on my web server, or live within a page, for the display of stats.
Would someone mind taking a few minutes to paste a starter script to get me going?
Many thanks!
Ian.H
11th February 2008, 14:00
Hi folks
I am not a coder by any stretch of the imagination,
[ snip ]
Would someone mind taking a few minutes to paste a starter script to get me going?
Many thanks!
Why is it that self-confessed non-coders seem to think code appears in a matter of a "few minutes"?
Here's an example of obtaining the hosts list, but my guess is it'll mean all but nothing to you:
// Get data from LFSWorld
$lfswURL = LFSW_PUBSTATS_URL . 'hosts';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $lfswURL);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$hosts = curl_exec($ch);
curl_close($ch);
That just obtains the data, parsing that into something presentable is another story and not something that happens within a "few minutes".
No disrespect meant, but if you have no idea about coding, an _example_ script (ie: that may not even work in a live environment) isn't going to be of much use to you without you first learning how to program. Or, are you really saying:
'Can someone code me a page for my web site to display xyz statistics?'
I'd be more than happy to do this, but it'll cost you £30p/h.
Regards,
Ian
Blacklight
11th February 2008, 14:38
Or, are you really saying:
'Can someone code me a page for my web site to display xyz statistics?'
No I'm not, and no that's not what I asked for is it.
Why is it that self-confessed non-coders seem to think code appears in a matter of a "few minutes"?
Here's an example of obtaining the hosts list, but my guess is it'll mean all but nothing to you:
I said I wasn't a CODER, I didn't say I wasn't a web developer with over 12 years design and build experience.
I've done some reading this morning, cut and pasted a few functions, overcome a few errors and successfully got my stats displaying in my page now thank you... and all without a hint of 'elitism'. Thanks for the offer to code for a fee, however may I suggest that if you want to be somewhat more successful in generating business, you work at being a little less patronising to your potential clients :really:.
Ian.H
11th February 2008, 18:37
No I'm not, and no that's not what I asked for is it.
It read that way.
I said I wasn't a CODER, I didn't say I wasn't a web developer with over 12 years design and build experience.
Oh.. programming in a scripting language (PHP / Perl etc) doesn't make you a programmer? (unless of course, you use ASP :scared: ). If you've been developing sites for that long, where was the need to point out you're "not a coder", surely that's immaterial, considering you're asking about integration into web sites :scratchch
I've done some reading this morning, cut and pasted a few functions, overcome a few errors and successfully got my stats displaying in my page now thank you... and all without a hint of 'elitism'.
Cool! Then there was no need to post this thread really was there, since it seems you are capable of researching for yourself. Why people don't use this method _first_ beats the fsck outta me.
Thanks for the offer to code for a fee, however may I suggest that if you want to be somewhat more successful in generating business, you work at being a little less patronising to your potential clients :really:.
Hah.. if you really think I post here to tout for business, you're very much mistaken, especially as back in the day, I wrote a PHP class released as open-source to do exactly what you're asking (is redundant now as it never got updated since S2 was released) and have either released or currently developing tools related to LFS for free (point being, I do far more for nothing than I do charging).
There just seems to be a lot of "do this for me"... "I want to create the world but too dense to read and learn" type posts or people who generally think that working code can be plucked from the average arsehole willy-nilly in these forums recently, your OP didn't sound / read much different to those. What would have helped is if you'd posted that "you've tried this and / or that, but the other failed.. does anyone have any suggestions as to why?" etc.
There was nothing elite about my reply.. maybe a hint of sarcasm, but no elitism.. the point was that if you don't (although we now know otherwise) know a web dev language, nothing code-related that anyone posted would have been of any use.. not "look.. hah, I know you don't".
Regards,
Ian
Blacklight
11th February 2008, 20:50
where was the need to point out you're "not a coder", surely that's immaterial, considering you're asking about integration into web sites
No I'm not a coder, and would never claim to be. I leave that to those more proficient at it (like yourself) and those colleagues that I work with who produce all necessary coding for me. I would not want to insult those that are true coders by calling myself one. And before you ask, I haven't asked my colleagues for their assistance on this because it's a recreational project of my own and one I would like to tackle without just asking them to do it for me.
Cool! Then there was no need to post this thread really was there, since it seems you are capable of researching for yourself. Why people don't use this method _first_ beats the fsck outta me.
If you stop and think about it for a moment, it was a sensible request. I was starting with a blank canvas, with a set of parameters I knew nothing about. By attacking it from two different angles, I was hoping to maximise the speed of a result by combining a basic script that someone might have been kind enough to supply me with here, with any knowledge I was picking up by reading elsewhere in parallel. I'm a fast learner and would have dissected what I needed from the basic script and in fact that is what I did... sadly, elsewhere. I simply and kindly asked for a 'starter script' to get me going is all, and you mis-read that as trying to blag the whole deal to get my site going.
I'm disappointed that my first post here has been met with immediate opposition and such obvious sarcasm. I'm putting it down to just a bad day as I'm sure from what I've read in other threads that there is a great deal of friendliness to be found here.
Ian.H
11th February 2008, 21:31
No I'm not a coder, and would never claim to be. I leave that to those more proficient at it (like yourself) and those colleagues that I work with who produce all necessary coding for me. I would not want to insult those that are true coders by calling myself one. And before you ask, I haven't asked my colleagues for their assistance on this because it's a recreational project of my own and one I would like to tackle without just asking them to do it for me.
To me, that would come under the 'elitism' element. Not you calling it, but I know coders who think scripting isn't programming and thus hate to be categorised as a communal group. To me, if you program, be it scripting or other languages (let's face it, Visual Basic is far easier than the likes of Perl, for example) then you're a programmer, often known as a coder :)
If you stop and think about it for a moment, it was a sensible request. I was starting with a blank canvas, with a set of parameters I knew nothing about. By attacking it from two different angles, I was hoping to maximise the speed of a result by combining a basic script that someone might have been kind enough to supply me with here, with any knowledge I was picking up by reading elsewhere in parallel. I'm a fast learner and would have dissected what I needed from the basic script and in fact that is what I did... sadly, elsewhere.
If you've been a web developer for 12 years, you'll have probably had plenty of dealing with parsing of data in various formats and either reading and / or writing it. Pubstats is nothing "special" in that degree.. it's just parsing and handling data.
If you really wanted to grab some code as reference, then a search would have shown up Dygear's LFSW SDK. I'm assuming PHP here as it's very common on 99% of hosts and you didn't specify a language.
I simply and kindly asked for a 'starter script' to get me going is all, and you mis-read that as trying to blag the whole deal to get my site going.
I didn't try to blag anything. Maybe I should have put £150p/h to push it well out of obvious acceptable rates. It was tongue in cheek. If I was seriously trying to blag anything, the moderators would be on my case in a flash (and rightly so).
I'm disappointed that my first post here has been met with immediate opposition and such obvious sarcasm. I'm putting it down to just a bad day as I'm sure from what I've read in other threads that there is a great deal of friendliness to be found here.
There is.. I can also be quite helpful.. but your OP didn't sound like you really wanted help, more like a solution.
So what have we learnt, perhaps your post could have been worded a little clearer and perhaps I shouldn't have jumped the gun so quick :)
Either way, good luck with your project.
Regards,
Ian
Blacklight
12th February 2008, 09:19
I didn't try to blag anything. Maybe I should have put £150p/h to push it well out of obvious acceptable rates. It was tongue in cheek. If I was seriously trying to blag anything, the moderators would be on my case in a flash (and rightly so).
I'm sorry, I worded that badly... I actually meant that you may have read it that *I* was trying to blag a free solution to getting the stats on my site :).
If you've been a web developer for 12 years, you'll have probably had plenty of dealing with parsing of data in various formats and either reading and / or writing it. Pubstats is nothing "special" in that degree.. it's just parsing and handling data.
Hence why I managed to work it out in the end and as you rightly point out, Dygear's LFSW SDK was a great help to that end (i.e. I am using it).
So what have we learnt, perhaps your post could have been worded a little clearer and perhaps I shouldn't have jumped the gun so quick :) Either way, good luck with your project.
Point taken and duly noted :) And thanks, the project is definitely starting to take shape.
maczo
12th February 2008, 21:35
Maybe Ian thought that we have a new sun (http://www.lfsforum.net/search.php?do=finduser&u=130514) on the forum. One is already too much and the thought that there would be two perhaps made him a little edgy :scratchch
But then what do I know :x
Ian.H
13th February 2008, 07:03
I'm sorry, I worded that badly... I actually meant that you may have read it that *I* was trying to blag a free solution to getting the stats on my site :).
Actually this was my error. Re-reading it now, it's clear what you were saying :)
Point taken and duly noted :) And thanks, the project is definitely starting to take shape.
Good to hear it's working.
maczo's post above regarding 'sun' was exactly the person I was thinking of when I posted my first reply. If you check out some of the posts from him, it may help explain why I jumped the gun (wrongly in this case).
Anyways, the coders forum here is a great place of resource with a lot of knowledgeable, friendly fellas often willing to help :)
Regards,
Ian
Blacklight
13th February 2008, 08:40
Maybe Ian thought that we have a new sun (http://www.lfsforum.net/search.php?do=finduser&u=130514) on the forum.
Sorry to disappoint... I can actually spell though :tilt:
maczo's post above regarding 'sun' was exactly the person I was thinking of when I posted my first reply. If you check out some of the posts from him, it may help explain why I jumped the gun (wrongly in this case). Anyways, the coders forum here is a great place of resource with a lot of knowledgeable, friendly fellas often willing to help
All's well that ends well :thumbsup: I actually need to populate my stats now by actually doing some online racing rather than designing/coding, but I'll post something up soon to let you folks know how it's coming along.
Tungsten
15th February 2008, 13:54
Hello,
is it possible to retrieve the country of each host, with "?action=hosts" ?
Sorry don't find the answer elsewhere :shrug:
Thanks
Victor
15th February 2008, 13:56
Hello,
is it possible to retrieve the country of each host, with "?action=hosts" ?
Sorry don't find the answer elsewhere :shrug:
Thanks
not yet. I'll soon update pubstats with that and some other data.
Dygear
16th February 2008, 08:39
not yet. I'll soon update pubstats with that and some other data.
Could we get clued in as so to get a head start on the SDK.
Victor
16th February 2008, 11:40
from the top of my head :
hosts : add country
PB : add splits / pb date
teams : include team ID
new fuel stat
maybe include racer's country somewhere somehow
if there are any more requests, now's the time :)
Dygear
17th February 2008, 14:58
So something like this then?
?action=pb
requires: &racer=<racer>
optional: -
returns: <track> <car> <split1> <split2> <split3> <time> <lapcount>
?action=pst
requires: &racer=<racer>
optional: -
returns: distance in metres
fuel burnt in cl
laps
hosts joined
wins
second
third
finished
quals
pole
online credits
drags
drag wins
online status (0 = offline, 1 = spectating, 2 = pits, 3 = in-race)
current / last hostname (or blank line if not online or on hidden host)
last_activity_time(*) (Unix timestamp (UTC))
current / last track(*)
current / last car(*)
country
?action=host
(get host list & information and online racers)
requires: -
optional: -
returns: HOST STRUCT:
HOSTNAME char[32]
TMLT byte[4]
TCRM byte[4] // Track, Config, Reversed, Max players allowed
CARS ulong (4 bytes)
RULES ulong (4 bytes)
LAPS byte [1]
QUALMINS byte [1]
COUNTRY char [2] // US, UK, ect
NROFRACERS byte[1]
RACERNAMES char[24 * NROFRACERS]
?action=teams
(get the entire teams database stored on lfs world)
requires: -
optional: -
returns: TEAM STRUCT:
TID unsigned int (4 bytes)
TEAM char [128]
TAG char [6]
COUNTRY char [32]
URL char [128]
BITS unsigned int (4 bytes)
INFO_LEN word (2 bytes)
INFO char [INFO_LEN] (Note : urlencoded)
NR_MEMBERS word (2 bytes)
MEMBERS char [24] * NR_MEMBERS
Victor
17th February 2008, 17:55
pretty much yep. And indeed the hosts country will be 2 chars.
About fuel stats btw, would you like to have that included in PB as well?
Or would be a separate fuel stat be better / more convenient?
Dygear
17th February 2008, 21:34
About fuel stats btw, would you like to have that included in PB as well? Or would be a separate fuel stat be better / more convenient?
What is the intended function of the fuel meant to give the end user?
Why are we getting this information? Is it gathered on each lap, in each race / qual / prac session on all hosts. Fuel usage would be saved in the spr file when they upload hot laps and the like, correct?
If you want to give us an over view of all the tracks and then each cars avg on that track then why not make it it's own action? ?action=fuel But is that even needed? Do the fuel avg values change that much over the course of a patch life? You could also give us the min and max values for fuel usage (but if you do please give it to us in the most exact way, that would allow for a different kind of sport on here, who can make the most economical setup, who can make the trusty est? - However that might mess with the results of the ave alittle, what with the amount of people trying.)
You could also output JSON style, but there is really no point, what with JavaScript being unable to query LFSWorld directly, at least not on it's own, or it would have to be on the same domain as LFSWorld ... And at that point, you can just point to your own script on your own domain that will do the convert to JSON for you ...
You could also allow us to query cars (?action=cars), and tracks (?action=tracks) in the game, that could then be used as a finger print for the ?action=fuel array. Indeed you could also use that for alot more ... MSHT arrays for each tracks fastest time. Might save so transfer over all ... Don't really know, have not crunched the numbers.
the_angry_angel
17th February 2008, 21:40
FWIW I'm all for a new action, rather than it being integrated into anything else. As Dygear says, it's should be a long term cacheable set of data :)
Dygear
17th February 2008, 21:46
FWIW I'm all for a new action, rather than it being integrated into anything else. As Dygear says, it's should be a long term cacheable set of data :)
Thanks for the support, did you also see the edit? The last paragraph (if you could call it that, it's only like two sentences) ... I myself am not quite as thrilled about the cars action, and the tracks action as really ... I don't think they are needed yet. However they might become useful when (and indeed if) we can add mods to the game (S3, I know, but I like to think ahead.).
the_angry_angel
17th February 2008, 21:51
As you say, seems irrelvant at the moment and would probably be fairly trivial to implement later.. Of course it would rely on LFSW knowing about the tracks (i.e. 3rd party tracks being "registered").
My 2 pence is as follows: Whilst it's a nice idea it might also lead on to people relying on that to convert into a sensible track name, which could cause extra load and transfer at the LFSW end (given how I've seen some implementations of pubstat tools this could be extremely likely).
Dygear
17th February 2008, 21:57
As you say, seems irrelvant at the moment and would probably be fairly trivial to implement later.. Of course it would rely on LFSW knowing about the tracks (i.e. 3rd party tracks being "registered").
My 2 pence is as follows: Whilst it's a nice idea it might also lead on to people relying on that to convert into a sensible track name, which could cause extra load and transfer at the LFSW end (given how I've seen some implementations of pubstat tools this could be extremely likely).
You could force compression on the client side ... (that would increase load, but decrease bandwidth) ... or otherwise make the format for each of these more efficient some how. Callback functions on the side of LFSWorld to compress on the fly one time, and then serve the compressed 'static' file to all that query. The best peace of code is the code you don't have to make, in lou of that, the code that is made to run the least.
Victor
17th February 2008, 22:35
k i'll treat it as a whole separate thing and make a new action for it that simply outputs someone's total fuel stats.
I suppose i could make multiple output types for it as done with the teams action.
fuel stats btw are collected by keeping track of someone's driven distance and fuel usage per trackconfig / car. These stats are cumulative, so they average out over time. That means that fuel stats will vary a lot in the beginning and then flatten out. Changes in setup / economy therefore have little direct effect in someone's fuel usage stats. On that note i think i have to make fuel stats deletion features on lfsw.
But yeah, one could grab fuel stats from someone every once in a while - it's very cachable.
Dygear
17th February 2008, 23:08
Forget about JSON, they can do that client side (if it's really wanted, I will implement it on the LFSWorldSDK.)
kanutron
18th February 2008, 10:11
In the Dygear data struct for PB it is not space for the timestamp.
I think the timestamp (how old is the record) is a cool data.
And this data could be great to know in HLs too.
requires: &racer=<racer>
optional: -
returns: <track> <car> <split1> <split2> <split3> <time> <lapcount> <timestamp>
(same for HLs)
Timestamp as Unix time in an specific timezone (CEST?).
BTW: The fuel stats could be great to know from LFSW aswell but not really needed.
Rest of seggested structs are ok (country codes and TeamID).
kanutron
18th February 2008, 10:24
Forget about JSON, they can do that client side (if it's really wanted, I will implement it on the LFSWorldSDK.)
Recebing responses from LFSW pubstats in a standard serializing method will clearify a lot the client side code.
What about PHP serialize/unserialize?
Tha arrays struct could be the LFSWorldSDK is using now.
the_angry_angel
18th February 2008, 10:53
Recebing responses from LFSW pubstats in a standard serializing methodThere is no standard serialisation method across all languages though :)
Unless I'm missing the point?
kanutron
18th February 2008, 12:35
There is no standard serialisation method across all languages though
You're right. :P
I mean "popular" or "easy to port", like JSON, that can be used in (almost) all languages or PHP serialize/unserialize that can be used in ASP too.
Providing an optional argument to serializing method would be great.
c=0|1|2|3 < for compression method
s=0|1|2|... < for serializing method
While 0 = the current way (text), 1 can be JSON and 2 PHPserialize and so on.
Dygear
18th February 2008, 13:18
While 0 = the current way (text), 1 can be JSON and 2 PHPserialize and so on.
I like the idea, if we could at all get rid of the LFSWorldSDK then I am all for it!
(The best code, is no code at all!)
Timestamp as Unix time in an specific timezone (CEST?).
One option would be for LFSWorld to look at the profile of the user and see what time zone they are in. But I think it should default to UTC. And I missed the timestamp option, it's a good idea!
Victor
18th February 2008, 13:27
unix timestamps are always in UTC. Your OS will calculate your local time for you.
Victor
18th February 2008, 19:23
i'm considering the selectable output type atm, but have a question :
Would it be preferred to use associative arrays or just regular arrays?
With the first, you'd get the variable names along with the data, making it easy to see what's what, but it will be less optimised than the second.
I suppose it should be the second, forcing ppl to code in a bit more optimised fashion :)
Victor
18th February 2008, 21:11
i'm currently preparing for 4 output types btw :
0) normal, plain text, or in some cases binary - this is the output as it's now.
1) JSON
2) PHP Serialized
3) XML
The three new types have their variables in the same order as with 0) once decoded. Just my question from previous post remains whether to use associative or regular arrays.
oh and if there are requests for additional output types, let me know.
the_angry_angel
18th February 2008, 21:41
Just my question from previous post remains whether to use associative or regular arrays.If you're going down the PHP route, you're probably not bothered about performance that much, and more concerned about simplicity. For that reason alone I'd go for associative arrays.
Victor
18th February 2008, 21:45
i was more thinking about saving a lot of unnecessary characters (transfer) actually.
edit - but yeah, let's keep it user friendly :)
Victor
18th February 2008, 23:07
ok got a 1.4 test url up for those who want to give it a try :
http://www.lfsworld.net/pubstat/get_stat2t.php?version=1.4&action=
(notice the different php file name - it's not the normal one)
Find attached the updated docs.
Let me know if there's something missing, not working properly, etc.
the_angry_angel
18th February 2008, 23:13
i was more thinking about saving a lot of unnecessary characters (transfer) actually.You could enforce gzipping on the heavier outputs - xml, json spring to mind particularly :)
I will try to give the test pubstats a thrashing tomorrow ;)
Edit: Not had a chance to play with it yet. Currently playing restore monkey to a server, after a raid array died :(
kanutron
19th February 2008, 10:11
You could enforce gzipping on the heavier outputs - xml, json spring to mind particularly
+1
And +1 too for associative arrays.
I will try to give the test pubstats a thrashing tomorrow ;)
Lot of work today, but I'll try to test it really soon.
Thanks a lot!
Dygear
19th February 2008, 12:10
Awesome!
KayJay
21st February 2008, 15:09
I've been using 1.4 for the past couple of days now without any problems :) The extra information from the pb action is fantastic :thumb: When is it going live?
Victor
21st February 2008, 17:00
I think it can go live any time.
There's just one thingy i'm not sure about. It's concerning the XML output and urlencoding. I urlencode text and binary XML data because htmlspecialchars or htmlentities doesn't apply to certain (binary) characters. Like null is left alone, but urlencode does convert any 'irregular' characters.
What I don't know is if values inside XML tags actually have to be encoded or not (apart from the usual < and &rt; and such.). Can I just put binary data in between xml tags, or should everything be urlencoded like it's at the moment? Or should i avoid having binary data in XML at all?
eg. TMLT values in the hostlist
kanutron
21st February 2008, 17:43
Know you this?
http://www.w3schools.com/xml/xml_cdata.asp
Put everything between CDATA tags could be the solution.
But just urlencoding the data seems ok.
EDIT: I think that the usual way to put binary data into a XML is to encode in base64. But not shure.
the_angry_angel
21st February 2008, 17:46
With XML there's basically 2 accepted ways of serving content;
1. CDATA (unparsed character data)
2. Escaping (similiar to htmlentities), although there isn't a wide range of characters supported like HTML (only 5 or so)
CDATA is the most sensible.. However, if you're serving it as XML why would there be binary data at all? Serving as XML should negate this and provide a more friendly interface, so that you dont have to do bitwise operations! I'm talking about using attributes, etc.
Edit: That'll teach me not to refresh
Victor
21st February 2008, 18:36
welll, ok i've done the following :
When outputting XML I'm breaking up TMLT and TCRM into smaller, readable bits. With those binary values gone, i can omit the urlencoding.
But now there's a new problem : some hosts contain odd characters. Like characters lower than 0x20. Basically these shouldn't be possible to type in LFS imo, but alas, they are there nevertheless. And these characters give XML parsing problems.
Wrapping hostnames in CDATA doesn't seem to help.
Shall I just filter every character below 0x20 in hostnames? They're useless anyway and probably just a trick to get on top of a sorted hostlist.
mcgas001
21st February 2008, 18:43
Dont realy know much about this stuff but, if 2 host names are the same except for this character wouldnt that return 2 hosts with the same name? Very unlikly i know but still possible?
ps. Thanks for the AutoX help Victor :)
Victor
21st February 2008, 18:53
umm yes, seem theoretically possible.
i think i'll urlencode those chars < 0x20 and then that should be done with :)
Dygear
21st February 2008, 19:12
I think that if it's meant to get the user up to the front of the list, then it should be removed both on this side, and on the side of the LFS.exe client / server.
Victor
21st February 2008, 20:07
I think scawen already did this lately (in his version). At least i know he's checking username characters - i'll check with him if he checks other text for < 0x20 as well. That's really the only way to fix it. Filtering it on my side might cause problems (small chance, but it's possible).
Victor
21st February 2008, 20:12
anyway, i think 1.4 is ready to go live now. I'll do that tomorrow if there aren't any requests or remarks in the meantime.
- Glop -
22nd February 2008, 14:31
Hello, thank you, for this new version.
For my dashboard (lcd + leds), I use outgauge and pubstat(action=pst). Up to now I entered my consumption of essence in the hand for calculate the number of lap with reserve.
I test:
http://www.lfsworld.net/pubstat/get_stat2.php?version=1.4&action=fuel&racer=-%20glop%20-&idk=<my ident-key>
it's return : 'no output'
Why? my name of licence(with %20)? or this new function is approachable still for all players?
sorry for my bad english.
Victor
22nd February 2008, 14:35
pubstats 1.4 is still in testing phase (until later today) and so it uses a testing-url. You are using the normal url.
Victor
22nd February 2008, 15:24
ok seeing as there were no more requests, i've put 1.4 live now, so it can be used with the regular url now.
Nothing_else
22nd February 2008, 18:30
Could somebody help me with this. I never did this and i don't know anything about programming or something like that. I read the first post of Victor but i really don't know what i should do with it.
mcgas001
22nd February 2008, 18:32
http://www.w3schools.com/php/default.asp
Victor
22nd February 2008, 18:34
Without programming knowledge, this is quite useless for you.
Pubstats is a data interface that allows programmers to retrieve LFSW data, store it and display it on their own website.
mcgas001
22nd February 2008, 18:40
Without programming knowledge, this is quite useless for you.
Pubstats is a data interface that allows programmers to retrieve LFSW data, store it and display it on their own website.
Everyone has to start somewhere.
Nothing_else
22nd February 2008, 18:40
isn't there a programme or something to do this? The only thing that i want is a pulldown menu where u can choose the track and a pulldown for the car. And when u choose those 2 u can see the PB or Hotlap of our members.
Nothing_else
22nd February 2008, 18:41
Everyone has to start somewhere.
I know mate... and i tried. But it's not my thing.
Nick A
23rd February 2008, 21:29
Is it possible to retrieve patch X times (HL or PB) using the PubStat system?
the_angry_angel
24th February 2008, 01:45
Is it possible to retrieve patch X times (HL or PB) using the PubStat system?I believe that any physics incompatible times are archived in the LFSWorld backups, but they aren't accessible publically.
I'll let Victor confirm, but I very much doubt that they'll see the light of day.
Okram
29th February 2008, 18:52
Last 10 or 20 minutes not work pubstat version 1.4 on my website. 1.3 work. What wrong?
Example error:
Warning: file_get_contents(http://www.lfsworld.net/pubstat/get_stat2t.php?version=1.4&idk=<MY_IDK>&ps=1&action=pb&racer=<NAME>&c=3&s=2) [function.file-get-contents (http://kodune.pri.ee/~marko/lfs3/function.file-get-contents)]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
Victor
29th February 2008, 18:54
heh i thought someone would get a problem. I've removed the old test pubstats script. You'll have to check your pubstat url and make sure it's the good one. It should start with http://www.lfsworld.net/pubstat/get_stat2.php
Okram
29th February 2008, 18:56
Thanks, this works. :thumb:
Victor
29th February 2008, 19:02
Is it possible to retrieve patch X times (HL or PB) using the PubStat system?
I suppose it's possible with some additions to pubstat, but pre-Y pb's are depricated really and will disappear slowly as they get overwritten by new pb's, so that's why it's not available here.
Nick A
29th February 2008, 20:17
Thanks Victor that's fine. It wasn't a request, I just wanted to work out why a Pubstat application was reporting patch X times. Now I know they must be coming from the database.
Der Abt
3rd March 2008, 11:26
I suppose it's possible with some additions to pubstat, but pre-Y pb's are depricated really and will disappear slowly as they get overwritten by new pb's, so that's why it's not available here.
It would be nice to have.
Our TeamSite contains now empty times on many tracks. :(
And as far a new PB is driven I would like to have the old records and show them i.e. in a different colour.
The old data is still stored?
What about &racer=&action=oldstats that returns:
returns: <track> <car> <oldlaptime> <timestamp>
:scratchch
Der Abt
3rd March 2008, 12:07
Forget about it.
Since these are fixed values that never will change until their deletion I can obtain them from lfsworld.net and put them fixed on our site.
Thanks for thinking about it anyway :smileypul.
SamH
14th March 2008, 00:36
Has something broken? I'm getting weird responses all of a sudden, since we re-populated the teams info on CTRA around midnight.
[edit] I'm calling version 1.3 but it looks like it's responding with results from a different version.
avetere
14th March 2008, 01:14
Yeah ... weird results here to ... calling v1.4.
Seems the given result is an multidimensional array with pos 1 being the actual timestamp (or 2-6 sequential ones to be honest) ... followed by the "normal" result as the second value ...
Edit: Everything seems to be normal again ... very weird indeed ...
SamH
14th March 2008, 01:25
/me breathes out again
hehe yeah.. fixed again. I guess Vic was doing something in the back room :)
Geladric
13th May 2008, 09:18
How can i find out if a racer has demo, s1 or s2 licence? If it cant be done, can you add that info to your script, Victor?
Thnx.
OldBloke
25th May 2008, 18:07
Am I right in thinking that to display a simple 'server status' and/or 'racers on server' page requires pulling in the data for every server and then discard the unwanted stuff?
If I am correct could I request the addition of:
?action=host&hostname=xxxxx
elkdanger
29th May 2008, 16:59
Am I right in thinking that to display a simple 'server status' and/or 'racers on server' page requires pulling in the data for every server and then discard the unwanted stuff?
If I am correct could I request the addition of:
?action=host&hostname=xxxxx
I second that request. What would also be good is if we can filter the host name irrespective of the colour options that are placed inside the hostname text.
elkdanger
31st May 2008, 00:18
Additionally, would it be possible for us to filter the teams action too? It's a similar situation to the hosts issue raised above, where I want to display information about my team (as entered into on LfsWorld) but I have to transfer information about all the teams (currently there are 889) just to get to mine. Possibly a filter on the Id or the name.
Would save bandwidth on both ends :shrug:
OldBloke
31st May 2008, 15:07
How about increased granularity provided via premium pubstats only?
For example:
?action=pb2&racer=xxxx&car=xxxx&track=xxxxx
EQ Worry
13th June 2008, 06:33
Pubstats via Web are great, thanks a lot!
What I miss most is the ability to get player's status - Demo, S1 or S2. I see this was not necessary in the past but since even Demo players now have (or will have officially in [hopefully] very near future) LFSW stats available the licence info would be useful - e.g. it would be possible to see if a Y18+ server in demo config can be safely switched into S1 or S2 mode without anyone losing connection.
One more small thing I miss in the stats is date/time in WR table saying when that record was made or uploaded. Still, the stats are very nice indeed. :)
Drift King CZ
14th June 2008, 08:55
Hello, one question: Is possible to get someone's identification key without asking me?
EDIT: No, no... my bad. Now I already see. I don't need id keys of the others...
joshdifabio
13th July 2008, 11:40
Hi Victor,
Is there any chance <timestamp> could be added to the 'ch' and 'wr' actions? This would save me a load of queries.
Dygear
13th July 2008, 13:44
I'd kill for an SQL style syntax to these commands.
SELECT
driver.uid, driver.pname, driver.uname,
records_pb.uid, records_pb.track, records_pb.time,
records_wr.uid, records_wr.track, records_wr.time
FROM
driver, records_pb, records_wr
WHERE
driver.uid = records_pb.uid
OR
driver.uid = records_wr.uid
LIMIT
UPDATED FROM LAST QUERY;
(Yeah, I could see there being many issues with that query, but it's just an example, don't have a tizzy!)
splattael
18th July 2008, 15:12
Hi,
while fetching hot laps charts I discovered an encoding problem in racer names when using JSON-style. The LFSW nickname is "Jörg Baumgarth" for the KY2/FXR.
When fetching as JSON (s=1) the LFSW nickname is "J" - so it breaks after "ö":
http://www.lfsworld.net/pubstat/get_stat2.php?idk=<IDENTKEY>&version=1.4&s=1&action=ch&track=410&car=FXR&s=1
When fetching as PHP or TEXT (s=2 or s=3) it works well:
http://www.lfsworld.net/pubstat/get_stat2.php?idk=<IDENTKEY>&version=1.4&s=1&action=ch&track=410&car=FXR&s=2
http://www.lfsworld.net/pubstat/get_stat2.php?idk=<IDENTKEY>&version=1.4&s=1&action=ch&track=410&car=FXR&s=3
(Replace <IDENT_KEY> with your ident key)
Any ideas? Bug?
Kind regards
Peter
Dygear
19th July 2008, 08:52
Does not like non standard characters. I had that same issue with FireFox and XML files. It did not like Kimi Räikkönen's name at all. So I replaced the ä with an a, and the ö with an o.
splattael
19th July 2008, 10:14
Well, it has nothing to do with Firefox. The JSON is valid but the racername corrupted:
$ curl 'http://www.lfsworld.net/pubstat/get_stat2.php?idk=<IDENTKEY>&version=1.4&s=1&action=ch&track=410&car=FXR'
[{"id_hl":"29961","split1":"29490","split2":"63940","split3":0,"laptime":"95140","flags_hlaps":"513","racername":"C.Schuht"},{"id_hl":"29750","split1":"29730","split2":"64140","split3":0,"laptime":"95360","flags_hlaps":"513","racername":"crazydav"},{"id_hl":"28002","split1":"29570","split2":"64240","split3":0,"laptime":"95750","flags_hlaps":"1601","racername":"Vugl@"},{"id_hl":"29671","split1":"29890","split2":"64520","split3":0,"laptime":"95890","flags_hlaps":"513","racername":"kiste"},{"id_hl":"29532","split1":"29740","split2":"64760","split3":0,"laptime":"96210","flags_hlaps":"513","racername":"phoenixIlooka"},{"id_hl":"29340","split1":"30160","split2":"65160","split3":0,"laptime":"96740","flags_hlaps":"8705","racername":"tournois"},{"id_hl":"27975","split1":"29970","split2":"64930","split3":0,"laptime":"96930","flags_hlaps":"129","racername":"max92"},{"id_hl":"27263","split1":"30350","split2":"65260","split3":0,"laptime":"97180","flags_hlaps":"8705","racername":"Fall_Angel"},{"id_hl":"28700","split1":"30350","split2":"65940","split3":0,"laptime":"97820","flags_hlaps":"513","racername":"marcel."},{"id_hl":"29312","split1":"31930","split2":"70950","split3":0,"laptime":"104820","flags_hlaps":"1609","racername":"tomona"},{"id_hl":"28427","split1":"32100","split2":"71080","split3":0,"laptime":"104920","flags_hlaps":"513","racername":"J"},{"id_hl":"27105","split1":"35150","split2":"76110","split3":0,"laptime":"111680","flags_hlaps":"8704","racername":"AtomicRacer"}]
This entry has an invalid racername:
{"id_hl":"28427","split1":"32100","split2":"71080","split3":0,"laptime":"104920","flags_hlaps":"513","racername":"J"}
It should read "Jörg Baumgarth" not "J".
Maybe Victor could comment this, please? :)
Kind regards
Peter
Dygear
19th July 2008, 19:20
Well, it has nothing to do with Firefox. The JSON is valid but the racername corrupted:
I know, I'm just saying, it's quite common for programs, even popular ones not to like special characters.
[
{
"id_hl" : "28427",
"split1" : "32100",
"split2" : "71080",
"split3" : 0,
"laptime" : "104920",
"flags_hlaps" : "513",
"racername" : "Jörg Baumgarth"
}
]
$url = 'http://www.lfsworld.net/pubstat/get_stat2.php?version=1.4&idk=<IDK>&ps=1&action=ch&track=410&car=FXR&control=0';
for ($i = 0; $i <= 3; $i++)
print "<H{$i}>{$i}</H{$i}>". file_get_contents($url . '&s=' . $i) . "<BR />";
Indeed, it only seems to be an issue with the JSON transport type.
splattael
24th July 2008, 13:15
Indeed, it only seems to be an issue with the JSON transport type.
Victor, could you please comment on this?
Victor
25th July 2008, 21:59
Hi,
while fetching hot laps charts I discovered an encoding problem in racer names when using JSON-style. The LFSW nickname is "Jörg Baumgarth" for the KY2/FXR.
When fetching as JSON (s=1) the LFSW nickname is "J" - so it breaks after "ö":
http://www.lfsworld.net/pubstat/get_stat2.php?idk=<IDENTKEY>&version=1.4&s=1&action=ch&track=410&car=FXR&s=1
When fetching as PHP or TEXT (s=2 or s=3) it works well:
http://www.lfsworld.net/pubstat/get_stat2.php?idk=<IDENTKEY>&version=1.4&s=1&action=ch&track=410&car=FXR&s=2
http://www.lfsworld.net/pubstat/get_stat2.php?idk=<IDENTKEY>&version=1.4&s=1&action=ch&track=410&car=FXR&s=3
(Replace <IDENT_KEY> with your ident key)
Any ideas? Bug?
Kind regards
Peter
I'm going to conclude it's a bug in the json_encode function, although on the other hand I also made a mistake - strings in JSON should be UTF-8 encoded, but aren't atm. However i tested it with UTF8 strings but the name cutoff in the json output still remained. That's why I think there's a bug in php's json encode function.
Not sure what to do about it at this point. I could write my own json encoding function, or i could replace such accented characters with their unaccented ones - though that may not be the best solution.
Dygear
26th July 2008, 22:47
I could write my own json encoding function, or i could replace such accented characters with their unaccented ones - though that may not be the best solution.
Just need to string replace function ... that will patch it for now.
$spiChars = array (http://php.net/manual/en/book.array.php)(
'a' => array (http://php.net/manual/en/book.array.php)(
'ª', 'À', 'Á', 'Â', 'Ã', 'Ä', 'Å', 'à', 'á', 'â', 'ã', 'ä', 'å', 'Ā', 'ā', 'Ă', 'ă', 'Ą', 'ą'
),
'e' => array (http://php.net/manual/en/book.array.php)(
'È', 'É', 'Ê', 'Ë', 'è', 'é', 'ê', 'ë', 'Ē', 'ē', 'Ĕ', 'ĕ', 'Ė', 'ė', 'Ę', 'ę', 'Ě', 'ě'
),
'i' => array (http://php.net/manual/en/book.array.php)(
'Ì', 'Í', 'Î', 'Ï', 'ì', 'í', 'î', 'ï', 'Ĩ', 'ĩ', 'Ī', 'Ĭ', 'ĭ', 'Į', 'į', 'İ', 'ı'
),
'o' => array (http://php.net/manual/en/book.array.php)(
'Ò', 'Ó', 'Ô', 'Õ', 'Ö', 'Ø', 'ò', 'ó', 'ô', 'õ', 'ö', 'ø', 'Ō', 'ō', 'Ŏ', 'ŏ', 'Ő', 'ő'
),
'u' => array (http://php.net/manual/en/book.array.php)(
'Ù', 'Ú', 'Û', 'Ü', 'Ũ', 'ũ', 'Ū', 'ū', 'Ŭ', 'ŭ', 'Ů', 'ů', 'Ű', 'ű', 'Ų', 'ų', 'Ǔ', 'ǔ', 'Ǖ', 'ǖ', 'Ǘ', 'ǘ', 'Ǚ', 'ǚ', 'Ǜ', 'ǜ'
)
);
foreach (http://php.net/foreach) ($spiChars as $replace => $search) {
str_replace (http://php.net/str_replace)($search, $replace, $pre_jsoned_string);
}
Something like that should do the trick ... I am missing some, I just took up the Character Map and copyed all of the ones that where to do with each letter according to the Windows Character Map. That said, you should be able to this programmatically ... some how. (If the Character Map knows this information then it must be some where.)
filur
26th July 2008, 23:51
Working fine here.
<?php
$ext = new ReflectionExtension('json');
echo phpversion(), ' / ', $ext->getName(), '-', $ext->getVersion(), PHP_EOL; // 5.2.6 / json-1.2.1
echo json_encode('Jörg Baumgarth'), PHP_EOL; // "J"
echo $json = json_encode(mb_convert_encoding('Jörg Baumgarth', 'UTF-8', 'ISO-8859-1')), PHP_EOL; // "J\u00f6rg Baumgarth"
echo mb_convert_encoding(json_decode($json), 'ISO-8859-1', 'UTF-8'), PHP_EOL; // Jörg Baumgarth
?>
Victor
27th July 2008, 16:39
yeah actually i had a bug in my json_prepare function. The json_encode function is fine.
But now i wonder if i can just make the json output unicoded. I don't know if that's going to break some applications. So maybe i need to increase the version number for this fix?
@ splattael : maybe you care to comment on that?
Dygear
27th July 2008, 20:10
Working fine here.
I was waiting for some one to out program me, I thought it was going to be you.
splattael
28th July 2008, 10:51
But now i wonder if i can just make the json output unicoded. I don't know if that's going to break some applications. So maybe i need to increase the version number for this fix?
I expect JSON to be UTF-8 unless documented otherwise.
I don't think you need to increase the version number because it's a fix not an enhancement - people using JSON before got wrong data anyway ;)
Thank you for investigating the problem :)
Victor
28th July 2008, 11:02
good point. Ok it's fixed now then.
splattael
28th July 2008, 11:43
Works like a charm!
>> LFSWorldHelper.fetch_hot_laps_chart("KY2", "FXR").select {|r| r["id_hl"] == 28427 }
=> [{"racername"=>"Jörg Baumgarth", "split1"=>32100, "flags_hlaps"=>513, "split2"=>71080, "id_hl"=>28427, "split3"=>0, "laptime"=>104920}]
Thank you :)
niall09
10th November 2008, 23:01
Hi, im having a little problem. I'm new to php and the pubstat system, so my code probably needs a little touch up.
Ok, when I upload my page to my server, it won't show if i'm offline/online etc. However, on my WAMP server, it all works fine and displays the way i want it to.
<?php
echo "<p>Niall's Online Status:</p>";
if( $str=file_get_contents( 'http://www.lfsworld.net/pubstat/get_stat2.php?version=1.4&idk=<ident-key>&action=pst&racer=niall09'))
if($str[66] == "0")
echo "<p><span class='off'>Offline</span></p>";
if($str[66] == "1")
echo "<p><span class='spec'>Spectating</span></p>";
if($str[66] == "2")
echo "<p><span class='pit'>in the pits</span></p>";
if($str[66] == "3")
echo "<p><span class='race'>Racing</span></p>";
?>
Any help would be appreciated :)
Greenseed
11th November 2008, 00:31
since you say from a WAMP configured server it working , i think it probaly a configuration difference your probleme.
Only thing i can think of is this:
Help on the command "file_get_contents()" from the php manuel.
Tip You can use a URL as a filename with this function if the fopen wrappers (http://www.lfsforum.net/ref.filesystem.html#ini.allow-url-fopen) have been enabled. See fopen() (http://www.lfsforum.net/function.fopen.html) for more details on how to specify the filename and Appendix O, List of Supported Protocols/Wrappers (http://www.lfsforum.net/wrappers.html) for a list of supported URL protocols.
Hope it help.
P.S. the php manuel can be downloaded into a .chm format and is very simple and well done to get help with php.
bdshan
11th November 2008, 13:34
Check your php.ini on you server. I know this was an issue for me the first time I started with php.
;;;;;;;;;;;;;;;;;;
; Fopen wrappers ;
;;;;;;;;;;;;;;;;;;
; Whether to allow the treatment of URLs (like http:// or ftp://) as files.
allow_url_fopen = On
EQ Worry
13th January 2009, 10:06
PubStats via Web are great, I use them a lot in the AIRIO tracker. However I dare to come forward with a few suggestions. I posted some of those already in June last year, but without response. First the most troublesome matter:
1) After a bit of testing I came to the conclusion that the PubStat service is checking IP address the requests are coming from and if "tarpitted" (meaning limited, not paid) service is used, it will refuse requests from one IP coming faster than with 5 seconds delay. It does not matter the requests are coming with a key belonging to some other person, they come too fast from the same IP and are refused.
Well, in my view that approach limits usability of the service. There may be different people/applications on the same IP (without knowing the fact) and they may get random refusals. I know a server where Airio cannot download LFSW data in approx. 20 percent of requests, and I believe it is because there is already some other application on the same IP. An admin there can do nothing about it, generating new key for himself will not help, binding it to IP will not help either.
I can understand this is implemented so that people do not generate dozens of pubstat keys for themselves under different names and using many of those at the same time. Still, it prevents also legitimate pubstats usage. Paying for the service may provide only partial solutions, because if one person on the same IP pays for the service and sends many requests, while the other not, well - the one wanting to use free requests once every 5 seconds will be rather seriously damaged, wont he, with many requests turned down for no apparent reason?
My suggestion: Remove the IP check, let it run only on pubstat key basis, but at the same time let only licensed people generate and use the keys. As I see it, all the above troubles will be solved. And I can assure you, they are real troubles. I saw wrong people being kicked in LFS prior to patch Z when IP was used instead of username in demo, and this seems a similar matter to me. Limiting and deciding something based on IP is not good with the lot of shared IPs around the world.
2) What I miss most in PubStat data is the ability to get player's status - Demo, S1 or S2. I see this was not necessary in the past but since even Demo players have since patch Z LFSW stats available the licence info would be useful - e.g. it would be possible to see if a server in demo config can be safely switched into S1 or S2 mode without anyone losing connection.
3) One more small thing I miss in the stats is date/time in WR table saying when that record was made or uploaded.
Thanks for reading this far. I really believe especially point 1 needs serious attention, that is if something obvious did not escape me and I'm not making a big mistake somewhere. :) I also hope I did not miss some previous post concerning this, but searching gave me no similar results.
EQ Worry
1st March 2009, 09:19
Is this thread dead? No response for 6 weeks. :(
Concerning the free availability of LFSW stats which is limited by IP address and not (as it may seem) by PubStat key. My application using the data (see previous post) currently runs on 500servers and may appear on other server-hosting sites. I guess all servers (or many of them) on such site use the same IP address. Does it mean they will block each other, rendering the free access to LFSW data unreliable/useless?
Thanks for an answer/solution!
Dygear
3rd March 2009, 03:42
Is this thread dead? No response for 6 weeks. :(
Concerning the free availability of LFSW stats which is limited by IP address and not (as it may seem) by PubStat key. My application using the data (see previous post) currently runs on 500servers and may appear on other server-hosting sites. I guess all servers (or many of them) on such site use the same IP address. Does it mean they will block each other, rendering the free access to LFSW data unreliable/useless?
Thanks for an answer/solution!
As I cannot duplicate the problem, I can't really help you. The only person that could answer that question is on the dev team and they have remained silent. This might be due to the fact there is no real fix for this sort of issue, atlest none that I can think of at this point in time.
Checking IP and Key, and making sure they don't belong to the same account would be the only way I could think of allowing people to share an IP address while not allowing people to make a million keys and cycle though them as needed on a request basis. Checking that the IP & Key does not belong to the same user is the only fix I could come up with.
if (isTarPittedIP($REMOTE_IP) == TRUE && isTarPittedUser($AUTH_KEY)) {
// Tarpit the User for remainder of TarPit Time; ... effectively die() here.
}
EQ Worry
3rd March 2009, 12:18
Well, I think it is relatively easy to test it. If you do not have 2 (or more) accounts yet, create one demo, generate key and try to send two requests for LFSW data using the keys of two different people one right after another (using a browser). The 2nd request will be refused, because it is coming from the same IP.
When I was testing this I also discovered a rather interesting fact. If you use 2 computers with different IPs, you may actually use the same key belonging to the same person in quick succession without getting the refuse message.
My conclusion is that the PubStat key does not play any role in "tarpitting" the service. It is the IP that matters and that is IMO very wrong. My proposal is simple: Allow only licensed people to have PubStat keys, but do not use IP in limiting the access, because it is a very unsafe way very likely to prevent even legitimate usage of LFSW data fully complying with set conditions.
And if three licensed people join their keys in one application to be able to get all data faster, is it a real problem? Obviously most people have no personal use of this service. The main thing is to remove this access from demo accounts, leave it only to S1/2, but without checking IP. Many IPs are shared, many, especially in LFS servers.
Dygear
4th March 2009, 21:21
The main thing is to remove this access from demo accounts, leave it only to S1/2, but without checking IP.
Who cares if they are demo users, if they have a positive balance in their account for premium stats that's really all that matters. I would agree that Tar Pitting the IP address is wrong, and I can only assume a mistake. I'll see if I can't get Victors attention over this, see what he says about the matter.
EQ Worry
4th March 2009, 22:10
Thanks a lot! I'd really be interested to know of some applicable solution from the author of the system.
Victor
5th March 2009, 13:30
The IP check was derived from an anti-flooding check that's been in place from the start. I can do that check super quick, while on the other hand first having to check userid requires a database query.
But I've had a thought for a while now to do away with tarpitting altogether and do it like google for example : only allow a limited number of requests per user per day. Then I can do away with the flood check, because that was put in place because certain users could not make their script wait 5 seconds and started to hammer the pubstats with requests until the 5 seconds tarpit were over.
And I might remake the pubstats one final time actually, because it's still a bit shabby due to my former inexperience. For example no error codes and I know there are some internal inefficiencies too.
I'd keep the current pubstat still working, but the new version 1.5 (and onwards) would output a bit different data then before ... or should it be a whole new url?
HorsePower
5th March 2009, 13:53
Hi Victor,
if you really plan to change output formats, I would prefer a new URL and a parallel availabilty of 1.4 and 1.5 for some time.
This would give us the chance to work on our tools while they are still running with 1.4.
Thanks!
Dygear
5th March 2009, 14:46
Thanks for the reply Vic, much appreciated.
I assume you mean with the IP Tar pitting method that you currently have implemented, your using a database query with the IP Address of Client and the Time of the Last Query in a database with it's storage type set to memory, hence the very fast part. While that works wonderful on the old 'nameless client' system that you had running, I'm not sure if it still remains the best solution in the case of the mandatory IDKey implementation.
Further more I would have to add that, I was my thought that you did not wish the Pub Stats to be stored, it was meant to provide a much more 'live' experience to the end user. Where as what your currently proposing would pretty much mandate the use of storage to keep content flowing to the end user, or require a system (such as a cron task) that would run in the background every X amount of minutes as to not quite add up to the total query limit of the day and still provide a almost live experience. That being the only way to provide that 'live' status that was the original intention of the PubStats.
I'm a big fan of error handling when possible, so adding the error codes to the pubstats system could only be a good thing. With the current version 1.4 and the new version of 1.5 and onwards I don't really need a new URL and I would slightly discourage it as you have kind of set a sudo standard with the current convention. (Yes, I know that statement goes against some W3C document that I can't find at this time.) Makes no difference to me though.
EQ Worry
5th March 2009, 15:14
Hi Victor and thanks for the reply! Generally I'm happy with the PubStats access, the data it offers, the form it uses, the way tarpitting works (5 seconds delay). I'm struggling with the IP check because if my application runs in several instances on one LFS servers farm, whey will in effect block each other, solution not possible (except when all instances use paid access, but that would, I guess, never happen).
I can understand the IP check is easy and fast, but it is in my view too limiting (just as was the IP kicking/banning used in demo prior to patch Z). Also limiting number of requests per user per day would not have the desired effect for you, I'm afraid, because anyone can have any number of demo accounts and demo people may generate PubStats keys. I believe such mechanism would also include database queries increasing some access count in each account. Maybe this DB access could be used rather for the key check. But of course I'm no expert in these matters.
My general feeling as a user is that it is very nice as it is now, just the IP check (although quick) should be replaced by the supplied key check. And to prevent people using cyclically keys from multiple accounts, limiting this access only to licensed accounts may be a good protection for you.
One again, thanks for the previous reply. Have a nice day!
Victor
5th March 2009, 15:24
Thanks for the reply Vic, much appreciated.
I assume you mean with the IP Tar pitting method that you currently have implemented, your using a database query with the IP Address of Client and the Time of the Last Query in a database with it's storage type set to memory, hence the very fast part. While that works wonderful on the old 'nameless client' system that you had running, I'm not sure if it still remains the best solution in the case of the mandatory IDKey implementation.
Further more I would have to add that, I was my thought that you did not wish the Pub Stats to be stored, it was meant to provide a much more 'live' experience to the end user. Where as what your currently proposing would pretty much mandate the use of storage to keep content flowing to the end user, or require a system (such as a cron task) that would run in the background every X amount of minutes as to not quite add up to the total query limit of the day and still provide a almost live experience. That being the only way to provide that 'live' status that was the original intention of the PubStats.
I'm a big fan of error handling when possible, so adding the error codes to the pubstats system could only be a good thing. With the current version 1.4 and the new version of 1.5 and onwards I don't really need a new URL and I would slightly discourage it as you have kind of set a sudo standard with the current convention. (Yes, I know that statement goes against some W3C document that I can't find at this time.) Makes no difference to me though.
well i use shared memory to store IP info and time, so i don't have to even connect to the database to check ip stuff. But that's besides the point for now.
as for the live experience for the user - i wouldn't be talking about 100 queries a day, but rather something like 10000 per day. If one really needs more than that then premium should be used.
But if noone really minds the tarpitting .. eh well i could just change the ip check to an idkey check and leave it at that.
I'll have a look soon.
EQ Worry
5th March 2009, 15:55
i wouldn't be talking about 100 queries a day, but rather something like 10000 per day. If one really needs more than that then premium should be used.
OMG, I see we're talking here about numbers different by several orders of magnitude. :) To say the truth, I was afraid it will be limited to something like 100 requests per day, 1000 at best. I'll be happy with 10K that as long as it is not counted per IP address but per key or account.
But if noone really minds the tarpitting .. eh well i could just change the ip check to an idkey check and leave it at that.
Well, if that is easier for you... The good thing on this approach is it will remove a hidden obstacle without any code changes necessary on user's part. And it may be a quick and easy patch for you as well (I hope).
Victor
5th March 2009, 19:50
Would someone mind testing the changes?
I've a test url for that - it should output exactly the same stuff, but internally it's rewritten a bit and now tarpitting by user (no matter which or how many idkey's are used, unless of course with premium access)
The url is the same, but instead of the script name get_stat2.php, use get_stat2t.php
If everything appears to be ok I'll replace the original one with this.
---
a general error message note which I think I've not mentioned before is :
"You shouldn't flood me! You're locked out for 15 minutes now. DO NOT make your program do its requests as fast as it can, until the tarpit is over..."
This happens if you really hammer the script and do more than 15 queries within 3 seconds. There aren't many people who see this, but as dygear does the LFSWSDK he might want to know about this.
Dygear
5th March 2009, 20:57
"You shouldn't flood me! You're locked out for 15 minutes now. DO NOT make your program do its requests as fast as it can, until the tarpit is over..."
This happens if you really hammer the script and do more than 15 queries within 3 seconds. There aren't many people who see this, but as dygear does the LFSWSDK he might want to know about this.
Thanks going to be interesting to program for without some kind of persistent save mechanism, or I guess I could just die on this statement from LFSWorld.
EQ Worry
5th March 2009, 21:08
Would someone mind testing the changes?
OK, I've done some quick testing. From my perspective it looks good, very good. It seems the sent keys really matter and if they are from two different accounts, each one is tarpitted separately, no matter the requests come from the same IP. Two keys from the same account are tarpitted as one, as I would expect.
It looks that with this update my primary concern is a history. Thanks a million, both to Victor and also to Dygear who, I believe, called Victor's attention to my post(s). Again, thanks a lot. :thumb:
Dygear
5th March 2009, 21:13
Dygear who, I believe, called Victor's attention to my post(s). Again, thanks a lot. :thumb:
Nope, not I, Victors just being his ever vigilant self. Credit goes to him.
Flame CZE
5th March 2009, 21:13
Is it normal when it says can't reload this page that quickly after another?
Because when more people visit the page and do the request, this message will appear to them :(
EQ Worry
5th March 2009, 21:25
Is it normal when it says can't reload this page that quickly after another?
Because when more people visit the page and do the request, this message will appear to them :(
Yes, very normal, it is the whole purpose of tarpitting. :D There must a pause of 5 seconds between requests coming from the same person (or earlier the same IP address), or this message is displayed...
Flame CZE
5th March 2009, 21:29
Yes, very normal, it is the whole purpose of tarpitting. :D There must a pause of 5 seconds between requests coming from the same person (or earlier the same IP address), or this message is displayed...
ah :( :D but victor said 15 requests per 3 seconds :)
thats bad for me, I cant output more than one request :)
Victor
5th March 2009, 21:39
nono, the 15 requests per 3 seconds give you a 15 minute ban from pubstats. This is a bad thing!
Normal tarpitting is a mechanism that allows you to make 1 request per 5 seconds, which is normal.
Flame CZE
5th March 2009, 21:40
Thanks :thumb:
Victor
5th March 2009, 21:42
Thanks going to be interesting to program for without some kind of persistent save mechanism, or I guess I could just die on this statement from LFSWorld.
ideally they should be notified that they stink of lazy and should insert a sleep (5) or whatever in their loop.
Dygear
5th March 2009, 22:01
ideally they should be notified that they stink of lazy and should insert a sleep (5) or whatever in their loop.
LOL, yes. However as the SDK has that sleep it's very unlikely that I'll ever see that error message, never the less, I'll handle it. I might just quote you in the error message :).
Victor
5th March 2009, 22:06
yes, honestly it rarely happens (anymore), so it's not a big deal. And if you're already sleeping then it indeed will never happen at all for those who use your kit.
EQ Worry
5th March 2009, 22:07
When can we expect the new principle checking keys instead of IPs to be put into service? Would it replace the previous one or will it stay with t at the end of the PHP file name as an alternative?
Victor
5th March 2009, 22:08
yes I've already copied it in place. The one with the t doesn't exist anymore.
vBulletin® v3.8.6, Copyright ©2000-2012, Jelsoft Enterprises Ltd.