The online racing simulator
So, i have this:


<?php 
php
require 'lfsworldsdk.php'
$SDK = new LFSWorldSDK('idkey goes here'); 
function 
triedicka($SDK$track$car$racers) { 
    
$chart $SDK->get_ch(array($track), array($car)); 
    
$ret   = array(); 
    foreach (
$chart[$track][$car] as $key => $item) { 
    if (
in_array($item['racername'], $racers)) { 
            
$ret[]  = $item
            
$sort[] = $item['time']; 
        } 
    } 
     
    
array_multisort($sortSORT_ASC$ret); 
    return 
$ret

$driversfxo = array(       
 
'Atti Honyi (SK)',          
 
'Megin'
);
$table1 triedicka($SDK'000''FXO'$driversfxo);

$driversrb4 = array(
              
'Sisolak',
              
'eraser_svk'
);
sleep(5);
$table2 triedicka($SDK'000''RB4'$driversrb4);
$driversxrt = array(
                
'Ghost_CZ',
                
'BIGMAN'
); 
sleep(5);
$table3 triedicka($SDK'000''XRT'$driversxrt);
$all array_merge($table1$table2$table3);
 
//--------------- how sort $all ?
 
echo "<BR>FXO:<br/>";
foreach (
$table1 as $p1 => $driver1) {
                echo (
$p 1), '. '$driver1['racername'],' - '$driver1['time'], '<br/>'PHP_EOL;
}
echo 
"<BR>RB4:<br/>";            
foreach (
$table2 as $p2 => $driver2) {
                echo (
$p 1), '. '$driver2['racername'],' - '$driver2['time'], '<br/>'PHP_EOL;
}
echo 
"<BR>XRT:<br/>";                
foreach (
$table3 as $p3 => $driver3) {
                echo (
$p 1), '. '$driver3['racername'],' - '$driver3['time'], '<br/>'PHP_EOL;
}
echo 
"<BR>ALL:<br/>";
foreach (
$all as $p => $driver) {
                echo (
$p 1), '. '$driver['racername'],' - '$driver['time'], '<br/>'PHP_EOL;
}
 
?>

U can see that $all is undorted. ($all is join array of arrays of drivers with xrt, rb4 and xrt) How to sort $all? Probably i have to create new function like function tiedicka. I try it but failed :-(

Dygear: sorry but your cleaned code in sort function din't work as well :-(
Try this.


<?php 
require 'lfsworldsdk.php';
$SDK = new LFSWorldSDK('idkey goes here');

function 
some_function_name($SDK$racers) {
    static 
$charts = array();
    
$ret $sort = array();
    
    foreach (
$racers as $racername => $combo) {
        
$c = &$charts[$combo['track']][$combo['car']];
        
        if (
FALSE == isset($c)) {
            
sleep(5);
            
$c $SDK->get_ch(array($combo['track']), array($combo['car']));
        }
        
        foreach (
$c[$combo['track']][$combo['car']] as $key => $item) {
            if (
$item['racername'] == $racername) {
                
$ret[]  = array_merge($item$combo);
                
$sort[] = $item['time'];
            }
        }
    }
    
    
array_multisort($sortSORT_ASC$ret);
    return 
$ret;
}

function 
disptime($t) {
    return 
date('i:s', ((int) $t 1000)) . '.' $t 1000;
}

$drivers = array
(
    
'Atti Honyi (SK)'    => array('track' => '000''car' => 'FXO'),
    
'Megin'                => array('track' => '000''car' => 'FXO'),
    
'Sisolak'            => array('track' => '000''car' => 'RB4'),
    
'eraser_svk'        => array('track' => '000''car' => 'RB4'),
    
'Ghost_CZ'            => array('track' => '000''car' => 'XRT'),
    
'BIGMAN'            => array('track' => '000''car' => 'XRT')
);

$table some_function_name($SDK$drivers);

foreach (
$table as $p => $driver)
    echo (
$p 1), '. '$driver['racername'], ' '$driver['car'], ' 'disptime($driver['time']), '<br />'PHP_EOL;
?>

That's the solution of my problem! Great. Works excelent. Thanx a lot.
And here is One Point Six, 1.6 with a new feature and a long awaited bug fix.

Notes:
* New Function, get_progress($host).
* Return Value Change in get_pst($racer).
* Online Bug Fixed, Only Returns One Online.
* First Online now Called Credits.
* Second Online, the online status, remains as Online.


<?php 
php

$SDK 
= new LFSWorldSDK('idk'true);

/*
** Live For Speed World SDK, easily find what you need from the World of Live For Speed.
**
** @package   LFSWorldSDK
** @since     2007-10-27 06:30
** @author    Mark 'Dygear' Tomlin
** @coauthor  Mikael 'filur' Forsberg
** @license   MIT License (http://opensource.org/licenses/mit-license.php)
** @copyright Copyright (C) 2006, Mark 'Dygear' Tomlin & Mikael 'filur' Forsberg.
** @version   1.6
*/

class LFSWorldSDK {
    function 
LFSWorldSDK($idk$ps false) {
        
$this->ps $ps;
        
$this->idk $idk;
        
$this->version 1.3;
    }
    function 
make_query($qryStr$file 'get_stat2.php') {
        return 
file_get_contents("http://www.lfsworld.net/pubstat/{$file}?version={$this->version}&idk={$this->idk}&ps={$this->ps}{$qryStr}");
    }
    function 
get_hl($racer) {
        if (
is_array($racer)) {
            foreach(
$racer as $uname) {
                
$result[$uname] = $this->get_hl($uname);
            }
        } else {
            foreach (
explode("\n"$this->make_query("&action=hl&racer={$racer}")) as $line => $data) {
                list(
$result[$line]['id_hl'], $result[$line]['track'], $result[$line]['car'], $result[$line]['split1'], $result[$line]['split2'], $result[$line]['split3'], $result[$line]['time'], $result[$line]['flags_hlaps']) = split(' '$data8);
            }
            unset(
$result[$line]);
        }
        return 
$result;
    }
    function 
get_pb($racer) {
        if (
is_array($racer)) {
            foreach(
$racer as $uname) {
                
$result[$uname] = $this->get_pb($uname);
            }
        } else {
            foreach (
explode("\n"$this->make_query("&action=pb&racer={$racer}")) as $line => $data) {
                list(
$result[$line]['track'], $result[$line]['car'], $result[$line]['time'], $result[$line]['lapcount']) = split(' '$data4);
            }
            unset(
$result[$line]);
        }
        return 
$result;
    }
    function 
get_ch($track$car$control null) {
        if (
is_array($track) || is_array($car)) {
            if (
is_array($track) && is_array($car)) {
                foreach(
$track as $tname) {
                    foreach (
$car as $cname) {
                        
$result[$tname][$cname] = $this->get_ch($tname$cname$control);
                    }
                }
            } else if (
is_array($track)) {
                foreach(
$track as $tname) {
                    
$result[$tname] = $this->get_ch($tname$cname$control);
                }
            } else if (
is_array($car)) {
                foreach (
$car as $cname) {
                    
$result[$cname] = $this->get_ch($tname$cname$control);
                }
            }
        } else {
            foreach (
explode("\n"$this->make_query("&action=ch&track={$track}&car={$car}&control={$control}")) as $line => $data) {
                list(
$result[$line]['split1'], $result[$line]['split2'], $result[$line]['split3'], $result[$line]['time'], $result[$line]['flags_hlaps'], $result[$line]['racername']) = split(' '$data6);
            }
            unset(
$result[$line]);
        }
        return 
$result;
    }
    function 
get_wr() {
        foreach (
explode("\n"$this->make_query("&action=wr")) as $line => $data) {
            list(
$result[$line]['id_wr'], $result[$line]['track'], $result[$line]['car'], $result[$line]['split1'], $result[$line]['split2'], $result[$line]['split3'], $result[$line]['time'], $result[$line]['flags_hlaps'], $result[$line]['racername']) = split(' '$data9);
        }
        unset(
$result[$line]);
        return 
$result;
    }
    function 
get_pst($racer) {
        if (
is_array($racer)) {
            foreach(
$racer as $uname) {
                
$result[$uname] = $this->get_pst($uname);
            }
        } else {
            list(
$result['distance'], $result['fuel'], $result['laps'], $result['hosts'], $result['wins'], $result['second'], $result['third'], $result['finished'], $result['quals'], $result['pole'], $result['credits'], $result['drags'], $result['drag'], $result['status'], $result['hostname'], $result['time'], $result['track'], $result['car']) = explode("\n"$this->make_query("&action=pst&racer={$racer}"));
        }
        return 
$result;
    }
    function 
get_hosts() {
        
$string $this->make_query("&action=hosts");
        for (
$pointer 0$i 0$pointer <= strlen($string); $i++) {
            
$NumberOfRacers = @unpack("c"substr($string$pointer 521));
            
$NumberOfRacers $NumberOfRacers[1];
            
$NumberOfRacersLen $NumberOfRacers 24;
            
$PointerPast $NumberOfRacersLen 53;
            
$result[$i] = array();
            if ((
$result[$i] = @unpack("a32hostname/A4tmlt/a4tcrm/icars/irules/claps/cqual/cspare1/cspare2/cnrofracers/a{$NumberOfRacersLen}racernames"substr($string$pointer$PointerPast)))) {
                
$result[$i]['racernames'] = preg_split("/\\0/"$result[$i]['racernames'], -1PREG_SPLIT_NO_EMPTY);
                
$result[$i]['tmlt'] = unpack("ctype/cmain/a1letter/ctestId"$result[$i]['tmlt']);
                
$result[$i]['tcrm'] = unpack("ctrack/cconfig/creversed/cmax"$result[$i]['tcrm']);
            }
            else
                unset(
$result[$i]);
            
$pointer += $PointerPast;
        }
        return 
$result;
    }
    function 
get_progress($host) {
        
$string $this->make_query("&host={$host}"'hostprogress.php');
        list(
$null$string) = explode("\n"$string);
        return 
json_decode($stringtrue);
    }
    function 
get_teams() {
        
$string $this->make_query("&action=teams");
        for (
$pointer 0$i 0$pointer <= strlen($string); $i++) {
            
$infoLen = @unpack("S"substr($string$pointer 2982));
            
$infoLen $infoLen[1];
            
$nrMembers = @unpack("S"substr($string$pointer 300 $infoLen2));
            
$nrMembers $nrMembers[1] * 24;
            
$PointerPast 302 $infoLen $nrMembers;
            
$result[$i] = array();
            if ((
$result[$i] = @unpack("a128team/a6tag/a32country/a128url/Ibits/Sinfo_len/a{$infoLen}info/Snr_members/a{$nrMembers}members"substr($string$pointer$PointerPast)))) {
                
$result[$i]['members'] = preg_split("/\\0/"$result[$i]['members'], -1PREG_SPLIT_NO_EMPTY);
                
$result[$i]['info'] = urldecode($result[$i]['info']);
            }
            else
                unset(
$result[$i]);
            
$pointer += $PointerPast;
        }
        return 
$result;
    }
    function 
get_hl_log($log_filter 4$lines 150$control null$starttime 0) {
        
$string $this->make_query("&action=hl_log&log_filter={$log_filter}&lines={$lines}&control={$control}&starttime={$starttime}&format=3");
        for (
$pointer 0$i 0$pointer <= strlen($string); $i++) {
            
$result[$i] = array();
            if ((
$result[$i] = @unpack("itime/a24racer/a32country/A4tcrc/i4split/Spos/Sflags/iid_hl"substr($string$pointer88))))
                
$result[$i]['tcrc'] = unpack("ctrack/cconfig/creversed/ccar"$result[$i]['tcrc']);
            else
                unset(
$result[$i]);
            
$pointer += 88;
        }
        return 
$result;
    }
}


$LFS_Tracks = array(
    
'BL1'    => array('Blackwood''GP Track'2.1'Standard''000'),
    
'BL1R'    => array('Blackwood''GP Track'2.1'Reversed''001'),
    
'BL2'    => array('Blackwood''Rally Cross'1.2'Standard''010'),
    
'BL2R'    => array('Blackwood''Rally Cross'1.2'Reversed''011'),
    
'BL3'    => array('Blackwood''Car Park'0.2'Arena''020'),
    
'SO1'    => array('South City''Classic'1.3'Standard''100'),
    
'SO1R'    => array('South City''Classic'1.3'Reversed''101'),
    
'SO2'    => array('South City''Sprint Track 1'1.3'Standard''110'),
    
'SO2R'    => array('South City''Sprint Track 1'1.3'Reversed''111'),
    
'SO3'    => array('South City''Sprint Track 2'0.8'Standard''120'),
    
'SO3R'    => array('South City''Sprint Track 2'0.8'Reversed''121'),
    
'SO4'    => array('South City''Long'2.5'Standard''130'),
    
'SO4R'    => array('South City''Long'2.5'Reversed''131'),
    
'SO5'    => array('South City''Town Course '2.0'Standard''140'),
    
'SO5R'    => array('South City''Town Course'2.0'Reversed''141'),
    
'FE1'    => array('Fern Bay''Club'1.0'Standard''200'),
    
'FE1R'    => array('Fern Bay''Club'1.0'Reversed''201'),
    
'FE2'    => array('Fern Bay''Green Track'1.9'Standard''210'),
    
'FE2R'    => array('Fern Bay''Green Track'1.9'Reversed''211'),
    
'FE3'    => array('Fern Bay''Gold Track'2.2'Standard''220'),
    
'FE3R'    => array('Fern Bay''Gold Track'2.2'Reversed''221'),
    
'FE4'    => array('Fern Bay''Black Track'4.1'Standard''230'),
    
'FE4R'    => array('Fern Bay''Black Track'4.1'Reversed''231'),
    
'FE5'    => array('Fern Bay''Rally Cross'1.3'Standard''240'),
    
'FE5R'    => array('Fern Bay''Rally Cross'1.3'Reversed''241'),
    
'FE6'    => array('Fern Bay''RallyX Green'0.5'Standard''250'),
    
'FE6R'    => array('Fern Bay''RallyX Green'0.5'Reversed''251'),
    
'AU1'    => array('Autocross''Autocross'0.3'Arena''300'),
    
'AU2'    => array('Autocross''Slod Pad'0.1'Arena''310'),
    
'AU3'    => array('Autocross''Drag Strip'0.7'Single Stage''320'),
    
'AU4'    => array('Autocross''8 Lane Drag'0.7'Single Stage''330'),
    
'KY1'    => array('Kyoto Ring''Oval'1.9'Standard''400'),
    
'KY1R'    => array('Kyoto Ring''Oval'1.9'Reversed''401'),
    
'KY2'    => array('Kyoto Ring''National'3.2'Standard''410'),
    
'KY2R'    => array('Kyoto Ring''National'3.2'Reversed''411'),
    
'KY3'    => array('Kyoto Ring''GP Long'4.6'Standard''420'),
    
'KY3R'    => array('Kyoto Ring''GP Long'4.6'Reversed''421'),
    
'WE1'    => array('Westhill''International'3.2'Standard''500'),
    
'WE1R'    => array('Westhill''International'3.2'Reversed''501'),
    
'AS1'    => array('Aston''Cadet'1.2'Standard''600'),
    
'AS1R'    => array('Aston''Cadet'1.2'Reversed''601'),
    
'AS2'    => array('Aston''Club'1.9'Standard''610'),
    
'AS2R'    => array('Aston''Club'1.9'Reversed''611'),
    
'AS3'    => array('Aston''National'3.5'Standard''620'),
    
'AS3R'    => array('Aston''National'3.5'Reversed''621'),
    
'AS4'    => array('Aston''Historic'5.0'Standard''630'),
    
'AS4R'    => array('Aston''Historic'5.0'Reversed''631'),
    
'AS5'    => array('Aston''Grand Prix'5.5'Standard''640'),
    
'AS5R'    => array('Aston''Grand Prix'5.5'Reversed''641'),
    
'AS6'    => array('Aston''Grand Touring'5.0'Standard''650'),
    
'AS6R'    => array('Aston''Grand Touring'5.0'Reversed''651'),
    
'AS7'    => array('Aston''North'3.2'Standard''660'),
    
'AS7R'    => array('Aston''North'3.2'Reversed''661'),
    
'000'    => 'BL1',
    
'001'    => 'BL1R',
    
'010'    => 'BL2',
    
'011'    => 'BL2R',
    
'020'    => 'BL3',
    
'100'    => 'SO1',
    
'101'    => 'SO1R',
    
'110'    => 'SO2',
    
'111'    => 'SO2R',
    
'120'    => 'SO3',
    
'121'    => 'SO3R',
    
'130'    => 'SO4',
    
'131'    => 'SO4R',
    
'140'    => 'SO5',
    
'141'    => 'SO5R',
    
'200'    => 'FE1',
    
'201'    => 'FE1R',
    
'210'    => 'FE2',
    
'211'    => 'FE2R',
    
'220'    => 'FE3',
    
'221'    => 'FE3R',
    
'230'    => 'FE4',
    
'231'    => 'FE4R',
    
'240'    => 'FE5',
    
'241'    => 'FE5R',
    
'250'    => 'FE6',
    
'251'    => 'FE6R',
    
'300'    => 'AU1',
    
'310'    => 'AU2',
    
'320'    => 'AU3',
    
'330'    => 'AU4',
    
'400'    => 'KY1',
    
'401'    => 'KY1R',
    
'410'    => 'KY2',
    
'411'    => 'KY2R',
    
'420'    => 'KY3',
    
'421'    => 'KY3R',
    
'500'    => 'WE1',
    
'501'    => 'WE1R',
    
'600'    => 'AS1',
    
'601'    => 'AS1R',
    
'610'    => 'AS2',
    
'611'    => 'AS2R',
    
'620'    => 'AS3',
    
'621'    => 'AS3R',
    
'630'    => 'AS4',
    
'631'    => 'AS4R',
    
'640'    => 'AS5',
    
'641'    => 'AS5R',
    
'650'    => 'AS6',
    
'651'    => 'AS6R',
    
'660'    => 'AS7',
    
'661'    => 'AS7R'
);

$LFS_Cars = array(
    
'UF1' => 'UF 1000',
    
'XFG' => 'XF GTI',
    
'XRG' => 'XR GT',
    
'LX4' => 'LX4',
    
'RB4' => 'RB4 GT',
    
'FXO' => 'FXO TURBO',
    
'XRT' => 'XR GT TURBO',
    
'LX6' => 'LX6',
    
'RAC' => 'RA',
    
'FZ5' => 'FZ50',
    
'UFR' => 'UF GTR',
    
'XFR' => 'XF GTR',
    
'MRT' => 'MTR5',
    
'FOX' => 'FORMULA XR',
    
'FO8' => 'FORMULA V8',
    
'BF1' => 'BMW SAUBER',
    
'FXR' => 'FXO GTR',
    
'XRR' => 'XR GTR',
    
'FZR' => 'FZ50 GTR',
    
// Classes
    
'ALL' => 'All Cars Allowed',
    
'STD' => 'UF1,XFG,XRG',
    
'TBO' => 'UF1,XFG,XRG,LX4,RB4,FXO,XRT',
    
'LRF' => 'UF1,XFG,XRG,LX4,RB4,FXO,XRT,LX6,RAC,FZ5',
    
'FWD' => 'UF1,XFG,FXO,UFR,XFR',
    
'GTR' => 'FXR,XRR,FXR',
    
'S-S' => 'MRT,FOX,FO8,BF1'
);

?>

Has anyone had the chance to use this yet? Any issues you would like to report, anything you would like added, anything you would like improved? I would like to say that I will at some point implement the compression that LFSWorld offers, me thinks that will happen in the next build. You can expect the next build in around a weeks time, I'm going to take some time off the project.
FYI re 1.6

Your sig point to the first post which (for me) points to the download of 1.5
Fair point, that is now fixed.
dygear - i mailed you a SDK version with compression earlier this week. Did you receive that mail?
Dude, that's awesome, I'm stoked! Thanks for the help. I see the changes, and I'll commit all of the changes later today. (Along with the changes I made in the last version to keep up with continuity.
As I don't want to keep this update away from anyone for any longer, and I need to get in contact with the guys at SourceForge to upload the new versions. I'll just update the new version here.

Changes:
  • New: Compression used when available. (Thanks Victor)
  • Cng: $LFS_Tracks changed, made $LFSW_Tracks.
  • Cng: $LFS_Cars changed, made $LFS_Car_Classes.

<?php 
php

$SDK 
= new LFSWorldSDK('idk'true);

/*
** Live For Speed World SDK, easily find what you need from the World of Live For Speed.
**
** @package   LFSWorldSDK
** @since     2007-10-27 06:30
** @author    Mark 'Dygear' Tomlin
** @coauthor  Mikael 'filur' Forsberg
** @coauthor  Victor van Vlaardingen.
** @license   MIT License (http://opensource.org/licenses/mit-license.php)
** @copyright Copyright (C) 2006, Mark 'Dygear' Tomlin, Mikael 'filur' Forsberg & Victor van Vlaardingen.
** @version   1.7
*/

class LFSWorldSDK {
    function 
LFSWorldSDK($idk$ps false) {
        
$this->ps $ps;
        
$this->idk $idk;
        
$this->version 1.3;
        
$this->compression = (function_exists ('gzinflate')) ? 0;
    }
    function 
make_query($qryStr$file 'get_stat2.php') {
        return 
$this->res_preproc (file_get_contents("http://www.lfsworld.net/pubstat/{$file}?version={$this->version}&idk={$this->idk}&ps={$this->ps}{$qryStr}&c={$this->compression}"));
    }
    function 
res_preproc ($data) {
        return (
$this->compression) ? gzinflate ($data) : $data;
    }
    function 
get_hl($racer) {
        if (
is_array($racer)) {
            foreach(
$racer as $uname) {
                
$result[$uname] = $this->get_hl($uname);
            }
        } else {
            foreach (
explode("\n"$this->make_query("&action=hl&racer={$racer}")) as $line => $data) {
                list(
$result[$line]['id_hl'], $result[$line]['track'], $result[$line]['car'], $result[$line]['split1'], $result[$line]['split2'], $result[$line]['split3'], $result[$line]['time'], $result[$line]['flags_hlaps']) = split(' '$data8);
            }
            unset(
$result[$line]);
        }
        return 
$result;
    }
    function 
get_pb($racer) {
        if (
is_array($racer)) {
            foreach(
$racer as $uname) {
                
$result[$uname] = $this->get_pb($uname);
            }
        } else {
            foreach (
explode("\n"$this->make_query("&action=pb&racer={$racer}")) as $line => $data) {
                list(
$result[$line]['track'], $result[$line]['car'], $result[$line]['time'], $result[$line]['lapcount']) = split(' '$data4);
            }
            unset(
$result[$line]);
        }
        return 
$result;
    }
    function 
get_ch($track$car$control null) {
        if (
is_array($track) || is_array($car)) {
            if (
is_array($track) && is_array($car)) {
                foreach(
$track as $tname) {
                    foreach (
$car as $cname) {
                        
$result[$tname][$cname] = $this->get_ch($tname$cname$control);
                    }
                }
            } else if (
is_array($track)) {
                foreach(
$track as $tname) {
                    
$result[$tname] = $this->get_ch($tname$cname$control);
                }
            } else if (
is_array($car)) {
                foreach (
$car as $cname) {
                    
$result[$cname] = $this->get_ch($tname$cname$control);
                }
            }
        } else {
            foreach (
explode("\n"$this->make_query("&action=ch&track={$track}&car={$car}&control={$control}")) as $line => $data) {
                list(
$result[$line]['split1'], $result[$line]['split2'], $result[$line]['split3'], $result[$line]['time'], $result[$line]['flags_hlaps'], $result[$line]['racername']) = split(' '$data6);
            }
            unset(
$result[$line]);
        }
        return 
$result;
    }
    function 
get_wr() {
        foreach (
explode("\n"$this->make_query("&action=wr")) as $line => $data) {
            list(
$result[$line]['id_wr'], $result[$line]['track'], $result[$line]['car'], $result[$line]['split1'], $result[$line]['split2'], $result[$line]['split3'], $result[$line]['time'], $result[$line]['flags_hlaps'], $result[$line]['racername']) = split(' '$data9);
        }
        unset(
$result[$line]);
        return 
$result;
    }
    function 
get_pst($racer) {
        if (
is_array($racer)) {
            foreach(
$racer as $uname) {
                
$result[$uname] = $this->get_pst($uname);
            }
        } else {
            list(
$result['distance'], $result['fuel'], $result['laps'], $result['hosts'], $result['wins'], $result['second'], $result['third'], $result['finished'], $result['quals'], $result['pole'], $result['credits'], $result['drags'], $result['drag'], $result['status'], $result['hostname'], $result['time'], $result['track'], $result['car']) = explode("\n"$this->make_query("&action=pst&racer={$racer}"));
        }
        return 
$result;
    }
    function 
get_hosts() {
        
$string $this->make_query("&action=hosts");
        for (
$pointer 0$i 0$pointer <= strlen($string); $i++) {
            
$NumberOfRacers = @unpack("c"substr($string$pointer 521));
            
$NumberOfRacers $NumberOfRacers[1];
            
$NumberOfRacersLen $NumberOfRacers 24;
            
$PointerPast $NumberOfRacersLen 53;
            
$result[$i] = array();
            if ((
$result[$i] = @unpack("a32hostname/A4tmlt/a4tcrm/icars/irules/claps/cqual/cspare1/cspare2/cnrofracers/a{$NumberOfRacersLen}racernames"substr($string$pointer$PointerPast)))) {
                
$result[$i]['racernames'] = preg_split("/\\0/"$result[$i]['racernames'], -1PREG_SPLIT_NO_EMPTY);
                
$result[$i]['tmlt'] = unpack("ctype/cmain/a1letter/ctestId"$result[$i]['tmlt']);
                
$result[$i]['tcrm'] = unpack("ctrack/cconfig/creversed/cmax"$result[$i]['tcrm']);
            }
            else
                unset(
$result[$i]);
            
$pointer += $PointerPast;
        }
        return 
$result;
    }
    function 
get_progress($host) {
        
$string $this->make_query("&host={$host}"'hostprogress.php');
        list(
$null$string) = explode("\n"$string);
        return 
json_decode($stringtrue);
    }
    function 
get_teams() {
        
$string $this->make_query("&action=teams");
        for (
$pointer 0$i 0$pointer <= strlen($string); $i++) {
            
$infoLen = @unpack("S"substr($string$pointer 2982));
            
$infoLen $infoLen[1];
            
$nrMembers = @unpack("S"substr($string$pointer 300 $infoLen2));
            
$nrMembers $nrMembers[1] * 24;
            
$PointerPast 302 $infoLen $nrMembers;
            
$result[$i] = array();
            if ((
$result[$i] = @unpack("a128team/a6tag/a32country/a128url/Ibits/Sinfo_len/a{$infoLen}info/Snr_members/a{$nrMembers}members"substr($string$pointer$PointerPast)))) {
                
$result[$i]['members'] = preg_split("/\\0/"$result[$i]['members'], -1PREG_SPLIT_NO_EMPTY);
                
$result[$i]['info'] = urldecode($result[$i]['info']);
            }
            else
                unset(
$result[$i]);
            
$pointer += $PointerPast;
        }
        return 
$result;
    }
    function 
get_hl_log($log_filter 4$lines 150$control null$starttime 0) {
        
$string $this->make_query("&action=hl_log&log_filter={$log_filter}&lines={$lines}&control={$control}&starttime={$starttime}&format=3");
        for (
$pointer 0$i 0$pointer <= strlen($string); $i++) {
            
$result[$i] = array();
            if ((
$result[$i] = @unpack("itime/a24racer/a32country/A4tcrc/i4split/Spos/Sflags/iid_hl"substr($string$pointer88))))
                
$result[$i]['tcrc'] = unpack("ctrack/cconfig/creversed/ccar"$result[$i]['tcrc']);
            else
                unset(
$result[$i]);
            
$pointer += 88;
        }
        return 
$result;
    }
}

$LFS_Tracks = array(
    
'BL1'    => array('Blackwood''GP Track'2.1'Standard''000'),
    
'BL1R'    => array('Blackwood''GP Track'2.1'Reversed''001'),
    
'BL2'    => array('Blackwood''Rally Cross'1.2'Standard''010'),
    
'BL2R'    => array('Blackwood''Rally Cross'1.2'Reversed''011'),
    
'BL3'    => array('Blackwood''Car Park'0.2'Arena''020'),
    
'SO1'    => array('South City''Classic'1.3'Standard''100'),
    
'SO1R'    => array('South City''Classic'1.3'Reversed''101'),
    
'SO2'    => array('South City''Sprint Track 1'1.3'Standard''110'),
    
'SO2R'    => array('South City''Sprint Track 1'1.3'Reversed''111'),
    
'SO3'    => array('South City''Sprint Track 2'0.8'Standard''120'),
    
'SO3R'    => array('South City''Sprint Track 2'0.8'Reversed''121'),
    
'SO4'    => array('South City''Long'2.5'Standard''130'),
    
'SO4R'    => array('South City''Long'2.5'Reversed''131'),
    
'SO5'    => array('South City''Town Course '2.0'Standard''140'),
    
'SO5R'    => array('South City''Town Course'2.0'Reversed''141'),
    
'FE1'    => array('Fern Bay''Club'1.0'Standard''200'),
    
'FE1R'    => array('Fern Bay''Club'1.0'Reversed''201'),
    
'FE2'    => array('Fern Bay''Green Track'1.9'Standard''210'),
    
'FE2R'    => array('Fern Bay''Green Track'1.9'Reversed''211'),
    
'FE3'    => array('Fern Bay''Gold Track'2.2'Standard''220'),
    
'FE3R'    => array('Fern Bay''Gold Track'2.2'Reversed''221'),
    
'FE4'    => array('Fern Bay''Black Track'4.1'Standard''230'),
    
'FE4R'    => array('Fern Bay''Black Track'4.1'Reversed''231'),
    
'FE5'    => array('Fern Bay''Rally Cross'1.3'Standard''240'),
    
'FE5R'    => array('Fern Bay''Rally Cross'1.3'Reversed''241'),
    
'FE6'    => array('Fern Bay''RallyX Green'0.5'Standard''250'),
    
'FE6R'    => array('Fern Bay''RallyX Green'0.5'Reversed''251'),
    
'AU1'    => array('Autocross''Autocross'0.3'Arena''300'),
    
'AU2'    => array('Autocross''Slod Pad'0.1'Arena''310'),
    
'AU3'    => array('Autocross''Drag Strip'0.7'Single Stage''320'),
    
'AU4'    => array('Autocross''8 Lane Drag'0.7'Single Stage''330'),
    
'KY1'    => array('Kyoto Ring''Oval'1.9'Standard''400'),
    
'KY1R'    => array('Kyoto Ring''Oval'1.9'Reversed''401'),
    
'KY2'    => array('Kyoto Ring''National'3.2'Standard''410'),
    
'KY2R'    => array('Kyoto Ring''National'3.2'Reversed''411'),
    
'KY3'    => array('Kyoto Ring''GP Long'4.6'Standard''420'),
    
'KY3R'    => array('Kyoto Ring''GP Long'4.6'Reversed''421'),
    
'WE1'    => array('Westhill''International'3.2'Standard''500'),
    
'WE1R'    => array('Westhill''International'3.2'Reversed''501'),
    
'AS1'    => array('Aston''Cadet'1.2'Standard''600'),
    
'AS1R'    => array('Aston''Cadet'1.2'Reversed''601'),
    
'AS2'    => array('Aston''Club'1.9'Standard''610'),
    
'AS2R'    => array('Aston''Club'1.9'Reversed''611'),
    
'AS3'    => array('Aston''National'3.5'Standard''620'),
    
'AS3R'    => array('Aston''National'3.5'Reversed''621'),
    
'AS4'    => array('Aston''Historic'5.0'Standard''630'),
    
'AS4R'    => array('Aston''Historic'5.0'Reversed''631'),
    
'AS5'    => array('Aston''Grand Prix'5.5'Standard''640'),
    
'AS5R'    => array('Aston''Grand Prix'5.5'Reversed''641'),
    
'AS6'    => array('Aston''Grand Touring'5.0'Standard''650'),
    
'AS6R'    => array('Aston''Grand Touring'5.0'Reversed''651'),
    
'AS7'    => array('Aston''North'3.2'Standard''660'),
    
'AS7R'    => array('Aston''North'3.2'Reversed''661')
);

$LFSW_Tracks = array(
    
'000' => 'BL1',
    
'001' => 'BL1R',
    
'010' => 'BL2',
    
'011' => 'BL2R',
    
'020' => 'BL3',
    
'100' => 'SO1',
    
'101' => 'SO1R',
    
'110' => 'SO2',
    
'111' => 'SO2R',
    
'120' => 'SO3',
    
'121' => 'SO3R',
    
'130' => 'SO4',
    
'131' => 'SO4R',
    
'140' => 'SO5',
    
'141' => 'SO5R',
    
'200' => 'FE1',
    
'201' => 'FE1R',
    
'210' => 'FE2',
    
'211' => 'FE2R',
    
'220' => 'FE3',
    
'221' => 'FE3R',
    
'230' => 'FE4',
    
'231' => 'FE4R',
    
'240' => 'FE5',
    
'241' => 'FE5R',
    
'250' => 'FE6',
    
'251' => 'FE6R',
    
'300' => 'AU1',
    
'310' => 'AU2',
    
'320' => 'AU3',
    
'330' => 'AU4',
    
'400' => 'KY1',
    
'401' => 'KY1R',
    
'410' => 'KY2',
    
'411' => 'KY2R',
    
'420' => 'KY3',
    
'421' => 'KY3R',
    
'500' => 'WE1',
    
'501' => 'WE1R',
    
'600' => 'AS1',
    
'601' => 'AS1R',
    
'610' => 'AS2',
    
'611' => 'AS2R',
    
'620' => 'AS3',
    
'621' => 'AS3R',
    
'630' => 'AS4',
    
'631' => 'AS4R',
    
'640' => 'AS5',
    
'641' => 'AS5R',
    
'650' => 'AS6',
    
'651' => 'AS6R',
    
'660' => 'AS7',
    
'661' => 'AS7R'
);

$LFS_Cars = array(
    
'UF1' => 'UF 1000',
    
'XFG' => 'XF GTI',
    
'XRG' => 'XR GT',
    
'LX4' => 'LX4',
    
'RB4' => 'RB4 GT',
    
'FXO' => 'FXO TURBO',
    
'XRT' => 'XR GT TURBO',
    
'LX6' => 'LX6',
    
'RAC' => 'RA',
    
'FZ5' => 'FZ50',
    
'UFR' => 'UF GTR',
    
'XFR' => 'XF GTR',
    
'MRT' => 'MTR5',
    
'FOX' => 'FORMULA XR',
    
'FO8' => 'FORMULA V8',
    
'BF1' => 'BMW SAUBER',
    
'FXR' => 'FXO GTR',
    
'XRR' => 'XR GTR',
    
'FZR' => 'FZ50 GTR'
);

$LFS_Cars_Classes = array(
    
'ALL' => array('UF1','XFG','XRG','LX6','RB4','FX0','XRT','LX6','RAC','FZ5','UFR','XFR','MRT','FOX','FO8','BF1','FXR','XRR','FZR'),
    
'STD' => array('UF1','XFG','XRG'),
    
'TBO' => array('UF1','XFG','XRG','LX4','RB4','FXO','XRT'),
    
'LRF' => array('UF1','XFG','XRG','LX4','RB4','FXO','XRT','LX6','RAC','FZ5'),
    
'FWD' => array('UF1','XFG','FXO','UFR','XFR'),
    
'GTR' => array('FXR','XRR','FXR'),
    
'S-S' => array('MRT','FOX','FO8','BF1')
);

?>

Attached files
LFSWorldSDK.zip - 3.1 KB - 742 views
-
using gethosts (SenatorChris) DELETED by SenatorChris : solved
-
Cars (SenatorChris) DELETED by SenatorChris : decbin did it ;)
Would you be as so kind as to move this into the new forum please (insert moderator name here).
doing ..
Thank You!
Hi,

You miss the new track in SDK
SO6 (Chicane Route) : 150 & 151 for the reverse.

Loco
Quote from loconstant :Hi,

You miss the new track in SDK
SO6 (Chicane Route) : 150 & 151 for the reverse.

Loco

Yeah, I have the new version called 1.7Y just not released. So here it is now.
Attached files
LFSWorldSDK_v1.7Y.zip - 3.2 KB - 731 views
Thanks, I do not post really often here, but I really like this piece of code , and pubstat

<?php 
    
'FXR' => 'FXO GTR',
    
'XRR' => 'XR GTR',
    
'FZR' => 'FZ50 GTR'
    'FBM' 
=> 'FORMULA BMW',
);
?>

There is a small mistake in the code, just after GTR & BMW
corrected the error at in the LFS_Cars array.


<?php 
php

$SDK 
= new LFSWorldSDK('idk'true);

/*
** Live For Speed World SDK, easily find what you need from the World of Live For Speed.
**
** @package   LFSWorldSDK
** @since     2007-10-27 06:30
** @author    Mark 'Dygear' Tomlin
** @coauthor  Mikael 'filur' Forsberg.
** @coauthor  Victor van Vlaardingen.
** @coauthor  Jeff 'glyphon' DeLamater.
** @license   MIT License (http://opensource.org/licenses/mit-license.php)
** @copyright Copyright (C) 2006,
**            Mark 'Dygear' Tomlin, Mikael 'filur' Forsberg,
**            Victor van Vlaardingen & Jeff 'glyphon' DeLamater.
** @version   1.7Y
*/

class LFSWorldSDK {
    function 
LFSWorldSDK($idk$ps false) {
        
$this->ps $ps;
        
$this->idk $idk;
        
$this->version 1.3;
        
$this->compression = (function_exists ('gzinflate')) ? 0;
    }
    function 
make_query($qryStr$file 'get_stat2.php') {
        return 
$this->res_preproc (file_get_contents("http://www.lfsworld.net/pubstat/{$file}?version={$this->version}&idk={$this->idk}&ps={$this->ps}{$qryStr}&c={$this->compression}"));
    }
    function 
res_preproc ($data) {
        return (
$this->compression) ? gzinflate ($data) : $data;
    }
    function 
get_hl($racer) {
        if (
is_array($racer)) {
            foreach(
$racer as $uname) {
                
$result[$uname] = $this->get_hl($uname);
            }
        } else {
            foreach (
explode("\n"$this->make_query("&action=hl&racer={$racer}")) as $line => $data) {
                list(
$result[$line]['id_hl'], $result[$line]['track'], $result[$line]['car'], $result[$line]['split1'], $result[$line]['split2'], $result[$line]['split3'], $result[$line]['time'], $result[$line]['flags_hlaps']) = split(' '$data8);
            }
            unset(
$result[$line]);
        }
        return 
$result;
    }
    function 
get_pb($racer) {
        if (
is_array($racer)) {
            foreach(
$racer as $uname) {
                
$result[$uname] = $this->get_pb($uname);
            }
        } else {
            foreach (
explode("\n"$this->make_query("&action=pb&racer={$racer}")) as $line => $data) {
                list(
$result[$line]['track'], $result[$line]['car'], $result[$line]['time'], $result[$line]['lapcount']) = split(' '$data4);
            }
            unset(
$result[$line]);
        }
        return 
$result;
    }
    function 
get_ch($track$car$control null) {
        if (
is_array($track) || is_array($car)) {
            if (
is_array($track) && is_array($car)) {
                foreach(
$track as $tname) {
                    foreach (
$car as $cname) {
                        
$result[$tname][$cname] = $this->get_ch($tname$cname$control);
                    }
                }
            } else if (
is_array($track)) {
                foreach(
$track as $tname) {
                    
$result[$tname] = $this->get_ch($tname$cname$control);
                }
            } else if (
is_array($car)) {
                foreach (
$car as $cname) {
                    
$result[$cname] = $this->get_ch($tname$cname$control);
                }
            }
        } else {
            foreach (
explode("\n"$this->make_query("&action=ch&track={$track}&car={$car}&control={$control}")) as $line => $data) {
                list(
$result[$line]['split1'], $result[$line]['split2'], $result[$line]['split3'], $result[$line]['time'], $result[$line]['flags_hlaps'], $result[$line]['racername']) = split(' '$data6);
            }
            unset(
$result[$line]);
        }
        return 
$result;
    }
    function 
get_wr() {
        foreach (
explode("\n"$this->make_query("&action=wr")) as $line => $data) {
            list(
$result[$line]['id_wr'], $result[$line]['track'], $result[$line]['car'], $result[$line]['split1'], $result[$line]['split2'], $result[$line]['split3'], $result[$line]['time'], $result[$line]['flags_hlaps'], $result[$line]['racername']) = split(' '$data9);
        }
        unset(
$result[$line]);
        return 
$result;
    }
    function 
get_pst($racer) {
        if (
is_array($racer)) {
            foreach(
$racer as $uname) {
                
$result[$uname] = $this->get_pst($uname);
            }
        } else {
            list(
$result['distance'], $result['fuel'], $result['laps'], $result['hosts'], $result['wins'], $result['second'], $result['third'], $result['finished'], $result['quals'], $result['pole'], $result['credits'], $result['drags'], $result['drag'], $result['status'], $result['hostname'], $result['time'], $result['track'], $result['car']) = explode("\n"$this->make_query("&action=pst&racer={$racer}"));
        }
        return 
$result;
    }
    function 
get_hosts() {
        
$string $this->make_query("&action=hosts");
        for (
$pointer 0$i 0$pointer <= strlen($string); $i++) {
            
$NumberOfRacers = @unpack("c"substr($string$pointer 521));
            
$NumberOfRacers $NumberOfRacers[1];
            
$NumberOfRacersLen $NumberOfRacers 24;
            
$PointerPast $NumberOfRacersLen 53;
            
$result[$i] = array();
            if ((
$result[$i] = @unpack("a32hostname/A4tmlt/a4tcrm/icars/irules/claps/cqual/cspare1/cspare2/cnrofracers/a{$NumberOfRacersLen}racernames"substr($string$pointer$PointerPast)))) {
                
$result[$i]['racernames'] = preg_split("/\\0/"$result[$i]['racernames'], -1PREG_SPLIT_NO_EMPTY);
                
$result[$i]['tmlt'] = unpack("ctype/cmain/a1letter/ctestId"$result[$i]['tmlt']);
                
$result[$i]['tcrm'] = unpack("ctrack/cconfig/creversed/cmax"$result[$i]['tcrm']);
            }
            else
                unset(
$result[$i]);
            
$pointer += $PointerPast;
        }
        return 
$result;
    }
    function 
get_progress($host) {
        
$string $this->make_query("&host={$host}"'hostprogress.php');
        list(
$null$string) = explode("\n"$string);
        return 
json_decode($stringtrue);
    }
    function 
get_teams() {
        
$string $this->make_query("&action=teams");
        for (
$pointer 0$i 0$pointer <= strlen($string); $i++) {
            
$infoLen = @unpack("S"substr($string$pointer 2982));
            
$infoLen $infoLen[1];
            
$nrMembers = @unpack("S"substr($string$pointer 300 $infoLen2));
            
$nrMembers $nrMembers[1] * 24;
            
$PointerPast 302 $infoLen $nrMembers;
            
$result[$i] = array();
            if ((
$result[$i] = @unpack("a128team/a6tag/a32country/a128url/Ibits/Sinfo_len/a{$infoLen}info/Snr_members/a{$nrMembers}members"substr($string$pointer$PointerPast)))) {
                
$result[$i]['members'] = preg_split("/\\0/"$result[$i]['members'], -1PREG_SPLIT_NO_EMPTY);
                
$result[$i]['info'] = urldecode($result[$i]['info']);
            }
            else
                unset(
$result[$i]);
            
$pointer += $PointerPast;
        }
        return 
$result;
    }
    function 
get_hl_log($log_filter 4$lines 150$control null$starttime 0) {
        
$string $this->make_query("&action=hl_log&log_filter={$log_filter}&lines={$lines}&control={$control}&starttime={$starttime}&format=3");
        for (
$pointer 0$i 0$pointer <= strlen($string); $i++) {
            
$result[$i] = array();
            if ((
$result[$i] = @unpack("itime/a24racer/a32country/A4tcrc/i4split/Spos/Sflags/iid_hl"substr($string$pointer88))))
                
$result[$i]['tcrc'] = unpack("ctrack/cconfig/creversed/ccar"$result[$i]['tcrc']);
            else
                unset(
$result[$i]);
            
$pointer += 88;
        }
        return 
$result;
    }
}

$LFS_Tracks = array(
    
'BL1'    => array('Blackwood''GP Track'2.1'Standard''000'),
    
'BL1R'    => array('Blackwood''GP Track'2.1'Reversed''001'),
    
'BL2'    => array('Blackwood''Rally Cross'1.2'Standard''010'),
    
'BL2R'    => array('Blackwood''Rally Cross'1.2'Reversed''011'),
    
'BL3'    => array('Blackwood''Car Park'0.2'Arena''020'),
    
'SO1'    => array('South City''Classic'1.3'Standard''100'),
    
'SO1R'    => array('South City''Classic'1.3'Reversed''101'),
    
'SO2'    => array('South City''Sprint Track 1'1.3'Standard''110'),
    
'SO2R'    => array('South City''Sprint Track 1'1.3'Reversed''111'),
    
'SO3'    => array('South City''Sprint Track 2'0.8'Standard''120'),
    
'SO3R'    => array('South City''Sprint Track 2'0.8'Reversed''121'),
    
'SO4'    => array('South City''Long'2.5'Standard''130'),
    
'SO4R'    => array('South City''Long'2.5'Reversed''131'),
    
'SO5'    => array('South City''Town Course '2.0'Standard''140'),
    
'SO5R'    => array('South City''Town Course'2.0'Reversed''141'),
    
'SO6'    => array('South City''Chicane Route'1.8'Standard''150'),
    
'SO6R'    => array('South City''Chicane Route'1.8'Reversed''151'),
    
'FE1'    => array('Fern Bay''Club'1.0'Standard''200'),
    
'FE1R'    => array('Fern Bay''Club'1.0'Reversed''201'),
    
'FE2'    => array('Fern Bay''Green Track'1.9'Standard''210'),
    
'FE2R'    => array('Fern Bay''Green Track'1.9'Reversed''211'),
    
'FE3'    => array('Fern Bay''Gold Track'2.2'Standard''220'),
    
'FE3R'    => array('Fern Bay''Gold Track'2.2'Reversed''221'),
    
'FE4'    => array('Fern Bay''Black Track'4.1'Standard''230'),
    
'FE4R'    => array('Fern Bay''Black Track'4.1'Reversed''231'),
    
'FE5'    => array('Fern Bay''Rally Cross'1.3'Standard''240'),
    
'FE5R'    => array('Fern Bay''Rally Cross'1.3'Reversed''241'),
    
'FE6'    => array('Fern Bay''RallyX Green'0.5'Standard''250'),
    
'FE6R'    => array('Fern Bay''RallyX Green'0.5'Reversed''251'),
    
'AU1'    => array('Autocross''Autocross'0.3'Arena''300'),
    
'AU2'    => array('Autocross''Slod Pad'0.1'Arena''310'),
    
'AU3'    => array('Autocross''Drag Strip'0.7'Single Stage''320'),
    
'AU4'    => array('Autocross''8 Lane Drag'0.7'Single Stage''330'),
    
'KY1'    => array('Kyoto Ring''Oval'1.9'Standard''400'),
    
'KY1R'    => array('Kyoto Ring''Oval'1.9'Reversed''401'),
    
'KY2'    => array('Kyoto Ring''National'3.2'Standard''410'),
    
'KY2R'    => array('Kyoto Ring''National'3.2'Reversed''411'),
    
'KY3'    => array('Kyoto Ring''GP Long'4.6'Standard''420'),
    
'KY3R'    => array('Kyoto Ring''GP Long'4.6'Reversed''421'),
    
'WE1'    => array('Westhill''International'3.2'Standard''500'),
    
'WE1R'    => array('Westhill''International'3.2'Reversed''501'),
    
'AS1'    => array('Aston''Cadet'1.2'Standard''600'),
    
'AS1R'    => array('Aston''Cadet'1.2'Reversed''601'),
    
'AS2'    => array('Aston''Club'1.9'Standard''610'),
    
'AS2R'    => array('Aston''Club'1.9'Reversed''611'),
    
'AS3'    => array('Aston''National'3.5'Standard''620'),
    
'AS3R'    => array('Aston''National'3.5'Reversed''621'),
    
'AS4'    => array('Aston''Historic'5.0'Standard''630'),
    
'AS4R'    => array('Aston''Historic'5.0'Reversed''631'),
    
'AS5'    => array('Aston''Grand Prix'5.5'Standard''640'),
    
'AS5R'    => array('Aston''Grand Prix'5.5'Reversed''641'),
    
'AS6'    => array('Aston''Grand Touring'5.0'Standard''650'),
    
'AS6R'    => array('Aston''Grand Touring'5.0'Reversed''651'),
    
'AS7'    => array('Aston''North'3.2'Standard''660'),
    
'AS7R'    => array('Aston''North'3.2'Reversed''661')
);

$LFSW_Tracks = array(
    
'000' => 'BL1',
    
'001' => 'BL1R',
    
'010' => 'BL2',
    
'011' => 'BL2R',
    
'020' => 'BL3',
    
'100' => 'SO1',
    
'101' => 'SO1R',
    
'110' => 'SO2',
    
'111' => 'SO2R',
    
'120' => 'SO3',
    
'121' => 'SO3R',
    
'130' => 'SO4',
    
'131' => 'SO4R',
    
'140' => 'SO5',
    
'141' => 'SO5R',
    
'150' => 'SO6',
    
'151' => 'SO6R',
    
'200' => 'FE1',
    
'201' => 'FE1R',
    
'210' => 'FE2',
    
'211' => 'FE2R',
    
'220' => 'FE3',
    
'221' => 'FE3R',
    
'230' => 'FE4',
    
'231' => 'FE4R',
    
'240' => 'FE5',
    
'241' => 'FE5R',
    
'250' => 'FE6',
    
'251' => 'FE6R',
    
'300' => 'AU1',
    
'310' => 'AU2',
    
'320' => 'AU3',
    
'330' => 'AU4',
    
'400' => 'KY1',
    
'401' => 'KY1R',
    
'410' => 'KY2',
    
'411' => 'KY2R',
    
'420' => 'KY3',
    
'421' => 'KY3R',
    
'500' => 'WE1',
    
'501' => 'WE1R',
    
'600' => 'AS1',
    
'601' => 'AS1R',
    
'610' => 'AS2',
    
'611' => 'AS2R',
    
'620' => 'AS3',
    
'621' => 'AS3R',
    
'630' => 'AS4',
    
'631' => 'AS4R',
    
'640' => 'AS5',
    
'641' => 'AS5R',
    
'650' => 'AS6',
    
'651' => 'AS6R',
    
'660' => 'AS7',
    
'661' => 'AS7R'
);

$LFS_Cars = array(
    
'UF1' => 'UF 1000',
    
'XFG' => 'XF GTI',
    
'XRG' => 'XR GT',
    
'LX4' => 'LX4',
    
'RB4' => 'RB4 GT',
    
'FXO' => 'FXO TURBO',
    
'XRT' => 'XR GT TURBO',
    
'LX6' => 'LX6',
    
'RAC' => 'RA',
    
'FZ5' => 'FZ50',
    
'UFR' => 'UF GTR',
    
'XFR' => 'XF GTR',
    
'MRT' => 'MRT5',
    
'FOX' => 'FORMULA XR',
    
'FO8' => 'FORMULA V8',
    
'BF1' => 'BMW SAUBER',
    
'FXR' => 'FXO GTR',
    
'XRR' => 'XR GTR',
    
'FZR' => 'FZ50 GTR',
    
'FBM' => 'FORMULA BMW'
);

$LFS_Cars_Classes = array(
    
'ALL' => array('UF1','XFG','XRG','LX6','RB4','FX0','XRT','LX6','RAC','FZ5','UFR','XFR','MRT','FOX','FO8','BF1','FXR','XRR','FZR','FBM'),
    
'STD' => array('UF1','XFG','XRG'),
    
'TBO' => array('UF1','XFG','XRG','LX4','RB4','FXO','XRT'),
    
'LRF' => array('UF1','XFG','XRG','LX4','RB4','FXO','XRT','LX6','RAC','FZ5'),
    
'FWD' => array('UF1','XFG','FXO','UFR','XFR'),
    
'GTR' => array('FXR','XRR','FXR'),
    
'S-S' => array('MRT','FOX','FO8','BF1','FBM')
);


?>

Attached files
LFSWorldSDK_v1.7Y.zip - 3.3 KB - 611 views
Quote from loconstant :

<?php 
    
'FXR' => 'FXO GTR',
    
'XRR' => 'XR GTR',
    
'FZR' => 'FZ50 GTR'
    'FBM' 
=> 'FORMULA BMW',
);
?>

There is a small mistake in the code, just after GTR & BMW

Must remind myself to run my code before I release it.
Hi, i've been trying to use your SDK to display my team members online status & what server they're on. Now i'm not exactly very familiar with PHP, i can look at it and try to pick out bits of code that do certian things, so i got a little help from a friend that knows a little more than me, but now we're both stuck

So, this is what i have so far;

memberGreen.php

<?php 
php
// Function for converting name to Green if online
function TeamPlayerOnline ($varDisplayName$varPlayerName)
{
require_once(
"/var/www/html/lfssdk/lfsworldsdk.php");
$SDK2 = new LFSWorldSDK('IDKREMOVED');
$varRacerInfo $SDK2->get_pst($varPlayerName);
$varPlayerServer $varRacerInfo['hostname'];

    switch (
$varRacerInfo['online']) {
    case 
0:
        echo 
$varDisplayName;
        break;
    case 
1:
        echo 
"<span title='" $varPlayerServer "'><strong><font color='#009900'>" $varDisplayName 
"</font></strong></span>";
        break;
    case 
2:
            echo 
"<span title='" $varPlayerServer "'><strong><font color='#009900'>" $varDisplayName 
"</font></strong></span>";
        break;
    case 
3:
            echo 
"<span title='" $varPlayerServer "'><strong><font color='#009900'>" $varDisplayName 
"</font></strong></span>";
        break;
    }
}

?>

And to use this on the web i use the following;


<?php 
include("/var/www/html/lfssdk/memberGreen.php");
TeamPlayerOnline("audimasta""audimasta");
TeamPlayerOnline("GFresh""GFresh");
?>

The problem with this is, that it displays both me and audimasta on the same line (I have tried numerous linebreak codes but i keep getting parse errors), and also it only works for one online member at a time. ie, if i'm online my name go's green, but if audimasta comes online while i am still online, his name doesn't go green.


There's a fair chance i have done nothing right here, but i tried my hardest to do it without asking for help, i've been trying for weeks . So could some kind soul please point me in the right direction please.

Thanks.
in the memberGreen file, you were using an invalid array association (at least in the lastest version of the SDK) for checking if a player was online. if this version doesn't work for you, change 'status' back to 'online'.

<?php 
switch ($varRacerInfo['status']) {
?>

and the reason why you said that one name would work, and the 2nd name wouldn't is because there is a 5 second limitation between calls to the pubstats server if you aren't paying for premium status, so the immediate 2nd call was throwing an error, which made the SDK return that the user was offline. put in a 5 second delay, and it works as it should. oh, and put in the "<br />" so the names appear on seperate lines.

memberGreen.php

<?php 
php
// Function for converting name to Green if online
function TeamPlayerOnline ($varDisplayName$varPlayerName)
{
require_once(
"lfsworldsdk.php");

$SDK = new LFSWorldSDK(IDKEYREMOVED);
$varRacerInfo $SDK->get_pst(urlencode($varPlayerName));
$varPlayerServer $varRacerInfo['hostname'];

switch (
$varRacerInfo['status']) {
    case 
0:
        echo 
$varDisplayName;
        break;
    case 
1:
        echo 
"<span title='" $varPlayerServer "'><strong><font color='#009900'>" $varDisplayName 
"</font></strong></span>";
        break;
    case 
2:
            echo 
"<span title='" $varPlayerServer "'><strong><font color='#009900'>" $varDisplayName 
"</font></strong></span>";
        break;
    case 
3:
            echo 
"<span title='" $varPlayerServer "'><strong><font color='#009900'>" $varDisplayName 
"</font></strong></span>";
        break;
    }
}

?>


<?php 
include("memberGreen.php");
TeamPlayerOnline("audimasta""audimasta");
echo 
"\n\r<br />\n\r";
sleep(5);
TeamPlayerOnline("GFresh""GFresh");
?>

Ok thanks a lot for your help, i will try that later after work.
However i am actually using the premium pubstats so could there be another reason that part wasn't working correctly?.
to use the premium pubstats, you have to specify that. if you don't, it defaults to the free setting


<?php 
$SDK 
= new LFSWorldSDK(IDKEYREMOVEDTrue);
?>

Quote from glyphon :to use the premium pubstats, you have to specify that. if you don't, it defaults to the free setting


<?php 
$SDK 
= new LFSWorldSDK(IDKEYREMOVEDTrue);
?>


Excellent! that (plus your other changes) got it working Thankyou very much.

One other thing i would like to know, is there a way that i could display a member name in any way i like, but have it retrieve the status of a specific username?

ie, Tims LFS username name is 'Astroboy', but on the site i'd like it to say 'Eagle'
oh, i forgot to mention, if you are using premium pubstats, you can remove the sleep(5) line, if you haven't already.

and your function already supports what you want.

<?php 
//TeamPlayerOnline("Display Name", "LFS Player Name")
TeamPlayerOnline("Eagle""Astroboy");
?>


FGED GREDG RDFGDR GSFDG