Page 7 of 10 FirstFirst ... 56789 ... LastLast
Results 121 to 140 of 186
  1. #121
    Member
    Join Date
    2011-11-08
    Location
    NRW
    Posts
    112
    BFBC2 PC
    Tony_GER
    BF3 PC
    xXxT0NYxXx

    AW: Re: API PHP example with table output

    This is your script:

    http://www.schulte-solingen.de/za/bf3/robgunn.php

    dutchtimnl1 ----> I see him ;-)

  2. #122
    New User
    Join Date
    2011-12-11
    Posts
    23
    BFBC2 PS3
    robgunns
    BF3 PS3
    robgunns

    Re: API PHP example with table output

    i still dont see him on my site ?

  3. #123
    Member
    Join Date
    2011-11-08
    Location
    NRW
    Posts
    112
    BFBC2 PC
    Tony_GER
    BF3 PC
    xXxT0NYxXx

    AW: Re: API PHP example with table output

    hmm, iframe hight to short?
    Copy your code in a separate test.php. Load test.php on your webspace and see again. in your code is no error.

  4. #124
    New User
    Join Date
    2011-12-11
    Posts
    23
    BFBC2 PS3
    robgunns
    BF3 PS3
    robgunns

    Re: API PHP example with table output

    a quick test not worried about images etc umm weird maybe its because im using website iframe.i have increased the iframe height
    Last edited by robgunns; 2012-03-13 at 09:54.

  5. #125
    New User
    Join Date
    2011-12-11
    Posts
    23
    BFBC2 PS3
    robgunns
    BF3 PS3
    robgunns

    Re: API PHP example with table output

    how and where would i code the iframe in plz....as im using website settings for the iframe.

  6. #126
    Member
    Join Date
    2011-11-08
    Location
    NRW
    Posts
    112
    BFBC2 PC
    Tony_GER
    BF3 PC
    xXxT0NYxXx

    AW: Re: API PHP example with table output

    Iframe descriptions:
    HTML Code:
    <iframe src="../yourstatssite" width="90%" height="90%" name="what ever">

  7. #127
    PHP Developer
    Join Date
    2011-11-21
    Location
    Amsterdam, The Netherlands
    Posts
    279
    BF3 PC
    Grezvany13
    Gamer IDs

    XFIRE ID: Grezvany13 Steam ID: Grezvany13

    Re: API PHP example with table output

    Are you sure it isn't a (local) caching problem by your CMS?

    Or a wrong counter somewhere; because at both lists I see 10 people (instead of 11). Inside the frame I'm missing "dutchtimnl1", although at your test page I'm missing "richie210481"...
    Member of [DD] DoubleDutchClan - Largest Dutch Multi Gaming Community Since 2007



    Proud developer of: BF3Stats API Class - A simple PHP Framework for your own projects

  8. #128
    New User
    Join Date
    2011-12-11
    Posts
    23
    BFBC2 PS3
    robgunns
    BF3 PS3
    robgunns

    Re: API PHP example with table output

    Confused about this......going to have to scrap my module i think and run this script on webspace

  9. #129
    New User
    Join Date
    2011-12-11
    Posts
    23
    BFBC2 PS3
    robgunns
    BF3 PS3
    robgunns

    Re: AW: Re: API PHP example with table output

    Same code different player list with only 10.....im going to look into this later i think....thanks tony+Grezvany a great help and very usefull help and tips cheers rob

  10. #130
    Member
    Join Date
    2011-11-08
    Location
    NRW
    Posts
    112
    BFBC2 PC
    Tony_GER
    BF3 PC
    xXxT0NYxXx

    AW: Re: AW: Re: API PHP example with table output

    btw

    this is my leaderboard, klick on some Points and see more stats ;-)
    http://www.zockanstalt.de/index.php?...per&Itemid=313

  11. #131
    New User
    Join Date
    2011-12-11
    Posts
    23
    BFBC2 PS3
    robgunns
    BF3 PS3
    robgunns

    Re: API PHP example with table output

    Wow tony anychance u might release this for us noobs to use if or when finished.Awesome job.

  12. #132
    New User
    Join Date
    2011-12-11
    Posts
    23
    BFBC2 PS3
    robgunns
    BF3 PS3
    robgunns

    Re: API PHP example with table output

    dogtags display ribbons and medals ?

  13. #133
    Member
    Join Date
    2011-11-08
    Location
    NRW
    Posts
    112
    BFBC2 PC
    Tony_GER
    BF3 PC
    xXxT0NYxXx

    AW: Re: API PHP example with table output

    Kits are 25%, when i have the Kits complete i post a link to download.

    I have a problem with Point per minute and score per minute. I dont understand calculate this...

  14. #134
    Member
    Join Date
    2011-11-08
    Location
    NRW
    Posts
    112
    BFBC2 PC
    Tony_GER
    BF3 PC
    xXxT0NYxXx

    AW: Re: API PHP example with table output

    Quote Originally Posted by robgunns View Post
    dogtags display ribbons and medals ?
    Jep, you can change this self ;-)

  15. #135
    New User
    Join Date
    2012-02-11
    Posts
    2

    Re: API PHP example with table output

    My example with jquery http://as.hostpro.lt/html/bf3stats/

  16. #136
    New User
    Join Date
    2012-04-14
    Posts
    5

    Re: API PHP example with table output

    Hi,

    im a Code-Noob but i hacked around like a fool in the examples given in this thread. put it in an iframe and after all i got this leaderboard.
    http://deepstahl.enjin.com/leaderboard

    Now, after 2000?! hours trial+error gaming i just really wanted to know how to add "Knife-Kills" to the main table. Yes, i know you'll be laughing but i am not able to find the right key to my brain to get this working.

    Q:
    Can someone help me adding "KNIFE-Kills" to my leaderboard ?
    What code and where do i have to put it in ?

    Thanks guys, eko



    This is the php-code im using:
    Code:
     <link rel="stylesheet" type="text/css" href="./css/bf3.css">
    <script type="text/javascript" language="JavaScript">
    <!-- Copyright 2006,2007 Bontrager Connection, LLC
    // http://bontragerconnection.com/ and http://www.willmaster.com/
    // Version: July 28, 2007
    // javascript for floating table at mouse position
    var cX = 0; var cY = 0; var rX = 0; var rY = 0;
    function UpdateCursorPosition(e){ cX = e.pageX; cY = e.pageY;}
    function UpdateCursorPositionDocAll(e){ cX = event.clientX; cY = event.clientY;}
    if(document.all) { document.onmousemove = UpdateCursorPositionDocAll; }
    else { document.onmousemove = UpdateCursorPosition; }
    function AssignPosition(d) {
    if(self.pageYOffset) {
        rX = self.pageXOffset;
        rY = self.pageYOffset;
        }
    else if(document.documentElement && document.documentElement.scrollMiddle) {
        rX = document.documentElement.scrollLeft;
        rY = document.documentElement.scrollMiddle;
        }
    else if(document.body) {
        rX = document.body.scrollLeft;
        rY = document.body.scrollMiddle;
        }
    if(document.all) {
        cX += rX; 
        cY += rY;
        }
    d.style.left = (cX+10) + "px";
    d.style.middle = (cY+10) + "px";
    }
    function HideContent(d) {
    if(d.length < 1) { return; }
    document.getElementById(d).style.display = "none";
    }
    function ShowContent(d) {
    if(d.length < 1) { return; }
    var dd = document.getElementById(d);
    AssignPosition(dd);
    dd.style.display = "block";
    }
    function ReverseContentDisplay(d) {
    if(d.length < 1) { return; }
    var dd = document.getElementById(d);
    AssignPosition(dd);
    if(dd.style.display == "none") { dd.style.display = "block"; }
    else { dd.style.display = "none"; }
    }
    //-->
    </script>
    
    
    <?php
    
    
    $playerData = array('players' => array(), 'opt' => array());
    
    // Our list of players
    
    
    $playerData['players'][]        = 'ekomanic';
    $playerData['players'][]         = 'Blumentopp';
    $playerData['players'][]         = 'tron0071';
    $playerData['players'][]         = 'AndyGrenzen';
    $playerData['players'][]         = 'Faultierchief';
    $playerData['players'][]         = 'darkdever';
    $playerData['players'][]         = 'LtCmdr85';
    $playerData['players'][]         = 'dont4get-murdock';
    $playerData['players'][]         = 'mehdi2109';
    $playerData['players'][]         = 'DopplerWobble';
    $playerData['players'][]         = 'VY_CanisMajoris1';
    $playerData['players'][]         = 'YoShIs_ReVeNgE';
    
    
    /* In this example we want as little information to come back from the API as possible.
    ** Therefore we are calling the "clear" function, which means we need to manually enable
    ** each stat group we need. This will help keep the size of the response down, and therefore execution time.
    */
    $playerData['opt']['clear']        = true;
    
    // Data we want to be returned
    $playerdata['opt']['all']      = true;
    $playerData['opt']['global']    = true;
    $playerData['opt']['nextranks']    = true;
    $playerData['opt']['rank']        = true;
    $playerData['opt']['kits']        = true;
    $playerData['opt']['scores']    = true;
    $playerData['opt']['imgInfo']    = true;
    $playerData['opt']['awards']    = true;
    $playerdata['opt']['awardsInfo']  = true;
    $playerdata['opt']['awardsAwarded']      = true;
    $playerData['opt']['ribbons']    = true;
    $playerData['opt']['medals']    = true;
    $playerData['opt']['raw']    = true;
    $playerData['opt']['nozero']    = true;
    $playerData['opt']['coop']    = true;
    $playerdata['opt']['coopInfo']  = true;
    $playerdata['opt']['coopimg']      = true;
    
    
    // Convert lists to JSON ready for the curl post request
    $postData                        = array();
    $postData['players']            = json_encode($playerData['players']);
    $postData['opt']                = json_encode($playerData['opt']);
    
    // This example hardcodes "pc" players
    $c = curl_init('http://api.bf3stats.com/pc/playerlist/');
    curl_setopt($c, CURLOPT_HEADER, false);
    curl_setopt($c, CURLOPT_POST, true);
    curl_setopt($c, CURLOPT_USERAGENT, 'BF3StatsAPI/0.1');
    curl_setopt($c, CURLOPT_HTTPHEADER, array('Expect:'));
    curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($c, CURLOPT_POSTFIELDS, $postData);
    $response      = curl_exec($c);
    $statusCode    = curl_getinfo($c, CURLINFO_HTTP_CODE);
    curl_close($c);
    
    // 200 means a successful call
    if($statusCode == 200) 
    {
        // Decode JSON Data into an array we can easily parse
        $data = json_decode($response, true);
        
        // Counter for our players array
        $i = 0;
        
        // Loop through each of our players we set above and see what data we have for them
        foreach($playerData['players'] AS $player)
        {
            // Does this player exist in the returned data?
            if(isset($data['list'][$player]))
            {
                // This checks to see if the player actually has any stats yet on the site
                if($data['list'][$player]['status'] == "data")
                {
                    $stats[$i]['name']                  = $data['list'][$player]['name'];
                    $stats[$i]['country_name']          = $data['list'][$player]['country'];
                    $stats[$i]['rank']                  = $data['list'][$player]['stats']['rank']['nr'];
                    $stats[$i]['ranktest']              = $data['list'][$player]['stat']['kdr'];
                    $stats[$i]['rank2']                 = $data['list'][$player]['stats']['rank']['img_info'];
                    $stats[$i]['name1']                 = $data['list'][$player]['stats']['rank']['name'];
                    $stats[$i]['ribbonsimgr10']         = $data['list'][$player]['stats']['ribbons']['r10']['img_small'];
                    $stats[$i]['ribbonscountr10']       = $data['list'][$player]['stats']['ribbons']['r10']['count'];
                    $stats[$i]['ribbonsnamer10']        = $data['list'][$player]['stats']['ribbons']['r10']['name'];
                    $stats[$i]['ribbonsimgr11']         = $data['list'][$player]['stats']['ribbons']['r11']['img_small'];
                    $stats[$i]['ribbonscountr11']       = $data['list'][$player]['stats']['ribbons']['r11']['count'];
                    $stats[$i]['ribbonsnamer11']        = $data['list'][$player]['stats']['ribbons']['r11']['name'];
                    $stats[$i]['ribbonsimgr12']         = $data['list'][$player]['stats']['ribbons']['r12']['img_small'];
                    $stats[$i]['ribbonscountr12']       = $data['list'][$player]['stats']['ribbons']['r12']['count'];
                    $stats[$i]['ribbonsnamer12']        = $data['list'][$player]['stats']['ribbons']['r12']['name'];
                    $stats[$i]['ribbonsimgr13']         = $data['list'][$player]['stats']['ribbons']['r13']['img_small'];
                    $stats[$i]['ribbonscountr13']       = $data['list'][$player]['stats']['ribbons']['r13']['count'];
                    $stats[$i]['ribbonsnamer13']        = $data['list'][$player]['stats']['ribbons']['r13']['name'];
                    $stats[$i]['ribbonsimgr14']         = $data['list'][$player]['stats']['ribbons']['r14']['img_small'];
                    $stats[$i]['ribbonscountr14']       = $data['list'][$player]['stats']['ribbons']['r14']['count'];
                    $stats[$i]['ribbonsnamer14']        = $data['list'][$player]['stats']['ribbons']['r14']['name'];
                    $stats[$i]['ribbonsimgr15']         = $data['list'][$player]['stats']['ribbons']['r15']['img_small'];
                    $stats[$i]['ribbonscountr15']       = $data['list'][$player]['stats']['ribbons']['r15']['count'];                               
                    $stats[$i]['ribbonsnamer15']        = $data['list'][$player]['stats']['ribbons']['r15']['name'];
                    $stats[$i]['ribbonsimgr16']         = $data['list'][$player]['stats']['ribbons']['r16']['img_small'];
                    $stats[$i]['ribbonscountr16']       = $data['list'][$player]['stats']['ribbons']['r16']['count'];
                    $stats[$i]['ribbonsnamer16']        = $data['list'][$player]['stats']['ribbons']['r16']['name'];
                    $stats[$i]['ribbonsimgr17']         = $data['list'][$player]['stats']['ribbons']['r17']['img_small'];
                    $stats[$i]['ribbonscountr17']       = $data['list'][$player]['stats']['ribbons']['r17']['count'];
                    $stats[$i]['ribbonsnamer17']        = $data['list'][$player]['stats']['ribbons']['r17']['name'];
                    $stats[$i]['ribbonsimgr18']         = $data['list'][$player]['stats']['ribbons']['r18']['img_small'];
                    $stats[$i]['ribbonscountr18']       = $data['list'][$player]['stats']['ribbons']['r18']['count'];
                    $stats[$i]['ribbonsnamer18']        = $data['list'][$player]['stats']['ribbons']['r18']['name'];
                    $stats[$i]['ribbonsimgr19']         = $data['list'][$player]['stats']['ribbons']['r19']['img_small'];
                    $stats[$i]['ribbonscountr19']       = $data['list'][$player]['stats']['ribbons']['r19']['count'];
                    $stats[$i]['ribbonsnamer19']        = $data['list'][$player]['stats']['ribbons']['r19']['name'];
                    $stats[$i]['ribbonsimgr20']         = $data['list'][$player]['stats']['ribbons']['r20']['img_small'];
                    $stats[$i]['ribbonscountr20']       = $data['list'][$player]['stats']['ribbons']['r20']['count'];
                    $stats[$i]['ribbonsnamer20']        = $data['list'][$player]['stats']['ribbons']['r20']['name'];
                    $stats[$i]['ribbonsimgr21']         = $data['list'][$player]['stats']['ribbons']['r21']['img_small'];
                    $stats[$i]['ribbonscountr21']       = $data['list'][$player]['stats']['ribbons']['r21']['count'];
                    $stats[$i]['ribbonsnamer21']        = $data['list'][$player]['stats']['ribbons']['r21']['name'];
                    $stats[$i]['ribbonsimgr22']         = $data['list'][$player]['stats']['ribbons']['r22']['img_small'];
                    $stats[$i]['ribbonscountr22']       = $data['list'][$player]['stats']['ribbons']['r22']['count'];
                    $stats[$i]['ribbonsnamer22']        = $data['list'][$player]['stats']['ribbons']['r22']['name'];
                    $stats[$i]['ribbonsimgr23']         = $data['list'][$player]['stats']['ribbons']['r23']['img_small'];
                    $stats[$i]['ribbonscountr23']       = $data['list'][$player]['stats']['ribbons']['r23']['count'];                               
                    $stats[$i]['ribbonsnamer23']        = $data['list'][$player]['stats']['ribbons']['r23']['name'];
                    $stats[$i]['ribbonsimgr25']         = $data['list'][$player]['stats']['ribbons']['r25']['img_small'];
                    $stats[$i]['ribbonscountr25']       = $data['list'][$player]['stats']['ribbons']['r25']['count'];
                    $stats[$i]['ribbonsnamer25']        = $data['list'][$player]['stats']['ribbons']['r25']['name'];
                    $stats[$i]['ribbonsimgr27']         = $data['list'][$player]['stats']['ribbons']['r27']['img_small'];
                    $stats[$i]['ribbonscountr27']       = $data['list'][$player]['stats']['ribbons']['r27']['count'];
                    $stats[$i]['ribbonsnamer27']        = $data['list'][$player]['stats']['ribbons']['r27']['name'];
                    $stats[$i]['ribbonsimgr31']         = $data['list'][$player]['stats']['ribbons']['r31']['img_small'];
                    $stats[$i]['ribbonscountr31']       = $data['list'][$player]['stats']['ribbons']['r31']['count'];
                    $stats[$i]['ribbonsnamer31']        = $data['list'][$player]['stats']['ribbons']['r31']['name'];
                    $stats[$i]['ribbonsimgr32']         = $data['list'][$player]['stats']['ribbons']['r32']['img_small'];
                    $stats[$i]['ribbonscountr32']       = $data['list'][$player]['stats']['ribbons']['r32']['count'];
                    $stats[$i]['ribbonsnamer32']        = $data['list'][$player]['stats']['ribbons']['r32']['name'];
                    $stats[$i]['ribbonsimgr40']         = $data['list'][$player]['stats']['ribbons']['r40']['img_small'];
                    $stats[$i]['ribbonscountr40']       = $data['list'][$player]['stats']['ribbons']['r40']['count'];
                    $stats[$i]['ribbonsnamer40']        = $data['list'][$player]['stats']['ribbons']['r40']['name'];
                    $stats[$i]['ribbonsimgr41']         = $data['list'][$player]['stats']['ribbons']['r41']['img_small'];
                    $stats[$i]['ribbonscountr41']       = $data['list'][$player]['stats']['ribbons']['r41']['count'];
                    $stats[$i]['ribbonsnamer41']        = $data['list'][$player]['stats']['ribbons']['r41']['name'];
                    $stats[$i]['ribbonsimgr43']         = $data['list'][$player]['stats']['ribbons']['r43']['img_small'];
                    $stats[$i]['ribbonscountr43']       = $data['list'][$player]['stats']['ribbons']['r43']['count'];
                    $stats[$i]['ribbonsnamer43']        = $data['list'][$player]['stats']['ribbons']['r43']['name'];
                    $stats[$i]['spm']                   = $data['list'][$player]['stats']['global']['time'];
                    $stats[$i]['last-update']           = date('d.m.y - H:i',$data['list'][$player]['stats']['date_check']); 
                    $stats[$i]['rankimg1']              = $data['list'][$player]['stats']['rank']['img_medium']; 
                    $stats[$i]['rankimg']               = $data['list'][$player]['stats']['rank']['img_tiny'];  
                    $stats[$i]['time']                  = $data['list'][$player]['stats']['global']['time'];
                    $stats[$i]['kills']                 = $data['list'][$player]['stats']['global']['kills'];
                    $stats[$i]['deaths']                = $data['list'][$player]['stats']['global']['deaths'];
                    $stats[$i]['skill']                 = $data['list'][$player]['stats']['global']['elo'];
                    $stats[$i]['score']                 = $data['list'][$player]['stats']['scores']['score'];
                    $stats[$i]['team']                  = $data['list'][$player]['stats']['scores']['team'];
                    $stats[$i]['dogtags']               = $data['list'][$player]['stats']['global']['dogtags'];
                    $stats[$i]['longesths']             = $data['list'][$player]['stats']['global']['longesths'];
                    $stats[$i]['wins']                  = $data['list'][$player]['stats']['global']['wins'];
                    $stats[$i]['losses']                = $data['list'][$player]['stats']['global']['losses'];
                    $stats[$i]['kits']                  = array();
                    $stats[$i]['progress']              = round(($data['list'][$player]['stats']['scores']['score']-$data['list'][$player]['stats']['rank']['score'])/($data['list'][$player]['stats']['nextranks']['0']['score']-$data['list'][$player]['stats']['rank']['score'])*100,0);
                    $stats[$i]['kits'][]                = array('name' => 'assault',     'time' => $data['list'][$player]['stats']['kits']['assault']['time']);
                    $stats[$i]['kits'][]                = array('name' => 'engineer',     'time' => $data['list'][$player]['stats']['kits']['engineer']['time']);
                    $stats[$i]['kits'][]                = array('name' => 'recon',     'time' => $data['list'][$player]['stats']['kits']['recon']['time']);
                    $stats[$i]['kits'][]                = array('name' => 'support',     'time' => $data['list'][$player]['stats']['kits']['support']['time']);
                    $stats[$i]['killassists']           = $data['list'][$player]['stats']['global']['killassists'];
                    $stats[$i]['revives']               = $data['list'][$player]['stats']['global']['revives'];
                    $stats[$i]['resupplies']            = $data['list'][$player]['stats']['global']['resupplies'];
                    $stats[$i]['heals']                 = $data['list'][$player]['stats']['global']['heals'];
                    $stats[$i]['headshots']             = $data['list'][$player]['stats']['global']['headshots'];
                    $stats[$i]['award']                 = $data['list'][$player]['stats']['scores']['award'];
                    $stats[$i]['bonus']                 = $data['list'][$player]['stats']['scores']['bonus'];
                    $stats[$i]['unlock']                = $data['list'][$player]['stats']['scores']['unlock'];
                    $stats[$i]['support']               = $data['list'][$player]['stats']['scores']['support'];
                    $stats[$i]['assault']               = $data['list'][$player]['stats']['scores']['assault'];
                    $stats[$i]['recon']                 = $data['list'][$player]['stats']['scores']['recon'];
                    $stats[$i]['engineer']              = $data['list'][$player]['stats']['scores']['engineer'];
                    $stats[$i]['scorecoop']             = $data['list'][$player]['stats']['coop']['score'];
                    $stats[$i]['vehicleall']            = $data['list'][$player]['stats']['scores']['vehicleall'];
                    $stats[$i]['scorecoop']             = $data['list'][$player]['stats']['coop']['score'];
                    $stats[$i]['killstreakbonus']       = $data['list'][$player]['stats']['global']['killstreakbonus'];
                    $stats[$i]['squad']                 = $data['list'][$player]['stats']['scores']['squad'];
                    $stats[$i]['objective']             = $data['list'][$player]['stats']['scores']['objective'];
                    $stats[$i]['shots']                 = $data['list'][$player]['stats']['global']['shots'];
                    $stats[$i]['hits']                  = $data['list'][$player]['stats']['global']['hits'];
                    $stats[$i]['vehiclekills']          = $data['list'][$player]['stats']['global']['vehiclekills'];
                    $stats[$i]['vehicledestroyassist']  = $data['list'][$player]['stats']['global']['vehicledestroyassist'];
                    $stats[$i]['killassists']           = $data['list'][$player]['stats']['global']['killassists'];
                    $stats[$i]['damagaassisits']        = $data['list'][$player]['stats']['global']['damagassists'];
                    $stats[$i]['avengerkills']          = $data['list'][$player]['stats']['global']['avengerkills'];
                    $stats[$i]['saviorkills']           = $data['list'][$player]['stats']['global']['saviorkills'];
                    $stats[$i]['nemesiskills']          = $data['list'][$player]['stats']['global']['nemesiskills'];
                    $stats[$i]['resupplies']            = $data['list'][$player]['stats']['global']['resupplies'];
                    $stats[$i]['revives']               = $data['list'][$player]['stats']['global']['revives'];
                    $stats[$i]['heals']                 = $data['list'][$player]['stats']['global']['heals'];
                    $stats[$i]['repairs']               = $data['list'][$player]['stats']['global']['repairs'];
                    $stats[$i]['vehicleah']             = $data['list'][$player]['stats']['scores']['vehicleah'];
                    $stats[$i]['vehicleifv']            = $data['list'][$player]['stats']['scores']['vehicleifv'];
                    $stats[$i]['vehiclejet']            = $data['list'][$player]['stats']['scores']['vehiclejet'];
                    $stats[$i]['vehiclembt']            = $data['list'][$player]['stats']['scores']['vehiclembt'];            
                   
                   
                   
                   
                    // Work out which is the most used kit                
                    usort($stats[$i]['kits'], 'sortKits');
                    
                    $stats[$i]['class']     = $stats[$i]['kits'][0]['name'];
                    
                    $i++;
                }
            }
        }
        
        // Order players based on score
        usort($stats, 'sortPlayers');
    
    
    ?>
    <center>
    
    <table cellpadding="8" cellspacing="1" style="border-850px:fixed; font-size:12px; font-family:arial,helvetica,sans-serif;">
    
           <thead>
                <tr>
                  <th style="color:#000000; font-size:12px; background-color:#CCCCCC;">#</th>
                  <th style="color:#000000; font-size:12px; background-color:#CCCCCC; width:160px;">Player</th>
                  <th style="color:#000000; font-size:12px; background-color:#CCCCCC;">Rank</th>
                  <th style="color:#000000; font-size:12px; background-color:#CCCCCC;">Progress</th>
                  <th style="color:#000000; font-size:12px; background-color:#CCCCCC;">Score</th>
                  <th style="color:#000000; font-size:12px; background-color:#CCCCCC;">Win/Loss</th>
                  <th style="color:#000000; font-size:12px; background-color:#CCCCCC;">W/L Ratio</th>
                  <th style="color:#000000; font-size:12px; background-color:#CCCCCC;">Kills/Deaths</th>
                  <th style="color:#000000; font-size:12px; background-color:#CCCCCC;">K/D Ratio</th>
                  <th style="color:#000000; font-size:12px; background-color:#CCCCCC;">Skill</th>
                  <th style="color:#000000; font-size:12px; background-color:#CCCCCC;">Time</th>
                  <th style="color:#000000; font-size:12px; background-color:#CCCCCC;">Dogtags</th>
                  <th style="color:#000000; font-size:12px; background-color:#CCCCCC;">HeadShots</th>
                  <th style="color:#000000; font-size:12px; background-color:#CCCCCC;">Long. HS</th>
                </tr>
            </thead>
        
            <tbody>
           
            <?
            for($out = 0; $out < count($stats); $out++):
                $pos = $out + 1; ?>
                                    </td>
    
                 
    
          <td align="center" bgcolor="#666666" class="first"><?=$pos?></td>
                  
                       
            <td bgcolor="#666666" class="soldier">
                               <img src="./flags/<?=$stats[$out]['country_name']?>.png" alt="<?=$stats[$out]['country']?>" />
                       <img src="./kits/<?=$stats[$out]['class']?>.png" alt="" />
                                                            
    
    <a href="http://bf3stats.com/stats_pc/<?=$stats[$out]['name']?>" target="_blank" onmousemove="ShowContent('uniquename<?=$out?>'); return true;" onmouseover=
    "ShowContent('uniquename<?=$out?>'); return true;" onmouseout="HideContent('uniquename<?=$out?>'); return true;" href="javascript:ShowContent('uniquename<?=
    $out?>')">
    
        <font size="1" color="cccccc"><?=$stats[$out]['name']?></font></a></td>
                    
        <div id="uniquename<?=$out?>" style="display:none; position:fixed;  float:left; border-style:solid; border-width:1px; background-color:#000000; padding:2px; width:700; height:485;">
                    
        <img src="<?=$stats[$out]['rankimg1']?>" ALIGN="left" alt="<?=$stats[$out]['rank']?>" /> <br>
    
        <font size="5" color="ececec" style="font-family:arial,helvetica,sans-serif; float:left;"><?=$stats[$out]['name']?></font><br><br>
        <font size="1" color="999999" style="font-family:arial,helvetica,sans-serif; float:left;"><?=$stats[$out]['name1']?></font><br>
    
    
    
    <div class="floatleft" style="background-color:#242424; height:360; border:none; font-family:arial,helvetica,sans-serif; background-color:#242424;">
            <p align="left">
                <font size="1" color="999999">General Score: </font> 
                <font size="1" color="ececec"><?=$stats[$out]['score']?></font><br>
                <font size="1" color="999999">Objective Score: </font> 
                <font size="1" color="ececec"><?=$stats[$out]['objective']?></font><br>
                <font size="1" color="999999">Squad Score: </font>
                <font size="1" color="ececec"><?=$stats[$out]['squad']?></font><br>
                <font size="1" color="999999">Unlocks: </font>
                <font size="1" color="ececec"><?=round($stats[$out]['unlock'])?></font><br>
                <font size="1" color="999999">Bonus: </font>
                <font size="1" color="ececec"><?=round($stats[$out]['bonus'])?></font><br>
                <font size="1" color="999999">Awards: </font>
                <font size="1" color="ececec"><?=round($stats[$out]['award'])?></font><br>
                <font size="1" color="999999">Support: </font>
                <font size="1" color="ececec"><?=round($stats[$out]['support'])?></font><br>
                <font size="1" color="999999">Assault: </font>
                <font size="1" color="ececec"><?=round($stats[$out]['assault'])?></font><br>
                <font size="1" color="999999">Recon: </font>
                <font size="1" color="ececec"><?=round($stats[$out]['recon'])?></font><br>
                <font size="1" color="999999">Engineer: </font> 
                <font size="1" color="ececec"><?=round($stats[$out]['engineer'])?></font><br>
                <font size="1" color="999999">Vehicle Score: </font> 
                <font size="1" color="ececec"><?=($stats[$out]['vehicleall'])?></font><br>
                <font size="1" color="999999">All Vehicle Kills: </font> 
                <font size="1" color="ececec"><?=$stats[$out]['vehiclekills']?></font><br>
                <font size="1" color="999999">Attack Heli Score: </font> 
                <font size="1" color="ececec"><?=($stats[$out]['vehicleah'])?></font><br>
                <font size="1" color="999999">Ifv Score: </font> 
                <font size="1" color="ececec"><?=$stats[$out]['vehicleifv']?></font><br>
                <font size="1" color="999999">Jet Score: </font> 
                <font size="1" color="ececec"><?=$stats[$out]['vehiclejet']?></font><br>
                <font size="1" color="999999">Mbt Score: </font> 
                <font size="1" color="ececec"><?=$stats[$out]['vehiclembt']?></font><br>
                <font size="1" color="999999">Shots Fired: </font>
                <font size="1" color="ececec"><?=$stats[$out]['shots']?></font><br>
                <font size="1" color="999999">Total Hits: </font>
                <font size="1" color="ececec"><?=round($stats[$out]['hits'])?></font><br>
                <font size="1" color="999999">Kill Assists: </font>
                <font size="1" color="ececec"><?=round($stats[$out]['killassists'])?></font><br>
                <font size="1" color="999999">Revives: </font>
                <font size="1" color="ececec"><?=round($stats[$out]['revives'])?></font><br>
                <font size="1" color="999999">Resupplies: </font>
                <font size="1" color="ececec"><?=round($stats[$out]['resupplies'])?></font><br>
                <font size="1" color="999999">Heals: </font>
                <font size="1" color="ececec"><?=round($stats[$out]['heals'])?></font><br>
                <font size="1" color="999999">Repairs: </font>
                <font size="1" color="ececec"><?=round($stats[$out]['repairs'])?></font><br>
                          
            </p>
        </div><br />
    
    <div class="floatleft">                     
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=$stats[$out]['ribbonsname']?></font>
        <font size="1" color="000000" style="font-family:arial,helvetica,sans-serif;"><b>MVP</b></font><br> <img src="./<?=$stats[$out]['ribbonsimgr16']?>" /><br>
        <font size="1" color="FF3300" style="font-family:arial,helvetica,sans-serif;"><?=round($stats[$out]['ribbonscountr16'])?></font><br><br>
         
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=$stats[$out]['ribbonsname']?></font>
        <font size="1" color="000000" style="font-family:arial,helvetica,sans-serif;"><b>MVP 2</b></font><br> <img src="./<?=$stats[$out]['ribbonsimgr17']?>" /><br>
        <font size="1" color="FF3300" style="font-family:arial,helvetica,sans-serif;"><?=round($stats[$out]['ribbonscountr17'])?></font><br>
           
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=$stats[$out]['ribbonsname']?></font><br>
        <font size="1" color="000000" style="font-family:arial,helvetica,sans-serif;"><b>MVP 3</b></font><br> <img src="./<?=$stats[$out]['ribbonsimgr18']?>" /><br>
        <font size="1" color="FF3300" style="font-family:arial,helvetica,sans-serif;"><?=round($stats[$out]['ribbonscountr18'])?></font><br><br>
         
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=$stats[$out]['ribbonsname']?></font>
        <font size="1" color="000000" style="font-family:arial,helvetica,sans-serif;"><b>ACE SQUAD</b></font><br> <img src="./<?=$stats[$out]['ribbonsimgr19']?>" /><br>
        <font size="1" color="FF3300" style="font-family:arial,helvetica,sans-serif;"><?=round($stats[$out]['ribbonscountr19'])?></font>                          
        </p>
        
        </div>
        <div class="floatleft">                     
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=$stats[$out]['ribbonsname']?></font>
        <font size="1" color="000000" style="font-family:arial,helvetica,sans-serif;"><b>TDM</b></font><br> <img src="./<?=$stats[$out]['ribbonsimgr32']?>" /><br>
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=round($stats[$out]['ribbonscountr32'])?></font><br><br>
         
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=$stats[$out]['ribbonsname']?></font>
        <font size="1" color="000000" style="font-family:arial,helvetica,sans-serif;"><b>CONQUEST</b></font><br> <img src="./<?=$stats[$out]['ribbonsimgr31']?>" /><br>
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=round($stats[$out]['ribbonscountr31'])?></font><br>
           
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=$stats[$out]['ribbonsname']?></font><br>
        <font size="1" color="000000" style="font-family:arial,helvetica,sans-serif;"><b>ATTACK</b></font><br> <img src="./<?=$stats[$out]['ribbonsimgr40']?>" /><br>
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=round($stats[$out]['ribbonscountr40'])?></font><br><br>
         
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=$stats[$out]['ribbonsname']?></font>
        <font size="1" color="000000" style="font-family:arial,helvetica,sans-serif;"><b>DEFEND</b></font><br> <img src="./<?=$stats[$out]['ribbonsimgr41']?>" /><br>
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=round($stats[$out]['ribbonscountr41'])?></font>                          
        </p>
        
        </div>
        <div class="floatleft">                     
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=$stats[$out]['ribbonsname']?></font>
        <font size="1" color="000000" style="font-family:arial,helvetica,sans-serif;"><b>AVENGER</b></font><br> <img src="./<?=$stats[$out]['ribbonsimgr12']?>" /><br>
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=round($stats[$out]['ribbonscountr12'])?></font><br><br>
         
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=$stats[$out]['ribbonsname']?></font>
        <font size="1" color="000000" style="font-family:arial,helvetica,sans-serif;"><b>SAVIOR</b></font><br> <img src="./<?=$stats[$out]['ribbonsimgr13']?>" /><br>
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=round($stats[$out]['ribbonscountr13'])?></font><br>
           
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=$stats[$out]['ribbonsname']?></font><br>
        <font size="1" color="000000" style="font-family:arial,helvetica,sans-serif;"><b>NEMESIS</b></font><br> <img src="./<?=$stats[$out]['ribbonsimgr14']?>" /><br>
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=round($stats[$out]['ribbonscountr14'])?></font><br><br>
         
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=$stats[$out]['ribbonsname']?></font>
        <font size="1" color="000000" style="font-family:arial,helvetica,sans-serif;"><b>SQUAD WIPE</b></font><br> <img src="./<?=$stats[$out]['ribbonsimgr23']?>" /><br>
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=round($stats[$out]['ribbonscountr23'])?></font>                          
        </p>
        
        </div>
        <div class="floatleft">                     
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=$stats[$out]['ribbonsname']?></font>
        <font size="1" color="000000" style="font-family:arial,helvetica,sans-serif;"><b>ACCURACY</b></font><br> <img src="./<?=$stats[$out]['ribbonsimgr11']?>" /><br>
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=round($stats[$out]['ribbonscountr11'])?></font><br><br>
         
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=$stats[$out]['ribbonsname']?></font>
        <font size="1" color="000000" style="font-family:arial,helvetica,sans-serif;"><b>SURPRESSION</b></font><br> <img src="./<?=$stats[$out]['ribbonsimgr15']?>" /><br>
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=round($stats[$out]['ribbonscountr15'])?></font><br>
           
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=$stats[$out]['ribbonsname']?></font><br>
        <font size="1" color="000000" style="font-family:arial,helvetica,sans-serif;"><b>MAINTANANCE</b></font><br> <img src="./<?=$stats[$out]['ribbonsimgr43']?>" /><br>
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=round($stats[$out]['ribbonscountr43'])?></font><br><br>
         
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=$stats[$out]['ribbonsname']?></font>
        <font size="1" color="000000" style="font-family:arial,helvetica,sans-serif;"><b>EFFICENCY</b></font><br> <img src="./<?=$stats[$out]['ribbonsimgr20']?>" /><br>
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=round($stats[$out]['ribbonscountr20'])?></font>                          
        </p>
        
        </div>
        <div class="floatleft">                     
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=$stats[$out]['ribbonsname']?></font>
        <font size="1" color="000000" style="font-family:arial,helvetica,sans-serif;"><b>ANTI VEHICLE</b></font><br> <img src="./<?=$stats[$out]['ribbonsimgr10']?>" /><br>
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=round($stats[$out]['ribbonscountr10'])?></font><br><br>
         
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=$stats[$out]['ribbonsname']?></font>
        <font size="1" color="000000" style="font-family:arial,helvetica,sans-serif;"><b>AIR WARFARE</b></font><br> <img src="./<?=$stats[$out]['ribbonsimgr27']?>" /><br>
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=round($stats[$out]['ribbonscountr27'])?></font><br>
           
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=$stats[$out]['ribbonsname']?></font><br>
        <font size="1" color="000000" style="font-family:arial,helvetica,sans-serif;"><b>ANTI EXPLOSIVE</b></font><br> <img src="./<?=$stats[$out]['ribbonsimgr21']?>" /><br>
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=round($stats[$out]['ribbonscountr21'])?></font><br><br>
         
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=$stats[$out]['ribbonsname']?></font>
        <font size="1" color="000000" style="font-family:arial,helvetica,sans-serif;"><b>TANK WARFARE</b></font><br> <img src="./<?=$stats[$out]['ribbonsimgr25']?>" /><br>
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=round($stats[$out]['ribbonscountr25'])?></font>                          
        </p>
        
        
        
     <td align="center" style="background-color:#666666;">
        <img src="<?=$stats[$out]['rankimg']?>" alt="<?=$stats[$out]['rank']?>" />
    </td>
     
    <td style="width: 50px; background-color:#666666; color:#555555;" title="<?=number_format($stats[$out]['progress'],0,',','.')?> %">
     <p style="border: 1px solid black; width: 55px; background-color: #242424;">
     <span style="background-color: #ff8c00; display: block; padding: 2px; width: <?=number_format($stats[$out]['progress'],0,',','.')?>%">
     </span>
     </p>
     </td>
     </td>
                       
                        
        <td align="center" style="background-color:#666666; color:#cccccc;"><?=number_format($stats[$out]['score'])?></td>
        <td align="center" style="background-color:#666666; color:#cccccc;"><?=number_format($stats[$out]['wins'])?> / <?=number_format($stats[$out]['losses'])?></td>
        <td align="center" style="background-color:#666666; color:#cccccc;"><?=round($stats[$out]['wins']/$stats[$out]['losses'], 2)?></td>
        <td align="center" style="background-color:#666666; color:#cccccc;"><?=number_format($stats[$out]['kills'])?> / <?=number_format($stats[$out]['deaths'])?></td>
        <td align="center" style="background-color:#666666; color:#cccccc;""><?=$stats[$out]['ranktest']?></td>
        <td align="center" style="background-color:#666666; color:#cccccc;"><?=round($stats[$out]['skill'])?></td>  
        <td align="center" style="background-color:#666666; color:#cccccc;"><?=sec2hms($stats[$out]['time'])?>h</td>
        <td align="center" style="background-color:#666666; color:#cccccc;"><?=round($stats[$out]['dogtags'])?></td>
        <td align="center" style="background-color:#666666; color:#cccccc;"><?=round($stats[$out]['headshots'])?></td>
        <td align="center" style="background-color:#666666; color:#cccccc;"><?=round($stats[$out]['longesths'])?> m</td>
                                  
     </tr>      
            <?
            endfor; ?>
                    
            </tbody>
        </table>  
        
    </center>
    
    
        <?
        // If you add ?debug=1 to the end of your script URL in the browser you can see what data is returned
        if(isset($_GET['debug']))
        {
            echo '<pre>';
                print_r($data);
            echo '</pre>';
        }    
    } 
    else 
    {
        echo 'Error contacting API status code: '.$statusCode;
    }
    
    // Lets dump our functions down here, these would be better in a seperate include though
    
    function sortKits($x, $y)
    {
        if($x['time'] == $y['time'])
        {
            return 0;
        }
        elseif($x['time'] < $y['time'])
        {
            return 1;
        }
        else
        {
            return -1;
        }
    }
    
    function sortPlayers($x, $y)
    {
        if($x['score'] == $y['score'])
        {
            return 0;
        }
        elseif($x['score'] < $y['score'])
        {
            return 1;
        }
        else
        {
            return -1;
        }
    }
    
    // Convert seconds to hours
    function sec2hms($sec, $padHours = false) 
    {
        $hms     = "";
        $hours     = intval(intval($sec) / 3600); 
        $hms     .= ($padHours)? str_pad($hours, 2, "0", STR_PAD_LEFT). ':' : $hours;    
        return $hms;
    }
    ?>

  17. #137
    Member
    Join Date
    2011-11-08
    Location
    NRW
    Posts
    112
    BFBC2 PC
    Tony_GER
    BF3 PC
    xXxT0NYxXx

    AW: Re: API PHP example with table output

    Hi ekoman,
    wo willste die denn hinhaben?
    Hinter "Long. HS" vielleicht?

  18. #138
    Member
    Join Date
    2011-11-08
    Location
    NRW
    Posts
    112
    BFBC2 PC
    Tony_GER
    BF3 PC
    xXxT0NYxXx

    AW: Re: API PHP example with table output

    Bitte schön. sollte so funktionieren, habe es mal hier ausprobiert.
    http://zockanstalt.de/index.php?opti...per&Itemid=313


    PHP Code:


    <link rel="stylesheet" type="text/css" href="./css/bf3.css">
    <script type="text/javascript" language="JavaScript">
    <!-- Copyright 2006,2007 Bontrager Connection, LLC
    // http://bontragerconnection.com/ and http://www.willmaster.com/
    // Version: July 28, 2007
    // javascript for floating table at mouse position
    var cX = 0; var cY = 0; var rX = 0; var rY = 0;
    function UpdateCursorPosition(e){ cX = e.pageX; cY = e.pageY;}
    function UpdateCursorPositionDocAll(e){ cX = event.clientX; cY = event.clientY;}
    if(document.all) { document.onmousemove = UpdateCursorPositionDocAll; }
    else { document.onmousemove = UpdateCursorPosition; }
    function AssignPosition(d) {
    if(self.pageYOffset) {
        rX = self.pageXOffset;
        rY = self.pageYOffset;
        }
    else if(document.documentElement && document.documentElement.scrollMiddle) {
        rX = document.documentElement.scrollLeft;
        rY = document.documentElement.scrollMiddle;
        }
    else if(document.body) {
        rX = document.body.scrollLeft;
        rY = document.body.scrollMiddle;
        }
    if(document.all) {
        cX += rX; 
        cY += rY;
        }
    d.style.left = (cX+10) + "px";
    d.style.middle = (cY+10) + "px";
    }
    function HideContent(d) {
    if(d.length < 1) { return; }
    document.getElementById(d).style.display = "none";
    }
    function ShowContent(d) {
    if(d.length < 1) { return; }
    var dd = document.getElementById(d);
    AssignPosition(dd);
    dd.style.display = "block";
    }
    function ReverseContentDisplay(d) {
    if(d.length < 1) { return; }
    var dd = document.getElementById(d);
    AssignPosition(dd);
    if(dd.style.display == "none") { dd.style.display = "block"; }
    else { dd.style.display = "none"; }
    }
    //-->
    </script>


    <?php


    $playerData 
    = array('players' => array(), 'opt' => array());

    // Our list of players


    $playerData['players'][]        = 'ekomanic';
    $playerData['players'][]         = 'Blumentopp';
    $playerData['players'][]         = 'tron0071';
    $playerData['players'][]         = 'AndyGrenzen';
    $playerData['players'][]         = 'Faultierchief';
    $playerData['players'][]         = 'darkdever';
    $playerData['players'][]         = 'LtCmdr85';
    $playerData['players'][]         = 'dont4get-murdock';
    $playerData['players'][]         = 'mehdi2109';
    $playerData['players'][]         = 'DopplerWobble';
    $playerData['players'][]         = 'VY_CanisMajoris1';
    $playerData['players'][]         = 'YoShIs_ReVeNgE';


    /* In this example we want as little information to come back from the API as possible.
    ** Therefore we are calling the "clear" function, which means we need to manually enable
    ** each stat group we need. This will help keep the size of the response down, and therefore execution time.
    */
    $playerData['opt']['clear']        = true;

    // Data we want to be returned
    $playerdata['opt']['all']      = true;
    $playerData['opt']['global']    = true;
    $playerData['opt']['nextranks']    = true;
    $playerData['opt']['rank']        = true;
    $playerData['opt']['kits']        = true;
    $playerData['opt']['scores']    = true;
    $playerData['opt']['imgInfo']    = true;
    $playerData['opt']['awards']    = true;
    $playerdata['opt']['awardsInfo']  = true;
    $playerdata['opt']['awardsAwarded']      = true;
    $playerData['opt']['ribbons']    = true;
    $playerData['opt']['medals']    = true;
    $playerData['opt']['raw']    = true;
    $playerData['opt']['nozero']    = true;
    $playerData['opt']['coop']    = true;
    $playerdata['opt']['coopInfo']  = true;
    $playerdata['opt']['coopimg']      = true;


    // Convert lists to JSON ready for the curl post request
    $postData                        = array();
    $postData['players']            = json_encode($playerData['players']);
    $postData['opt']                = json_encode($playerData['opt']);

    // This example hardcodes "pc" players
    $c curl_init('http://api.bf3stats.com/pc/playerlist/');
    curl_setopt($cCURLOPT_HEADERfalse);
    curl_setopt($cCURLOPT_POSTtrue);
    curl_setopt($cCURLOPT_USERAGENT'BF3StatsAPI/0.1');
    curl_setopt($cCURLOPT_HTTPHEADER, array('Expect:'));
    curl_setopt($cCURLOPT_RETURNTRANSFERtrue);
    curl_setopt($cCURLOPT_POSTFIELDS$postData);
    $response      curl_exec($c);
    $statusCode    curl_getinfo($cCURLINFO_HTTP_CODE);
    curl_close($c);

    // 200 means a successful call
    if($statusCode == 200
    {
        
    // Decode JSON Data into an array we can easily parse
        
    $data json_decode($responsetrue);
        
        
    // Counter for our players array
        
    $i 0;
        
        
    // Loop through each of our players we set above and see what data we have for them
        
    foreach($playerData['players'] AS $player)
        {
            
    // Does this player exist in the returned data?
            
    if(isset($data['list'][$player]))
            {
                
    // This checks to see if the player actually has any stats yet on the site
                
    if($data['list'][$player]['status'] == "data")
                {
                    
    $stats[$i]['name']                  = $data['list'][$player]['name'];
                    
    $stats[$i]['country_name']          = $data['list'][$player]['country'];
                    
    $stats[$i]['rank']                  = $data['list'][$player]['stats']['rank']['nr'];
                    
    $stats[$i]['ranktest']              = $data['list'][$player]['stat']['kdr'];
                    
    $stats[$i]['rank2']                 = $data['list'][$player]['stats']['rank']['img_info'];
                    
    $stats[$i]['name1']                 = $data['list'][$player]['stats']['rank']['name'];
                    
    $stats[$i]['ribbonsimgr10']         = $data['list'][$player]['stats']['ribbons']['r10']['img_small'];
                    
    $stats[$i]['ribbonscountr10']       = $data['list'][$player]['stats']['ribbons']['r10']['count'];
                    
    $stats[$i]['ribbonsnamer10']        = $data['list'][$player]['stats']['ribbons']['r10']['name'];
                    
    $stats[$i]['ribbonsimgr11']         = $data['list'][$player]['stats']['ribbons']['r11']['img_small'];
                    
    $stats[$i]['ribbonscountr11']       = $data['list'][$player]['stats']['ribbons']['r11']['count'];
                    
    $stats[$i]['ribbonsnamer11']        = $data['list'][$player]['stats']['ribbons']['r11']['name'];
                    
    $stats[$i]['ribbonsimgr12']         = $data['list'][$player]['stats']['ribbons']['r12']['img_small'];
                    
    $stats[$i]['ribbonscountr12']       = $data['list'][$player]['stats']['ribbons']['r12']['count'];
                    
    $stats[$i]['ribbonsnamer12']        = $data['list'][$player]['stats']['ribbons']['r12']['name'];
                    
    $stats[$i]['ribbonsimgr13']         = $data['list'][$player]['stats']['ribbons']['r13']['img_small'];
                    
    $stats[$i]['ribbonscountr13']       = $data['list'][$player]['stats']['ribbons']['r13']['count'];
                    
    $stats[$i]['ribbonsnamer13']        = $data['list'][$player]['stats']['ribbons']['r13']['name'];
                    
    $stats[$i]['ribbonsimgr14']         = $data['list'][$player]['stats']['ribbons']['r14']['img_small'];
                    
    $stats[$i]['ribbonscountr14']       = $data['list'][$player]['stats']['ribbons']['r14']['count'];
                    
    $stats[$i]['ribbonsnamer14']        = $data['list'][$player]['stats']['ribbons']['r14']['name'];
                    
    $stats[$i]['ribbonsimgr15']         = $data['list'][$player]['stats']['ribbons']['r15']['img_small'];
                    
    $stats[$i]['ribbonscountr15']       = $data['list'][$player]['stats']['ribbons']['r15']['count'];                               
                    
    $stats[$i]['ribbonsnamer15']        = $data['list'][$player]['stats']['ribbons']['r15']['name'];
                    
    $stats[$i]['ribbonsimgr16']         = $data['list'][$player]['stats']['ribbons']['r16']['img_small'];
                    
    $stats[$i]['ribbonscountr16']       = $data['list'][$player]['stats']['ribbons']['r16']['count'];
                    
    $stats[$i]['ribbonsnamer16']        = $data['list'][$player]['stats']['ribbons']['r16']['name'];
                    
    $stats[$i]['ribbonsimgr17']         = $data['list'][$player]['stats']['ribbons']['r17']['img_small'];
                    
    $stats[$i]['ribbonscountr17']       = $data['list'][$player]['stats']['ribbons']['r17']['count'];
                    
    $stats[$i]['ribbonsnamer17']        = $data['list'][$player]['stats']['ribbons']['r17']['name'];
                    
    $stats[$i]['ribbonsimgr18']         = $data['list'][$player]['stats']['ribbons']['r18']['img_small'];
                    
    $stats[$i]['ribbonscountr18']       = $data['list'][$player]['stats']['ribbons']['r18']['count'];
                    
    $stats[$i]['ribbonsnamer18']        = $data['list'][$player]['stats']['ribbons']['r18']['name'];
                    
    $stats[$i]['ribbonsimgr19']         = $data['list'][$player]['stats']['ribbons']['r19']['img_small'];
                    
    $stats[$i]['ribbonscountr19']       = $data['list'][$player]['stats']['ribbons']['r19']['count'];
                    
    $stats[$i]['ribbonsnamer19']        = $data['list'][$player]['stats']['ribbons']['r19']['name'];
                    
    $stats[$i]['ribbonsimgr20']         = $data['list'][$player]['stats']['ribbons']['r20']['img_small'];
                    
    $stats[$i]['ribbonscountr20']       = $data['list'][$player]['stats']['ribbons']['r20']['count'];
                    
    $stats[$i]['ribbonsnamer20']        = $data['list'][$player]['stats']['ribbons']['r20']['name'];
                    
    $stats[$i]['ribbonsimgr21']         = $data['list'][$player]['stats']['ribbons']['r21']['img_small'];
                    
    $stats[$i]['ribbonscountr21']       = $data['list'][$player]['stats']['ribbons']['r21']['count'];
                    
    $stats[$i]['ribbonsnamer21']        = $data['list'][$player]['stats']['ribbons']['r21']['name'];
                    
    $stats[$i]['ribbonsimgr22']         = $data['list'][$player]['stats']['ribbons']['r22']['img_small'];
                    
    $stats[$i]['ribbonscountr22']       = $data['list'][$player]['stats']['ribbons']['r22']['count'];
                    
    $stats[$i]['ribbonsnamer22']        = $data['list'][$player]['stats']['ribbons']['r22']['name'];
                    
    $stats[$i]['ribbonsimgr23']         = $data['list'][$player]['stats']['ribbons']['r23']['img_small'];
                    
    $stats[$i]['ribbonscountr23']       = $data['list'][$player]['stats']['ribbons']['r23']['count'];                               
                    
    $stats[$i]['ribbonsnamer23']        = $data['list'][$player]['stats']['ribbons']['r23']['name'];
                    
    $stats[$i]['ribbonsimgr25']         = $data['list'][$player]['stats']['ribbons']['r25']['img_small'];
                    
    $stats[$i]['ribbonscountr25']       = $data['list'][$player]['stats']['ribbons']['r25']['count'];
                    
    $stats[$i]['ribbonsnamer25']        = $data['list'][$player]['stats']['ribbons']['r25']['name'];
                    
    $stats[$i]['ribbonsimgr27']         = $data['list'][$player]['stats']['ribbons']['r27']['img_small'];
                    
    $stats[$i]['ribbonscountr27']       = $data['list'][$player]['stats']['ribbons']['r27']['count'];
                    
    $stats[$i]['ribbonsnamer27']        = $data['list'][$player]['stats']['ribbons']['r27']['name'];
                    
    $stats[$i]['ribbonsimgr31']         = $data['list'][$player]['stats']['ribbons']['r31']['img_small'];
                    
    $stats[$i]['ribbonscountr31']       = $data['list'][$player]['stats']['ribbons']['r31']['count'];
                    
    $stats[$i]['ribbonsnamer31']        = $data['list'][$player]['stats']['ribbons']['r31']['name'];
                    
    $stats[$i]['ribbonsimgr32']         = $data['list'][$player]['stats']['ribbons']['r32']['img_small'];
                    
    $stats[$i]['ribbonscountr32']       = $data['list'][$player]['stats']['ribbons']['r32']['count'];
                    
    $stats[$i]['ribbonsnamer32']        = $data['list'][$player]['stats']['ribbons']['r32']['name'];
                    
    $stats[$i]['ribbonsimgr40']         = $data['list'][$player]['stats']['ribbons']['r40']['img_small'];
                    
    $stats[$i]['ribbonscountr40']       = $data['list'][$player]['stats']['ribbons']['r40']['count'];
                    
    $stats[$i]['ribbonsnamer40']        = $data['list'][$player]['stats']['ribbons']['r40']['name'];
                    
    $stats[$i]['ribbonsimgr41']         = $data['list'][$player]['stats']['ribbons']['r41']['img_small'];
                    
    $stats[$i]['ribbonscountr41']       = $data['list'][$player]['stats']['ribbons']['r41']['count'];
                    
    $stats[$i]['ribbonsnamer41']        = $data['list'][$player]['stats']['ribbons']['r41']['name'];
                    
    $stats[$i]['ribbonsimgr43']         = $data['list'][$player]['stats']['ribbons']['r43']['img_small'];
                    
    $stats[$i]['ribbonscountr43']       = $data['list'][$player]['stats']['ribbons']['r43']['count'];
                    
    $stats[$i]['ribbonsnamer43']        = $data['list'][$player]['stats']['ribbons']['r43']['name'];
                    
    $stats[$i]['spm']                   = $data['list'][$player]['stats']['global']['time'];
                    
    $stats[$i]['last-update']           = date('d.m.y - H:i',$data['list'][$player]['stats']['date_check']); 
                    
    $stats[$i]['rankimg1']              = $data['list'][$player]['stats']['rank']['img_medium']; 
                    
    $stats[$i]['rankimg']               = $data['list'][$player]['stats']['rank']['img_tiny'];  
                    
    $stats[$i]['time']                  = $data['list'][$player]['stats']['global']['time'];
                    
    $stats[$i]['kills']                 = $data['list'][$player]['stats']['global']['kills'];
                    
    $stats[$i]['deaths']                = $data['list'][$player]['stats']['global']['deaths'];
                    
    $stats[$i]['skill']                 = $data['list'][$player]['stats']['global']['elo'];
                    
    $stats[$i]['score']                 = $data['list'][$player]['stats']['scores']['score'];
                    
    $stats[$i]['team']                  = $data['list'][$player]['stats']['scores']['team'];
                    
    $stats[$i]['dogtags']               = $data['list'][$player]['stats']['global']['dogtags'];
                    
    $stats[$i]['longesths']             = $data['list'][$player]['stats']['global']['longesths'];
                    
    $stats[$i]['wins']                  = $data['list'][$player]['stats']['global']['wins'];
                    
    $stats[$i]['losses']                = $data['list'][$player]['stats']['global']['losses'];
                    
    $stats[$i]['kits']                  = array();
                    
    $stats[$i]['progress']              = round(($data['list'][$player]['stats']['scores']['score']-$data['list'][$player]['stats']['rank']['score'])/($data['list'][$player]['stats']['nextranks']['0']['score']-$data['list'][$player]['stats']['rank']['score'])*100,0);
                    
    $stats[$i]['kits'][]                = array('name' => 'assault',     'time' => $data['list'][$player]['stats']['kits']['assault']['time']);
                    
    $stats[$i]['kits'][]                = array('name' => 'engineer',     'time' => $data['list'][$player]['stats']['kits']['engineer']['time']);
                    
    $stats[$i]['kits'][]                = array('name' => 'recon',     'time' => $data['list'][$player]['stats']['kits']['recon']['time']);
                    
    $stats[$i]['kits'][]                = array('name' => 'support',     'time' => $data['list'][$player]['stats']['kits']['support']['time']);
                    
    $stats[$i]['killassists']           = $data['list'][$player]['stats']['global']['killassists'];
                    
    $stats[$i]['revives']               = $data['list'][$player]['stats']['global']['revives'];
                    
    $stats[$i]['resupplies']            = $data['list'][$player]['stats']['global']['resupplies'];
                    
    $stats[$i]['heals']                 = $data['list'][$player]['stats']['global']['heals'];
                    
    $stats[$i]['headshots']             = $data['list'][$player]['stats']['global']['headshots'];
                    
    $stats[$i]['award']                 = $data['list'][$player]['stats']['scores']['award'];
                    
    $stats[$i]['bonus']                 = $data['list'][$player]['stats']['scores']['bonus'];
                    
    $stats[$i]['unlock']                = $data['list'][$player]['stats']['scores']['unlock'];
                    
    $stats[$i]['support']               = $data['list'][$player]['stats']['scores']['support'];
                    
    $stats[$i]['assault']               = $data['list'][$player]['stats']['scores']['assault'];
                    
    $stats[$i]['recon']                 = $data['list'][$player]['stats']['scores']['recon'];
                    
    $stats[$i]['engineer']              = $data['list'][$player]['stats']['scores']['engineer'];
                    
    $stats[$i]['scorecoop']             = $data['list'][$player]['stats']['coop']['score'];
                    
    $stats[$i]['vehicleall']            = $data['list'][$player]['stats']['scores']['vehicleall'];
                    
    $stats[$i]['scorecoop']             = $data['list'][$player]['stats']['coop']['score'];
                    
    $stats[$i]['killstreakbonus']       = $data['list'][$player]['stats']['global']['killstreakbonus'];
                    
    $stats[$i]['squad']                 = $data['list'][$player]['stats']['scores']['squad'];
                    
    $stats[$i]['objective']             = $data['list'][$player]['stats']['scores']['objective'];
                    
    $stats[$i]['shots']                 = $data['list'][$player]['stats']['global']['shots'];
                    
    $stats[$i]['hits']                  = $data['list'][$player]['stats']['global']['hits'];
                    
    $stats[$i]['vehiclekills']          = $data['list'][$player]['stats']['global']['vehiclekills'];
                    
    $stats[$i]['vehicledestroyassist']  = $data['list'][$player]['stats']['global']['vehicledestroyassist'];
                    
    $stats[$i]['killassists']           = $data['list'][$player]['stats']['global']['killassists'];
                    
    $stats[$i]['damagaassisits']        = $data['list'][$player]['stats']['global']['damagassists'];
                    
    $stats[$i]['avengerkills']          = $data['list'][$player]['stats']['global']['avengerkills'];
                    
    $stats[$i]['saviorkills']           = $data['list'][$player]['stats']['global']['saviorkills'];
                    
    $stats[$i]['nemesiskills']          = $data['list'][$player]['stats']['global']['nemesiskills'];
                    
    $stats[$i]['resupplies']            = $data['list'][$player]['stats']['global']['resupplies'];
                    
    $stats[$i]['revives']               = $data['list'][$player]['stats']['global']['revives'];
                    
    $stats[$i]['heals']                 = $data['list'][$player]['stats']['global']['heals'];
                    
    $stats[$i]['repairs']               = $data['list'][$player]['stats']['global']['repairs'];
                    
    $stats[$i]['vehicleah']             = $data['list'][$player]['stats']['scores']['vehicleah'];
                    
    $stats[$i]['vehicleifv']            = $data['list'][$player]['stats']['scores']['vehicleifv'];
                    
    $stats[$i]['vehiclejet']            = $data['list'][$player]['stats']['scores']['vehiclejet'];
                    
    $stats[$i]['vehiclembt']            = $data['list'][$player]['stats']['scores']['vehiclembt'];            
                    
    $stats[$i]['knife']                = $data['list'][$player]['stat'][c_wasK__kwa_g];
                   
                   
                   
                    
    // Work out which is the most used kit                
                    
    usort($stats[$i]['kits'], 'sortKits');
                    
                    
    $stats[$i]['class']     = $stats[$i]['kits'][0]['name'];
                    
                    
    $i++;
                }
            }
        }
        
        
    // Order players based on score
        
    usort($stats'sortPlayers');


    ?>
    <center>

    <table cellpadding="8" cellspacing="1" style="border-850px:fixed; font-size:12px; font-family:arial,helvetica,sans-serif;">

           <thead>
                <tr>
                  <th style="color:#000000; font-size:12px; background-color:#CCCCCC;">#</th>
                  <th style="color:#000000; font-size:12px; background-color:#CCCCCC; width:160px;">Player</th>
                  <th style="color:#000000; font-size:12px; background-color:#CCCCCC;">Rank</th>
                  <th style="color:#000000; font-size:12px; background-color:#CCCCCC;">Progress</th>
                  <th style="color:#000000; font-size:12px; background-color:#CCCCCC;">Score</th>
                  <th style="color:#000000; font-size:12px; background-color:#CCCCCC;">Win/Loss</th>
                  <th style="color:#000000; font-size:12px; background-color:#CCCCCC;">W/L Ratio</th>
                  <th style="color:#000000; font-size:12px; background-color:#CCCCCC;">Kills/Deaths</th>
                  <th style="color:#000000; font-size:12px; background-color:#CCCCCC;">K/D Ratio</th>
                  <th style="color:#000000; font-size:12px; background-color:#CCCCCC;">Skill</th>
                  <th style="color:#000000; font-size:12px; background-color:#CCCCCC;">Time</th>
                  <th style="color:#000000; font-size:12px; background-color:#CCCCCC;">Dogtags</th>
                  <th style="color:#000000; font-size:12px; background-color:#CCCCCC;">HeadShots</th>
                  <th style="color:#000000; font-size:12px; background-color:#CCCCCC;">Long. HS</th>
                  <th style="color:#000000; font-size:12px; background-color:#CCCCCC;">Knife kills</th>
                </tr>
            </thead>
        
            <tbody>
           
            <?
            
    for($out 0$out count($stats); $out++):
                
    $pos $out 1?>
                                    </td>

                 

          <td align="center" bgcolor="#666666" class="first"><?=$pos?></td>
                  
                       
            <td bgcolor="#666666" class="soldier">
                               <img src="./flags/<?=$stats[$out]['country_name']?>.png" alt="<?=$stats[$out]['country']?>" />
                       <img src="./kits/<?=$stats[$out]['class']?>.png" alt="" />
                                                            

    <a href="http://bf3stats.com/stats_pc/<?=$stats[$out]['name']?>" target="_blank" onmousemove="ShowContent('uniquename<?=$out?>'); return true;" onmouseover=
    "ShowContent('uniquename<?=$out?>'); return true;" onmouseout="HideContent('uniquename<?=$out?>'); return true;" href="javascript:ShowContent('uniquename<?=
    $out?>
    ')">

        <font size="1" color="cccccc"><?=$stats[$out]['name']?></font></a></td>
                    
        <div id="uniquename<?=$out?>" style="display:none; position:fixed;  float:left; border-style:solid; border-width:1px; background-color:#000000; padding:2px; width:700; height:485;">
                    
        <img src="<?=$stats[$out]['rankimg1']?>" ALIGN="left" alt="<?=$stats[$out]['rank']?>" /> <br>

        <font size="5" color="ececec" style="font-family:arial,helvetica,sans-serif; float:left;"><?=$stats[$out]['name']?></font><br><br>
        <font size="1" color="999999" style="font-family:arial,helvetica,sans-serif; float:left;"><?=$stats[$out]['name1']?></font><br>



    <div class="floatleft" style="background-color:#242424; height:360; border:none; font-family:arial,helvetica,sans-serif; background-color:#242424;">
            <p align="left">
                <font size="1" color="999999">General Score: </font> 
                <font size="1" color="ececec"><?=$stats[$out]['score']?></font><br>
                <font size="1" color="999999">Objective Score: </font> 
                <font size="1" color="ececec"><?=$stats[$out]['objective']?></font><br>
                <font size="1" color="999999">Squad Score: </font>
                <font size="1" color="ececec"><?=$stats[$out]['squad']?></font><br>
                <font size="1" color="999999">Unlocks: </font>
                <font size="1" color="ececec"><?=round($stats[$out]['unlock'])?></font><br>
                <font size="1" color="999999">Bonus: </font>
                <font size="1" color="ececec"><?=round($stats[$out]['bonus'])?></font><br>
                <font size="1" color="999999">Awards: </font>
                <font size="1" color="ececec"><?=round($stats[$out]['award'])?></font><br>
                <font size="1" color="999999">Support: </font>
                <font size="1" color="ececec"><?=round($stats[$out]['support'])?></font><br>
                <font size="1" color="999999">Assault: </font>
                <font size="1" color="ececec"><?=round($stats[$out]['assault'])?></font><br>
                <font size="1" color="999999">Recon: </font>
                <font size="1" color="ececec"><?=round($stats[$out]['recon'])?></font><br>
                <font size="1" color="999999">Engineer: </font> 
                <font size="1" color="ececec"><?=round($stats[$out]['engineer'])?></font><br>
                <font size="1" color="999999">Vehicle Score: </font> 
                <font size="1" color="ececec"><?=($stats[$out]['vehicleall'])?></font><br>
                <font size="1" color="999999">All Vehicle Kills: </font> 
                <font size="1" color="ececec"><?=$stats[$out]['vehiclekills']?></font><br>
                <font size="1" color="999999">Attack Heli Score: </font> 
                <font size="1" color="ececec"><?=($stats[$out]['vehicleah'])?></font><br>
                <font size="1" color="999999">Ifv Score: </font> 
                <font size="1" color="ececec"><?=$stats[$out]['vehicleifv']?></font><br>
                <font size="1" color="999999">Jet Score: </font> 
                <font size="1" color="ececec"><?=$stats[$out]['vehiclejet']?></font><br>
                <font size="1" color="999999">Mbt Score: </font> 
                <font size="1" color="ececec"><?=$stats[$out]['vehiclembt']?></font><br>
                <font size="1" color="999999">Shots Fired: </font>
                <font size="1" color="ececec"><?=$stats[$out]['shots']?></font><br>
                <font size="1" color="999999">Total Hits: </font>
                <font size="1" color="ececec"><?=round($stats[$out]['hits'])?></font><br>
                <font size="1" color="999999">Kill Assists: </font>
                <font size="1" color="ececec"><?=round($stats[$out]['killassists'])?></font><br>
                <font size="1" color="999999">Revives: </font>
                <font size="1" color="ececec"><?=round($stats[$out]['revives'])?></font><br>
                <font size="1" color="999999">Resupplies: </font>
                <font size="1" color="ececec"><?=round($stats[$out]['resupplies'])?></font><br>
                <font size="1" color="999999">Heals: </font>
                <font size="1" color="ececec"><?=round($stats[$out]['heals'])?></font><br>
                <font size="1" color="999999">Repairs: </font>
                <font size="1" color="ececec"><?=round($stats[$out]['repairs'])?></font><br>
                          
            </p>
        </div><br />

    <div class="floatleft">                     
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=$stats[$out]['ribbonsname']?></font>
        <font size="1" color="000000" style="font-family:arial,helvetica,sans-serif;"><b>MVP</b></font><br> <img src="./<?=$stats[$out]['ribbonsimgr16']?>" /><br>
        <font size="1" color="FF3300" style="font-family:arial,helvetica,sans-serif;"><?=round($stats[$out]['ribbonscountr16'])?></font><br><br>
         
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=$stats[$out]['ribbonsname']?></font>
        <font size="1" color="000000" style="font-family:arial,helvetica,sans-serif;"><b>MVP 2</b></font><br> <img src="./<?=$stats[$out]['ribbonsimgr17']?>" /><br>
        <font size="1" color="FF3300" style="font-family:arial,helvetica,sans-serif;"><?=round($stats[$out]['ribbonscountr17'])?></font><br>
           
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=$stats[$out]['ribbonsname']?></font><br>
        <font size="1" color="000000" style="font-family:arial,helvetica,sans-serif;"><b>MVP 3</b></font><br> <img src="./<?=$stats[$out]['ribbonsimgr18']?>" /><br>
        <font size="1" color="FF3300" style="font-family:arial,helvetica,sans-serif;"><?=round($stats[$out]['ribbonscountr18'])?></font><br><br>
         
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=$stats[$out]['ribbonsname']?></font>
        <font size="1" color="000000" style="font-family:arial,helvetica,sans-serif;"><b>ACE SQUAD</b></font><br> <img src="./<?=$stats[$out]['ribbonsimgr19']?>" /><br>
        <font size="1" color="FF3300" style="font-family:arial,helvetica,sans-serif;"><?=round($stats[$out]['ribbonscountr19'])?></font>                          
        </p>
        
        </div>
        <div class="floatleft">                     
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=$stats[$out]['ribbonsname']?></font>
        <font size="1" color="000000" style="font-family:arial,helvetica,sans-serif;"><b>TDM</b></font><br> <img src="./<?=$stats[$out]['ribbonsimgr32']?>" /><br>
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=round($stats[$out]['ribbonscountr32'])?></font><br><br>
         
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=$stats[$out]['ribbonsname']?></font>
        <font size="1" color="000000" style="font-family:arial,helvetica,sans-serif;"><b>CONQUEST</b></font><br> <img src="./<?=$stats[$out]['ribbonsimgr31']?>" /><br>
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=round($stats[$out]['ribbonscountr31'])?></font><br>
           
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=$stats[$out]['ribbonsname']?></font><br>
        <font size="1" color="000000" style="font-family:arial,helvetica,sans-serif;"><b>ATTACK</b></font><br> <img src="./<?=$stats[$out]['ribbonsimgr40']?>" /><br>
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=round($stats[$out]['ribbonscountr40'])?></font><br><br>
         
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=$stats[$out]['ribbonsname']?></font>
        <font size="1" color="000000" style="font-family:arial,helvetica,sans-serif;"><b>DEFEND</b></font><br> <img src="./<?=$stats[$out]['ribbonsimgr41']?>" /><br>
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=round($stats[$out]['ribbonscountr41'])?></font>                          
        </p>
        
        </div>
        <div class="floatleft">                     
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=$stats[$out]['ribbonsname']?></font>
        <font size="1" color="000000" style="font-family:arial,helvetica,sans-serif;"><b>AVENGER</b></font><br> <img src="./<?=$stats[$out]['ribbonsimgr12']?>" /><br>
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=round($stats[$out]['ribbonscountr12'])?></font><br><br>
         
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=$stats[$out]['ribbonsname']?></font>
        <font size="1" color="000000" style="font-family:arial,helvetica,sans-serif;"><b>SAVIOR</b></font><br> <img src="./<?=$stats[$out]['ribbonsimgr13']?>" /><br>
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=round($stats[$out]['ribbonscountr13'])?></font><br>
           
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=$stats[$out]['ribbonsname']?></font><br>
        <font size="1" color="000000" style="font-family:arial,helvetica,sans-serif;"><b>NEMESIS</b></font><br> <img src="./<?=$stats[$out]['ribbonsimgr14']?>" /><br>
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=round($stats[$out]['ribbonscountr14'])?></font><br><br>
         
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=$stats[$out]['ribbonsname']?></font>
        <font size="1" color="000000" style="font-family:arial,helvetica,sans-serif;"><b>SQUAD WIPE</b></font><br> <img src="./<?=$stats[$out]['ribbonsimgr23']?>" /><br>
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=round($stats[$out]['ribbonscountr23'])?></font>                          
        </p>
        
        </div>
        <div class="floatleft">                     
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=$stats[$out]['ribbonsname']?></font>
        <font size="1" color="000000" style="font-family:arial,helvetica,sans-serif;"><b>ACCURACY</b></font><br> <img src="./<?=$stats[$out]['ribbonsimgr11']?>" /><br>
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=round($stats[$out]['ribbonscountr11'])?></font><br><br>
         
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=$stats[$out]['ribbonsname']?></font>
        <font size="1" color="000000" style="font-family:arial,helvetica,sans-serif;"><b>SURPRESSION</b></font><br> <img src="./<?=$stats[$out]['ribbonsimgr15']?>" /><br>
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=round($stats[$out]['ribbonscountr15'])?></font><br>
           
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=$stats[$out]['ribbonsname']?></font><br>
        <font size="1" color="000000" style="font-family:arial,helvetica,sans-serif;"><b>MAINTANANCE</b></font><br> <img src="./<?=$stats[$out]['ribbonsimgr43']?>" /><br>
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=round($stats[$out]['ribbonscountr43'])?></font><br><br>
         
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=$stats[$out]['ribbonsname']?></font>
        <font size="1" color="000000" style="font-family:arial,helvetica,sans-serif;"><b>EFFICENCY</b></font><br> <img src="./<?=$stats[$out]['ribbonsimgr20']?>" /><br>
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=round($stats[$out]['ribbonscountr20'])?></font>                          
        </p>
        
        </div>
        <div class="floatleft">                     
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=$stats[$out]['ribbonsname']?></font>
        <font size="1" color="000000" style="font-family:arial,helvetica,sans-serif;"><b>ANTI VEHICLE</b></font><br> <img src="./<?=$stats[$out]['ribbonsimgr10']?>" /><br>
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=round($stats[$out]['ribbonscountr10'])?></font><br><br>
         
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=$stats[$out]['ribbonsname']?></font>
        <font size="1" color="000000" style="font-family:arial,helvetica,sans-serif;"><b>AIR WARFARE</b></font><br> <img src="./<?=$stats[$out]['ribbonsimgr27']?>" /><br>
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=round($stats[$out]['ribbonscountr27'])?></font><br>
           
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=$stats[$out]['ribbonsname']?></font><br>
        <font size="1" color="000000" style="font-family:arial,helvetica,sans-serif;"><b>ANTI EXPLOSIVE</b></font><br> <img src="./<?=$stats[$out]['ribbonsimgr21']?>" /><br>
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=round($stats[$out]['ribbonscountr21'])?></font><br><br>
         
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=$stats[$out]['ribbonsname']?></font>
        <font size="1" color="000000" style="font-family:arial,helvetica,sans-serif;"><b>TANK WARFARE</b></font><br> <img src="./<?=$stats[$out]['ribbonsimgr25']?>" /><br>
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=round($stats[$out]['ribbonscountr25'])?></font>                          
        </p>
        
        
        
     <td align="center" style="background-color:#666666;">
        <img src="<?=$stats[$out]['rankimg']?>" alt="<?=$stats[$out]['rank']?>" />
    </td>
     
    <td style="width: 50px; background-color:#666666; color:#555555;" title="<?=number_format($stats[$out]['progress'],0,',','.')?> %">
     <p style="border: 1px solid black; width: 55px; background-color: #242424;">
     <span style="background-color: #ff8c00; display: block; padding: 2px; width: <?=number_format($stats[$out]['progress'],0,',','.')?>%">
     </span>
     </p>
     </td>
     </td>
                       
                        
        <td align="center" style="background-color:#666666; color:#cccccc;"><?=number_format($stats[$out]['score'])?></td>
        <td align="center" style="background-color:#666666; color:#cccccc;"><?=number_format($stats[$out]['wins'])?> / <?=number_format($stats[$out]['losses'])?></td>
        <td align="center" style="background-color:#666666; color:#cccccc;"><?=round($stats[$out]['wins']/$stats[$out]['losses'], 2)?></td>
        <td align="center" style="background-color:#666666; color:#cccccc;"><?=number_format($stats[$out]['kills'])?> / <?=number_format($stats[$out]['deaths'])?></td>
        <td align="center" style="background-color:#666666; color:#cccccc;""><?=$stats[$out]['ranktest']?></td>
        <td align="center" style="background-color:#666666; color:#cccccc;"><?=round($stats[$out]['skill'])?></td>  
        <td align="center" style="background-color:#666666; color:#cccccc;"><?=sec2hms($stats[$out]['time'])?>h</td>
        <td align="center" style="background-color:#666666; color:#cccccc;"><?=round($stats[$out]['dogtags'])?></td>
        <td align="center" style="background-color:#666666; color:#cccccc;"><?=round($stats[$out]['headshots'])?></td>
        <td align="center" style="background-color:#666666; color:#cccccc;"><?=round($stats[$out]['longesths'])?> m</td>
        <td align="center" style="background-color:#666666; color:#cccccc;"><?=number_format($stats[$out]['knife'],'','','.')?></td> 



     </tr>      
            <?
            
    endfor; ?>
                    
            </tbody>
        </table>  
        
    </center>


        <?
        
    // If you add ?debug=1 to the end of your script URL in the browser you can see what data is returned
        
    if(isset($_GET['debug']))
        {
            echo 
    '<pre>';
                
    print_r($data);
            echo 
    '</pre>';
        }    

    else 
    {
        echo 
    'Error contacting API status code: '.$statusCode;
    }

    // Lets dump our functions down here, these would be better in a seperate include though

    function sortKits($x$y)
    {
        if(
    $x['time'] == $y['time'])
        {
            return 
    0;
        }
        elseif(
    $x['time'] < $y['time'])
        {
            return 
    1;
        }
        else
        {
            return -
    1;
        }
    }

    function 
    sortPlayers($x$y)
    {
        if(
    $x['score'] == $y['score'])
        {
            return 
    0;
        }
        elseif(
    $x['score'] < $y['score'])
        {
            return 
    1;
        }
        else
        {
            return -
    1;
        }
    }

    // Convert seconds to hours
    function sec2hms($sec$padHours false
    {
        
    $hms     "";
        
    $hours     intval(intval($sec) / 3600); 
        
    $hms     .= ($padHours)? str_pad($hours2"0"STR_PAD_LEFT). ':' $hours;    
        return 
    $hms;
    }
    ?>

  19. #139
    New User
    Join Date
    2012-04-14
    Posts
    5

    Re: AW: Re: API PHP example with table output

    Quote Originally Posted by ZA Tony View Post
    Hi ekoman,
    wo willste die denn hinhaben?
    Hinter "Long. HS" vielleicht?
    Ja, super


    Quote Originally Posted by ZA Tony View Post
    Bitte schön. sollte so funktionieren, habe es mal hier ausprobiert.
    http://zockanstalt.de/index.php?opti...per&Itemid=313


    PHP Code:


    <link rel="stylesheet" type="text/css" href="./css/bf3.css">
    <script type="text/javascript" language="JavaScript">
    <!-- Copyright 2006,2007 Bontrager Connection, LLC
    // http://bontragerconnection.com/ and http://www.willmaster.com/
    // Version: July 28, 2007
    // javascript for floating table at mouse position
    var cX = 0; var cY = 0; var rX = 0; var rY = 0;
    function UpdateCursorPosition(e){ cX = e.pageX; cY = e.pageY;}
    function UpdateCursorPositionDocAll(e){ cX = event.clientX; cY = event.clientY;}
    if(document.all) { document.onmousemove = UpdateCursorPositionDocAll; }
    else { document.onmousemove = UpdateCursorPosition; }
    function AssignPosition(d) {
    if(self.pageYOffset) {
        rX = self.pageXOffset;
        rY = self.pageYOffset;
        }
    else if(document.documentElement && document.documentElement.scrollMiddle) {
        rX = document.documentElement.scrollLeft;
        rY = document.documentElement.scrollMiddle;
        }
    else if(document.body) {
        rX = document.body.scrollLeft;
        rY = document.body.scrollMiddle;
        }
    if(document.all) {
        cX += rX; 
        cY += rY;
        }
    d.style.left = (cX+10) + "px";
    d.style.middle = (cY+10) + "px";
    }
    function HideContent(d) {
    if(d.length < 1) { return; }
    document.getElementById(d).style.display = "none";
    }
    function ShowContent(d) {
    if(d.length < 1) { return; }
    var dd = document.getElementById(d);
    AssignPosition(dd);
    dd.style.display = "block";
    }
    function ReverseContentDisplay(d) {
    if(d.length < 1) { return; }
    var dd = document.getElementById(d);
    AssignPosition(dd);
    if(dd.style.display == "none") { dd.style.display = "block"; }
    else { dd.style.display = "none"; }
    }
    //-->
    </script>


    <?php


    $playerData 
    = array('players' => array(), 'opt' => array());

    // Our list of players


    $playerData['players'][]        = 'ekomanic';
    $playerData['players'][]         = 'Blumentopp';
    $playerData['players'][]         = 'tron0071';
    $playerData['players'][]         = 'AndyGrenzen';
    $playerData['players'][]         = 'Faultierchief';
    $playerData['players'][]         = 'darkdever';
    $playerData['players'][]         = 'LtCmdr85';
    $playerData['players'][]         = 'dont4get-murdock';
    $playerData['players'][]         = 'mehdi2109';
    $playerData['players'][]         = 'DopplerWobble';
    $playerData['players'][]         = 'VY_CanisMajoris1';
    $playerData['players'][]         = 'YoShIs_ReVeNgE';


    /* In this example we want as little information to come back from the API as possible.
    ** Therefore we are calling the "clear" function, which means we need to manually enable
    ** each stat group we need. This will help keep the size of the response down, and therefore execution time.
    */
    $playerData['opt']['clear']        = true;

    // Data we want to be returned
    $playerdata['opt']['all']      = true;
    $playerData['opt']['global']    = true;
    $playerData['opt']['nextranks']    = true;
    $playerData['opt']['rank']        = true;
    $playerData['opt']['kits']        = true;
    $playerData['opt']['scores']    = true;
    $playerData['opt']['imgInfo']    = true;
    $playerData['opt']['awards']    = true;
    $playerdata['opt']['awardsInfo']  = true;
    $playerdata['opt']['awardsAwarded']      = true;
    $playerData['opt']['ribbons']    = true;
    $playerData['opt']['medals']    = true;
    $playerData['opt']['raw']    = true;
    $playerData['opt']['nozero']    = true;
    $playerData['opt']['coop']    = true;
    $playerdata['opt']['coopInfo']  = true;
    $playerdata['opt']['coopimg']      = true;


    // Convert lists to JSON ready for the curl post request
    $postData                        = array();
    $postData['players']            = json_encode($playerData['players']);
    $postData['opt']                = json_encode($playerData['opt']);

    // This example hardcodes "pc" players
    $c curl_init('http://api.bf3stats.com/pc/playerlist/');
    curl_setopt($cCURLOPT_HEADERfalse);
    curl_setopt($cCURLOPT_POSTtrue);
    curl_setopt($cCURLOPT_USERAGENT'BF3StatsAPI/0.1');
    curl_setopt($cCURLOPT_HTTPHEADER, array('Expect:'));
    curl_setopt($cCURLOPT_RETURNTRANSFERtrue);
    curl_setopt($cCURLOPT_POSTFIELDS$postData);
    $response      curl_exec($c);
    $statusCode    curl_getinfo($cCURLINFO_HTTP_CODE);
    curl_close($c);

    // 200 means a successful call
    if($statusCode == 200
    {
        
    // Decode JSON Data into an array we can easily parse
        
    $data json_decode($responsetrue);
        
        
    // Counter for our players array
        
    $i 0;
        
        
    // Loop through each of our players we set above and see what data we have for them
        
    foreach($playerData['players'] AS $player)
        {
            
    // Does this player exist in the returned data?
            
    if(isset($data['list'][$player]))
            {
                
    // This checks to see if the player actually has any stats yet on the site
                
    if($data['list'][$player]['status'] == "data")
                {
                    
    $stats[$i]['name']                  = $data['list'][$player]['name'];
                    
    $stats[$i]['country_name']          = $data['list'][$player]['country'];
                    
    $stats[$i]['rank']                  = $data['list'][$player]['stats']['rank']['nr'];
                    
    $stats[$i]['ranktest']              = $data['list'][$player]['stat']['kdr'];
                    
    $stats[$i]['rank2']                 = $data['list'][$player]['stats']['rank']['img_info'];
                    
    $stats[$i]['name1']                 = $data['list'][$player]['stats']['rank']['name'];
                    
    $stats[$i]['ribbonsimgr10']         = $data['list'][$player]['stats']['ribbons']['r10']['img_small'];
                    
    $stats[$i]['ribbonscountr10']       = $data['list'][$player]['stats']['ribbons']['r10']['count'];
                    
    $stats[$i]['ribbonsnamer10']        = $data['list'][$player]['stats']['ribbons']['r10']['name'];
                    
    $stats[$i]['ribbonsimgr11']         = $data['list'][$player]['stats']['ribbons']['r11']['img_small'];
                    
    $stats[$i]['ribbonscountr11']       = $data['list'][$player]['stats']['ribbons']['r11']['count'];
                    
    $stats[$i]['ribbonsnamer11']        = $data['list'][$player]['stats']['ribbons']['r11']['name'];
                    
    $stats[$i]['ribbonsimgr12']         = $data['list'][$player]['stats']['ribbons']['r12']['img_small'];
                    
    $stats[$i]['ribbonscountr12']       = $data['list'][$player]['stats']['ribbons']['r12']['count'];
                    
    $stats[$i]['ribbonsnamer12']        = $data['list'][$player]['stats']['ribbons']['r12']['name'];
                    
    $stats[$i]['ribbonsimgr13']         = $data['list'][$player]['stats']['ribbons']['r13']['img_small'];
                    
    $stats[$i]['ribbonscountr13']       = $data['list'][$player]['stats']['ribbons']['r13']['count'];
                    
    $stats[$i]['ribbonsnamer13']        = $data['list'][$player]['stats']['ribbons']['r13']['name'];
                    
    $stats[$i]['ribbonsimgr14']         = $data['list'][$player]['stats']['ribbons']['r14']['img_small'];
                    
    $stats[$i]['ribbonscountr14']       = $data['list'][$player]['stats']['ribbons']['r14']['count'];
                    
    $stats[$i]['ribbonsnamer14']        = $data['list'][$player]['stats']['ribbons']['r14']['name'];
                    
    $stats[$i]['ribbonsimgr15']         = $data['list'][$player]['stats']['ribbons']['r15']['img_small'];
                    
    $stats[$i]['ribbonscountr15']       = $data['list'][$player]['stats']['ribbons']['r15']['count'];                               
                    
    $stats[$i]['ribbonsnamer15']        = $data['list'][$player]['stats']['ribbons']['r15']['name'];
                    
    $stats[$i]['ribbonsimgr16']         = $data['list'][$player]['stats']['ribbons']['r16']['img_small'];
                    
    $stats[$i]['ribbonscountr16']       = $data['list'][$player]['stats']['ribbons']['r16']['count'];
                    
    $stats[$i]['ribbonsnamer16']        = $data['list'][$player]['stats']['ribbons']['r16']['name'];
                    
    $stats[$i]['ribbonsimgr17']         = $data['list'][$player]['stats']['ribbons']['r17']['img_small'];
                    
    $stats[$i]['ribbonscountr17']       = $data['list'][$player]['stats']['ribbons']['r17']['count'];
                    
    $stats[$i]['ribbonsnamer17']        = $data['list'][$player]['stats']['ribbons']['r17']['name'];
                    
    $stats[$i]['ribbonsimgr18']         = $data['list'][$player]['stats']['ribbons']['r18']['img_small'];
                    
    $stats[$i]['ribbonscountr18']       = $data['list'][$player]['stats']['ribbons']['r18']['count'];
                    
    $stats[$i]['ribbonsnamer18']        = $data['list'][$player]['stats']['ribbons']['r18']['name'];
                    
    $stats[$i]['ribbonsimgr19']         = $data['list'][$player]['stats']['ribbons']['r19']['img_small'];
                    
    $stats[$i]['ribbonscountr19']       = $data['list'][$player]['stats']['ribbons']['r19']['count'];
                    
    $stats[$i]['ribbonsnamer19']        = $data['list'][$player]['stats']['ribbons']['r19']['name'];
                    
    $stats[$i]['ribbonsimgr20']         = $data['list'][$player]['stats']['ribbons']['r20']['img_small'];
                    
    $stats[$i]['ribbonscountr20']       = $data['list'][$player]['stats']['ribbons']['r20']['count'];
                    
    $stats[$i]['ribbonsnamer20']        = $data['list'][$player]['stats']['ribbons']['r20']['name'];
                    
    $stats[$i]['ribbonsimgr21']         = $data['list'][$player]['stats']['ribbons']['r21']['img_small'];
                    
    $stats[$i]['ribbonscountr21']       = $data['list'][$player]['stats']['ribbons']['r21']['count'];
                    
    $stats[$i]['ribbonsnamer21']        = $data['list'][$player]['stats']['ribbons']['r21']['name'];
                    
    $stats[$i]['ribbonsimgr22']         = $data['list'][$player]['stats']['ribbons']['r22']['img_small'];
                    
    $stats[$i]['ribbonscountr22']       = $data['list'][$player]['stats']['ribbons']['r22']['count'];
                    
    $stats[$i]['ribbonsnamer22']        = $data['list'][$player]['stats']['ribbons']['r22']['name'];
                    
    $stats[$i]['ribbonsimgr23']         = $data['list'][$player]['stats']['ribbons']['r23']['img_small'];
                    
    $stats[$i]['ribbonscountr23']       = $data['list'][$player]['stats']['ribbons']['r23']['count'];                               
                    
    $stats[$i]['ribbonsnamer23']        = $data['list'][$player]['stats']['ribbons']['r23']['name'];
                    
    $stats[$i]['ribbonsimgr25']         = $data['list'][$player]['stats']['ribbons']['r25']['img_small'];
                    
    $stats[$i]['ribbonscountr25']       = $data['list'][$player]['stats']['ribbons']['r25']['count'];
                    
    $stats[$i]['ribbonsnamer25']        = $data['list'][$player]['stats']['ribbons']['r25']['name'];
                    
    $stats[$i]['ribbonsimgr27']         = $data['list'][$player]['stats']['ribbons']['r27']['img_small'];
                    
    $stats[$i]['ribbonscountr27']       = $data['list'][$player]['stats']['ribbons']['r27']['count'];
                    
    $stats[$i]['ribbonsnamer27']        = $data['list'][$player]['stats']['ribbons']['r27']['name'];
                    
    $stats[$i]['ribbonsimgr31']         = $data['list'][$player]['stats']['ribbons']['r31']['img_small'];
                    
    $stats[$i]['ribbonscountr31']       = $data['list'][$player]['stats']['ribbons']['r31']['count'];
                    
    $stats[$i]['ribbonsnamer31']        = $data['list'][$player]['stats']['ribbons']['r31']['name'];
                    
    $stats[$i]['ribbonsimgr32']         = $data['list'][$player]['stats']['ribbons']['r32']['img_small'];
                    
    $stats[$i]['ribbonscountr32']       = $data['list'][$player]['stats']['ribbons']['r32']['count'];
                    
    $stats[$i]['ribbonsnamer32']        = $data['list'][$player]['stats']['ribbons']['r32']['name'];
                    
    $stats[$i]['ribbonsimgr40']         = $data['list'][$player]['stats']['ribbons']['r40']['img_small'];
                    
    $stats[$i]['ribbonscountr40']       = $data['list'][$player]['stats']['ribbons']['r40']['count'];
                    
    $stats[$i]['ribbonsnamer40']        = $data['list'][$player]['stats']['ribbons']['r40']['name'];
                    
    $stats[$i]['ribbonsimgr41']         = $data['list'][$player]['stats']['ribbons']['r41']['img_small'];
                    
    $stats[$i]['ribbonscountr41']       = $data['list'][$player]['stats']['ribbons']['r41']['count'];
                    
    $stats[$i]['ribbonsnamer41']        = $data['list'][$player]['stats']['ribbons']['r41']['name'];
                    
    $stats[$i]['ribbonsimgr43']         = $data['list'][$player]['stats']['ribbons']['r43']['img_small'];
                    
    $stats[$i]['ribbonscountr43']       = $data['list'][$player]['stats']['ribbons']['r43']['count'];
                    
    $stats[$i]['ribbonsnamer43']        = $data['list'][$player]['stats']['ribbons']['r43']['name'];
                    
    $stats[$i]['spm']                   = $data['list'][$player]['stats']['global']['time'];
                    
    $stats[$i]['last-update']           = date('d.m.y - H:i',$data['list'][$player]['stats']['date_check']); 
                    
    $stats[$i]['rankimg1']              = $data['list'][$player]['stats']['rank']['img_medium']; 
                    
    $stats[$i]['rankimg']               = $data['list'][$player]['stats']['rank']['img_tiny'];  
                    
    $stats[$i]['time']                  = $data['list'][$player]['stats']['global']['time'];
                    
    $stats[$i]['kills']                 = $data['list'][$player]['stats']['global']['kills'];
                    
    $stats[$i]['deaths']                = $data['list'][$player]['stats']['global']['deaths'];
                    
    $stats[$i]['skill']                 = $data['list'][$player]['stats']['global']['elo'];
                    
    $stats[$i]['score']                 = $data['list'][$player]['stats']['scores']['score'];
                    
    $stats[$i]['team']                  = $data['list'][$player]['stats']['scores']['team'];
                    
    $stats[$i]['dogtags']               = $data['list'][$player]['stats']['global']['dogtags'];
                    
    $stats[$i]['longesths']             = $data['list'][$player]['stats']['global']['longesths'];
                    
    $stats[$i]['wins']                  = $data['list'][$player]['stats']['global']['wins'];
                    
    $stats[$i]['losses']                = $data['list'][$player]['stats']['global']['losses'];
                    
    $stats[$i]['kits']                  = array();
                    
    $stats[$i]['progress']              = round(($data['list'][$player]['stats']['scores']['score']-$data['list'][$player]['stats']['rank']['score'])/($data['list'][$player]['stats']['nextranks']['0']['score']-$data['list'][$player]['stats']['rank']['score'])*100,0);
                    
    $stats[$i]['kits'][]                = array('name' => 'assault',     'time' => $data['list'][$player]['stats']['kits']['assault']['time']);
                    
    $stats[$i]['kits'][]                = array('name' => 'engineer',     'time' => $data['list'][$player]['stats']['kits']['engineer']['time']);
                    
    $stats[$i]['kits'][]                = array('name' => 'recon',     'time' => $data['list'][$player]['stats']['kits']['recon']['time']);
                    
    $stats[$i]['kits'][]                = array('name' => 'support',     'time' => $data['list'][$player]['stats']['kits']['support']['time']);
                    
    $stats[$i]['killassists']           = $data['list'][$player]['stats']['global']['killassists'];
                    
    $stats[$i]['revives']               = $data['list'][$player]['stats']['global']['revives'];
                    
    $stats[$i]['resupplies']            = $data['list'][$player]['stats']['global']['resupplies'];
                    
    $stats[$i]['heals']                 = $data['list'][$player]['stats']['global']['heals'];
                    
    $stats[$i]['headshots']             = $data['list'][$player]['stats']['global']['headshots'];
                    
    $stats[$i]['award']                 = $data['list'][$player]['stats']['scores']['award'];
                    
    $stats[$i]['bonus']                 = $data['list'][$player]['stats']['scores']['bonus'];
                    
    $stats[$i]['unlock']                = $data['list'][$player]['stats']['scores']['unlock'];
                    
    $stats[$i]['support']               = $data['list'][$player]['stats']['scores']['support'];
                    
    $stats[$i]['assault']               = $data['list'][$player]['stats']['scores']['assault'];
                    
    $stats[$i]['recon']                 = $data['list'][$player]['stats']['scores']['recon'];
                    
    $stats[$i]['engineer']              = $data['list'][$player]['stats']['scores']['engineer'];
                    
    $stats[$i]['scorecoop']             = $data['list'][$player]['stats']['coop']['score'];
                    
    $stats[$i]['vehicleall']            = $data['list'][$player]['stats']['scores']['vehicleall'];
                    
    $stats[$i]['scorecoop']             = $data['list'][$player]['stats']['coop']['score'];
                    
    $stats[$i]['killstreakbonus']       = $data['list'][$player]['stats']['global']['killstreakbonus'];
                    
    $stats[$i]['squad']                 = $data['list'][$player]['stats']['scores']['squad'];
                    
    $stats[$i]['objective']             = $data['list'][$player]['stats']['scores']['objective'];
                    
    $stats[$i]['shots']                 = $data['list'][$player]['stats']['global']['shots'];
                    
    $stats[$i]['hits']                  = $data['list'][$player]['stats']['global']['hits'];
                    
    $stats[$i]['vehiclekills']          = $data['list'][$player]['stats']['global']['vehiclekills'];
                    
    $stats[$i]['vehicledestroyassist']  = $data['list'][$player]['stats']['global']['vehicledestroyassist'];
                    
    $stats[$i]['killassists']           = $data['list'][$player]['stats']['global']['killassists'];
                    
    $stats[$i]['damagaassisits']        = $data['list'][$player]['stats']['global']['damagassists'];
                    
    $stats[$i]['avengerkills']          = $data['list'][$player]['stats']['global']['avengerkills'];
                    
    $stats[$i]['saviorkills']           = $data['list'][$player]['stats']['global']['saviorkills'];
                    
    $stats[$i]['nemesiskills']          = $data['list'][$player]['stats']['global']['nemesiskills'];
                    
    $stats[$i]['resupplies']            = $data['list'][$player]['stats']['global']['resupplies'];
                    
    $stats[$i]['revives']               = $data['list'][$player]['stats']['global']['revives'];
                    
    $stats[$i]['heals']                 = $data['list'][$player]['stats']['global']['heals'];
                    
    $stats[$i]['repairs']               = $data['list'][$player]['stats']['global']['repairs'];
                    
    $stats[$i]['vehicleah']             = $data['list'][$player]['stats']['scores']['vehicleah'];
                    
    $stats[$i]['vehicleifv']            = $data['list'][$player]['stats']['scores']['vehicleifv'];
                    
    $stats[$i]['vehiclejet']            = $data['list'][$player]['stats']['scores']['vehiclejet'];
                    
    $stats[$i]['vehiclembt']            = $data['list'][$player]['stats']['scores']['vehiclembt'];            
                    
    $stats[$i]['knife']                = $data['list'][$player]['stat'][c_wasK__kwa_g];
                   
                   
                   
                    
    // Work out which is the most used kit                
                    
    usort($stats[$i]['kits'], 'sortKits');
                    
                    
    $stats[$i]['class']     = $stats[$i]['kits'][0]['name'];
                    
                    
    $i++;
                }
            }
        }
        
        
    // Order players based on score
        
    usort($stats'sortPlayers');


    ?>
    <center>

    <table cellpadding="8" cellspacing="1" style="border-850px:fixed; font-size:12px; font-family:arial,helvetica,sans-serif;">

           <thead>
                <tr>
                  <th style="color:#000000; font-size:12px; background-color:#CCCCCC;">#</th>
                  <th style="color:#000000; font-size:12px; background-color:#CCCCCC; width:160px;">Player</th>
                  <th style="color:#000000; font-size:12px; background-color:#CCCCCC;">Rank</th>
                  <th style="color:#000000; font-size:12px; background-color:#CCCCCC;">Progress</th>
                  <th style="color:#000000; font-size:12px; background-color:#CCCCCC;">Score</th>
                  <th style="color:#000000; font-size:12px; background-color:#CCCCCC;">Win/Loss</th>
                  <th style="color:#000000; font-size:12px; background-color:#CCCCCC;">W/L Ratio</th>
                  <th style="color:#000000; font-size:12px; background-color:#CCCCCC;">Kills/Deaths</th>
                  <th style="color:#000000; font-size:12px; background-color:#CCCCCC;">K/D Ratio</th>
                  <th style="color:#000000; font-size:12px; background-color:#CCCCCC;">Skill</th>
                  <th style="color:#000000; font-size:12px; background-color:#CCCCCC;">Time</th>
                  <th style="color:#000000; font-size:12px; background-color:#CCCCCC;">Dogtags</th>
                  <th style="color:#000000; font-size:12px; background-color:#CCCCCC;">HeadShots</th>
                  <th style="color:#000000; font-size:12px; background-color:#CCCCCC;">Long. HS</th>
                  <th style="color:#000000; font-size:12px; background-color:#CCCCCC;">Knife kills</th>
                </tr>
            </thead>
        
            <tbody>
           
            <?
            
    for($out 0$out count($stats); $out++):
                
    $pos $out 1?>
                                    </td>

                 

          <td align="center" bgcolor="#666666" class="first"><?=$pos?></td>
                  
                       
            <td bgcolor="#666666" class="soldier">
                               <img src="./flags/<?=$stats[$out]['country_name']?>.png" alt="<?=$stats[$out]['country']?>" />
                       <img src="./kits/<?=$stats[$out]['class']?>.png" alt="" />
                                                            

    <a href="http://bf3stats.com/stats_pc/<?=$stats[$out]['name']?>" target="_blank" onmousemove="ShowContent('uniquename<?=$out?>'); return true;" onmouseover=
    "ShowContent('uniquename<?=$out?>'); return true;" onmouseout="HideContent('uniquename<?=$out?>'); return true;" href="javascript:ShowContent('uniquename<?=
    $out?>
    ')">

        <font size="1" color="cccccc"><?=$stats[$out]['name']?></font></a></td>
                    
        <div id="uniquename<?=$out?>" style="display:none; position:fixed;  float:left; border-style:solid; border-width:1px; background-color:#000000; padding:2px; width:700; height:485;">
                    
        <img src="<?=$stats[$out]['rankimg1']?>" ALIGN="left" alt="<?=$stats[$out]['rank']?>" /> <br>

        <font size="5" color="ececec" style="font-family:arial,helvetica,sans-serif; float:left;"><?=$stats[$out]['name']?></font><br><br>
        <font size="1" color="999999" style="font-family:arial,helvetica,sans-serif; float:left;"><?=$stats[$out]['name1']?></font><br>



    <div class="floatleft" style="background-color:#242424; height:360; border:none; font-family:arial,helvetica,sans-serif; background-color:#242424;">
            <p align="left">
                <font size="1" color="999999">General Score: </font> 
                <font size="1" color="ececec"><?=$stats[$out]['score']?></font><br>
                <font size="1" color="999999">Objective Score: </font> 
                <font size="1" color="ececec"><?=$stats[$out]['objective']?></font><br>
                <font size="1" color="999999">Squad Score: </font>
                <font size="1" color="ececec"><?=$stats[$out]['squad']?></font><br>
                <font size="1" color="999999">Unlocks: </font>
                <font size="1" color="ececec"><?=round($stats[$out]['unlock'])?></font><br>
                <font size="1" color="999999">Bonus: </font>
                <font size="1" color="ececec"><?=round($stats[$out]['bonus'])?></font><br>
                <font size="1" color="999999">Awards: </font>
                <font size="1" color="ececec"><?=round($stats[$out]['award'])?></font><br>
                <font size="1" color="999999">Support: </font>
                <font size="1" color="ececec"><?=round($stats[$out]['support'])?></font><br>
                <font size="1" color="999999">Assault: </font>
                <font size="1" color="ececec"><?=round($stats[$out]['assault'])?></font><br>
                <font size="1" color="999999">Recon: </font>
                <font size="1" color="ececec"><?=round($stats[$out]['recon'])?></font><br>
                <font size="1" color="999999">Engineer: </font> 
                <font size="1" color="ececec"><?=round($stats[$out]['engineer'])?></font><br>
                <font size="1" color="999999">Vehicle Score: </font> 
                <font size="1" color="ececec"><?=($stats[$out]['vehicleall'])?></font><br>
                <font size="1" color="999999">All Vehicle Kills: </font> 
                <font size="1" color="ececec"><?=$stats[$out]['vehiclekills']?></font><br>
                <font size="1" color="999999">Attack Heli Score: </font> 
                <font size="1" color="ececec"><?=($stats[$out]['vehicleah'])?></font><br>
                <font size="1" color="999999">Ifv Score: </font> 
                <font size="1" color="ececec"><?=$stats[$out]['vehicleifv']?></font><br>
                <font size="1" color="999999">Jet Score: </font> 
                <font size="1" color="ececec"><?=$stats[$out]['vehiclejet']?></font><br>
                <font size="1" color="999999">Mbt Score: </font> 
                <font size="1" color="ececec"><?=$stats[$out]['vehiclembt']?></font><br>
                <font size="1" color="999999">Shots Fired: </font>
                <font size="1" color="ececec"><?=$stats[$out]['shots']?></font><br>
                <font size="1" color="999999">Total Hits: </font>
                <font size="1" color="ececec"><?=round($stats[$out]['hits'])?></font><br>
                <font size="1" color="999999">Kill Assists: </font>
                <font size="1" color="ececec"><?=round($stats[$out]['killassists'])?></font><br>
                <font size="1" color="999999">Revives: </font>
                <font size="1" color="ececec"><?=round($stats[$out]['revives'])?></font><br>
                <font size="1" color="999999">Resupplies: </font>
                <font size="1" color="ececec"><?=round($stats[$out]['resupplies'])?></font><br>
                <font size="1" color="999999">Heals: </font>
                <font size="1" color="ececec"><?=round($stats[$out]['heals'])?></font><br>
                <font size="1" color="999999">Repairs: </font>
                <font size="1" color="ececec"><?=round($stats[$out]['repairs'])?></font><br>
                          
            </p>
        </div><br />

    <div class="floatleft">                     
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=$stats[$out]['ribbonsname']?></font>
        <font size="1" color="000000" style="font-family:arial,helvetica,sans-serif;"><b>MVP</b></font><br> <img src="./<?=$stats[$out]['ribbonsimgr16']?>" /><br>
        <font size="1" color="FF3300" style="font-family:arial,helvetica,sans-serif;"><?=round($stats[$out]['ribbonscountr16'])?></font><br><br>
         
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=$stats[$out]['ribbonsname']?></font>
        <font size="1" color="000000" style="font-family:arial,helvetica,sans-serif;"><b>MVP 2</b></font><br> <img src="./<?=$stats[$out]['ribbonsimgr17']?>" /><br>
        <font size="1" color="FF3300" style="font-family:arial,helvetica,sans-serif;"><?=round($stats[$out]['ribbonscountr17'])?></font><br>
           
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=$stats[$out]['ribbonsname']?></font><br>
        <font size="1" color="000000" style="font-family:arial,helvetica,sans-serif;"><b>MVP 3</b></font><br> <img src="./<?=$stats[$out]['ribbonsimgr18']?>" /><br>
        <font size="1" color="FF3300" style="font-family:arial,helvetica,sans-serif;"><?=round($stats[$out]['ribbonscountr18'])?></font><br><br>
         
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=$stats[$out]['ribbonsname']?></font>
        <font size="1" color="000000" style="font-family:arial,helvetica,sans-serif;"><b>ACE SQUAD</b></font><br> <img src="./<?=$stats[$out]['ribbonsimgr19']?>" /><br>
        <font size="1" color="FF3300" style="font-family:arial,helvetica,sans-serif;"><?=round($stats[$out]['ribbonscountr19'])?></font>                          
        </p>
        
        </div>
        <div class="floatleft">                     
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=$stats[$out]['ribbonsname']?></font>
        <font size="1" color="000000" style="font-family:arial,helvetica,sans-serif;"><b>TDM</b></font><br> <img src="./<?=$stats[$out]['ribbonsimgr32']?>" /><br>
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=round($stats[$out]['ribbonscountr32'])?></font><br><br>
         
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=$stats[$out]['ribbonsname']?></font>
        <font size="1" color="000000" style="font-family:arial,helvetica,sans-serif;"><b>CONQUEST</b></font><br> <img src="./<?=$stats[$out]['ribbonsimgr31']?>" /><br>
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=round($stats[$out]['ribbonscountr31'])?></font><br>
           
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=$stats[$out]['ribbonsname']?></font><br>
        <font size="1" color="000000" style="font-family:arial,helvetica,sans-serif;"><b>ATTACK</b></font><br> <img src="./<?=$stats[$out]['ribbonsimgr40']?>" /><br>
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=round($stats[$out]['ribbonscountr40'])?></font><br><br>
         
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=$stats[$out]['ribbonsname']?></font>
        <font size="1" color="000000" style="font-family:arial,helvetica,sans-serif;"><b>DEFEND</b></font><br> <img src="./<?=$stats[$out]['ribbonsimgr41']?>" /><br>
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=round($stats[$out]['ribbonscountr41'])?></font>                          
        </p>
        
        </div>
        <div class="floatleft">                     
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=$stats[$out]['ribbonsname']?></font>
        <font size="1" color="000000" style="font-family:arial,helvetica,sans-serif;"><b>AVENGER</b></font><br> <img src="./<?=$stats[$out]['ribbonsimgr12']?>" /><br>
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=round($stats[$out]['ribbonscountr12'])?></font><br><br>
         
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=$stats[$out]['ribbonsname']?></font>
        <font size="1" color="000000" style="font-family:arial,helvetica,sans-serif;"><b>SAVIOR</b></font><br> <img src="./<?=$stats[$out]['ribbonsimgr13']?>" /><br>
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=round($stats[$out]['ribbonscountr13'])?></font><br>
           
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=$stats[$out]['ribbonsname']?></font><br>
        <font size="1" color="000000" style="font-family:arial,helvetica,sans-serif;"><b>NEMESIS</b></font><br> <img src="./<?=$stats[$out]['ribbonsimgr14']?>" /><br>
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=round($stats[$out]['ribbonscountr14'])?></font><br><br>
         
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=$stats[$out]['ribbonsname']?></font>
        <font size="1" color="000000" style="font-family:arial,helvetica,sans-serif;"><b>SQUAD WIPE</b></font><br> <img src="./<?=$stats[$out]['ribbonsimgr23']?>" /><br>
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=round($stats[$out]['ribbonscountr23'])?></font>                          
        </p>
        
        </div>
        <div class="floatleft">                     
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=$stats[$out]['ribbonsname']?></font>
        <font size="1" color="000000" style="font-family:arial,helvetica,sans-serif;"><b>ACCURACY</b></font><br> <img src="./<?=$stats[$out]['ribbonsimgr11']?>" /><br>
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=round($stats[$out]['ribbonscountr11'])?></font><br><br>
         
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=$stats[$out]['ribbonsname']?></font>
        <font size="1" color="000000" style="font-family:arial,helvetica,sans-serif;"><b>SURPRESSION</b></font><br> <img src="./<?=$stats[$out]['ribbonsimgr15']?>" /><br>
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=round($stats[$out]['ribbonscountr15'])?></font><br>
           
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=$stats[$out]['ribbonsname']?></font><br>
        <font size="1" color="000000" style="font-family:arial,helvetica,sans-serif;"><b>MAINTANANCE</b></font><br> <img src="./<?=$stats[$out]['ribbonsimgr43']?>" /><br>
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=round($stats[$out]['ribbonscountr43'])?></font><br><br>
         
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=$stats[$out]['ribbonsname']?></font>
        <font size="1" color="000000" style="font-family:arial,helvetica,sans-serif;"><b>EFFICENCY</b></font><br> <img src="./<?=$stats[$out]['ribbonsimgr20']?>" /><br>
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=round($stats[$out]['ribbonscountr20'])?></font>                          
        </p>
        
        </div>
        <div class="floatleft">                     
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=$stats[$out]['ribbonsname']?></font>
        <font size="1" color="000000" style="font-family:arial,helvetica,sans-serif;"><b>ANTI VEHICLE</b></font><br> <img src="./<?=$stats[$out]['ribbonsimgr10']?>" /><br>
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=round($stats[$out]['ribbonscountr10'])?></font><br><br>
         
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=$stats[$out]['ribbonsname']?></font>
        <font size="1" color="000000" style="font-family:arial,helvetica,sans-serif;"><b>AIR WARFARE</b></font><br> <img src="./<?=$stats[$out]['ribbonsimgr27']?>" /><br>
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=round($stats[$out]['ribbonscountr27'])?></font><br>
           
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=$stats[$out]['ribbonsname']?></font><br>
        <font size="1" color="000000" style="font-family:arial,helvetica,sans-serif;"><b>ANTI EXPLOSIVE</b></font><br> <img src="./<?=$stats[$out]['ribbonsimgr21']?>" /><br>
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=round($stats[$out]['ribbonscountr21'])?></font><br><br>
         
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=$stats[$out]['ribbonsname']?></font>
        <font size="1" color="000000" style="font-family:arial,helvetica,sans-serif;"><b>TANK WARFARE</b></font><br> <img src="./<?=$stats[$out]['ribbonsimgr25']?>" /><br>
        <font size="1" color="ececec" style="font-family:arial,helvetica,sans-serif;"><?=round($stats[$out]['ribbonscountr25'])?></font>                          
        </p>
        
        
        
     <td align="center" style="background-color:#666666;">
        <img src="<?=$stats[$out]['rankimg']?>" alt="<?=$stats[$out]['rank']?>" />
    </td>
     
    <td style="width: 50px; background-color:#666666; color:#555555;" title="<?=number_format($stats[$out]['progress'],0,',','.')?> %">
     <p style="border: 1px solid black; width: 55px; background-color: #242424;">
     <span style="background-color: #ff8c00; display: block; padding: 2px; width: <?=number_format($stats[$out]['progress'],0,',','.')?>%">
     </span>
     </p>
     </td>
     </td>
                       
                        
        <td align="center" style="background-color:#666666; color:#cccccc;"><?=number_format($stats[$out]['score'])?></td>
        <td align="center" style="background-color:#666666; color:#cccccc;"><?=number_format($stats[$out]['wins'])?> / <?=number_format($stats[$out]['losses'])?></td>
        <td align="center" style="background-color:#666666; color:#cccccc;"><?=round($stats[$out]['wins']/$stats[$out]['losses'], 2)?></td>
        <td align="center" style="background-color:#666666; color:#cccccc;"><?=number_format($stats[$out]['kills'])?> / <?=number_format($stats[$out]['deaths'])?></td>
        <td align="center" style="background-color:#666666; color:#cccccc;""><?=$stats[$out]['ranktest']?></td>
        <td align="center" style="background-color:#666666; color:#cccccc;"><?=round($stats[$out]['skill'])?></td>  
        <td align="center" style="background-color:#666666; color:#cccccc;"><?=sec2hms($stats[$out]['time'])?>h</td>
        <td align="center" style="background-color:#666666; color:#cccccc;"><?=round($stats[$out]['dogtags'])?></td>
        <td align="center" style="background-color:#666666; color:#cccccc;"><?=round($stats[$out]['headshots'])?></td>
        <td align="center" style="background-color:#666666; color:#cccccc;"><?=round($stats[$out]['longesths'])?> m</td>
        <td align="center" style="background-color:#666666; color:#cccccc;"><?=number_format($stats[$out]['knife'],'','','.')?></td> 



     </tr>      
            <?
            
    endfor; ?>
                    
            </tbody>
        </table>  
        
    </center>


        <?
        
    // If you add ?debug=1 to the end of your script URL in the browser you can see what data is returned
        
    if(isset($_GET['debug']))
        {
            echo 
    '<pre>';
                
    print_r($data);
            echo 
    '</pre>';
        }    

    else 
    {
        echo 
    'Error contacting API status code: '.$statusCode;
    }

    // Lets dump our functions down here, these would be better in a seperate include though

    function sortKits($x$y)
    {
        if(
    $x['time'] == $y['time'])
        {
            return 
    0;
        }
        elseif(
    $x['time'] < $y['time'])
        {
            return 
    1;
        }
        else
        {
            return -
    1;
        }
    }

    function 
    sortPlayers($x$y)
    {
        if(
    $x['score'] == $y['score'])
        {
            return 
    0;
        }
        elseif(
    $x['score'] < $y['score'])
        {
            return 
    1;
        }
        else
        {
            return -
    1;
        }
    }

    // Convert seconds to hours
    function sec2hms($sec$padHours false
    {
        
    $hms     "";
        
    $hours     intval(intval($sec) / 3600); 
        
    $hms     .= ($padHours)? str_pad($hours2"0"STR_PAD_LEFT). ':' $hours;    
        return 
    $hms;
    }
    ?>
    Name:  de.png
Views: 92
Size:  545 Bytes German ... see below for English

    Hi ZA_Tony,
    erstmal 1000 Dank für deine Hilfe :thumb:

    Ich habe deinen Code mal eingefügt. Die Spalte wird jetzt angezeigt, aber es wird kein Wert ausgegeben.
    Einen Fehler hab ich wohl schon entdeckt ...? da fehlt ein "s" bei stat(s), oder?
    PHP Code:
                    $stats[$i]['knife']                = $data['list'][$player]['stat'][c_wasK__kwa_g]; 
    Das habe ich verändert, aber hat nicht viel geholfen.

    Ist hier vllt. noch der Wurm drin? nach ['knife']
    PHP Code:
        <td align="center" style="background-color:#666666; color:#cccccc;"><?=number_format($stats[$out]['knife'],'','','.')?></td>
    Hab deinen Code mal reingestellt. Vielleicht fällt dir ja was ein
    http://deepstahl.enjin.com/leaderboard

    P.S. Dein/Euer Leaderboard ist der Hammer !*! 3x GEIL Nice AAA 5* 10/10 i like ZA



    Name:  gb.png
Views: 88
Size:  599 Bytes English

    Hi ZA_Tony,
    thanks alot for your help :thumb:

    I've used your Code but there wasn't any data output.
    Dont know if i found an Error...? does ['stat'] needs an "s" > stat(s)?
    PHP Code:
                    $stats[$i]['knife']                = $data['list'][$player]['stat'][c_wasK__kwa_g]; 
    I' tried that but without fortune ;(

    Is this line correct after ['knife']
    PHP Code:
        <td align="center" style="background-color:#666666; color:#cccccc;"><?=number_format($stats[$out]['knife'],'','','.')?></td>
    You can watch your Code here and hopefully you found out whats going on
    http://deepstahl.enjin.com/leaderboard

    P.S. Your Leaderboard is AWESOME !*! 3x Hoooah Nice AAA 5* 10/10 i like ZA

  20. #140
    Member
    Join Date
    2011-11-08
    Location
    NRW
    Posts
    112
    BFBC2 PC
    Tony_GER
    BF3 PC
    xXxT0NYxXx

    AW: Re: AW: Re: API PHP example with table output

    bei mir klappt es, das mit dem fehlenden "S" ist richtig ;-)
    kannste mir mal die komplette Datei schicken?

    wenn du bei dir folgendes aufrufst, findest du auch die Messer kills:

    http://baumpflege-spamer.de/dx/bf3/dsboard.php?debug=1

    Suche mal nach "c_wasK__kwa_g"

    gib mal bei deiner Tabelle anstatt:

    PHP Code:
    <td align="center" style="background-color:#666666; color:#cccccc;"><?=number_format($stats[$out]['knife'],'','','.')?></td>
    PHP Code:

    <td align="center" style="background-color:#666666; color:#cccccc;"><?=$stats[$out]['knife']?></td>
    Last edited by ZA Tony; 2012-04-14 at 15:10.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
P-STATS NETWORK FORUM LOGIN CREATE ACCOUNT