Heater
Member
+0|6966
Is anyone running a php nuke site with the xml stats grabber thing?
I cant figure out how to display it in the page, I used the exmamples.php to put my PID and it grabbed it, but I need to display it within php nuke...can anyone guid me?
Heater
Member
+0|6966
*bump*
anyone have knowledge of this?
check out this site...www.phycodesigns.com, its LDU based but the package he downloaded came with little .gif files for the ranks and stuff, which the package on this site did not.
KaZaMa
Member
+0|7041|Asturias
You need the zip of NM16 in the news forum (xml ...),  upload it to you web site in modules secction.Then replace all text into the index.php with this code:

<?php

if (!eregi("modules.php", $PHP_SELF)) {
   die ("No puedes acceder directamente al archivo...");

}

require_once("mainfile.php");

require('bf2s-mlb.php');
ob_start("ob_gzhandler");

include("header.php");

    $mlb->debug = false;

        $rankkeys = array(
         "0" => array("rank" => "Soldado",            "req" => 0),
         "1" => array("rank" => "Soldado de primera",        "req" => 150),
         "2" => array("rank" => "Cabo Primero",        "req" => 500),
         "3" => array("rank" => "Cabo",            "req" => 800),
         "4" => array("rank" => "Sargento",            "req" => 2500),
         "5" => array("rank" => "Sargento Instructor",        "req" => 5000),
         "6" => array("rank" => "Sargento de la Artilleria",        "req" => 8000),
         "7" => array("rank" => "Sargento Principal",        "req" => 20000),
         "8" => array("rank" => "Sargento Primero",        "req" => 20000),
         "9" => array("rank" => "Sargento Principal de la Artilleria",    "req" => 50000),
        "10" => array("rank" => "Sargento Mayor",        "req" => 50000),
        "11" => array("rank" => "Sargento Mayor de la Armada",    "req" => 250000),
        "12" => array("rank" => "Segundo Teniente",        "req" => 250000) //don't know yet
    );

    function sec2log($seconds) {
        $h = floor($seconds / 3600);
        $m = floor(($seconds % 3600) / 60);
        $s = floor(($seconds % 3600) % 60);
        $h=sprintf("%02d", $h);
        $m=sprintf("%02d", $m);
        $s=sprintf("%02d", $s);
        return "{$h}:{$m}:{$s}";
    }
   
    opentable ();
    echo "<center><FONT SIZE=\"2\" color=\"white\"><b>Leaderboard del Clan ]{iC}[</b></center>";
    closetable();
    opentable ();
   
?>

  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <script type="text/javascript" src="modules/leaderboard/mlb.js" ></script>
  <link rel="stylesheet" href="modules/leaderboard/mbl.css" type="text/css" />


<?php
    //no more than 64 pid's per request! Anything more than 64 get's ignored...
    //NO NAMES! PID's ONLY!
    //just a bunch(40) of PID's from various EA leader boards. Replace with your own.
    //these all get joined together into a new var, and sent as one string later..
    $PIDlist = array(
        "squad_a" => "43933667,45029189,48205051,46151573,45877695,46265538,46251152,49017280,46570626,49319998,49570472,49525750,57452809,57863919,59050385,58218788"
    );

    //turn the PID's into multi-dimensional arrays, for comparing against the XLM cache, and multiple group tables.
    $squadgroup = array();
    foreach( $PIDlist as $k => $v ) {
        $v = preg_replace('/\s/', '', $v); //strip all whitespaces (jic)
        $grouppid .= $v . ","; //add all pid's into one string for feed
        $squadgroup[$k] = explode(',', $v);
    }
    if( substr($grouppid,-1, 1) == ","); //better check it first
        $grouppid = substr($grouppid,0,strlen($grouppid)-1); //trim off the last comma

    $mlb->get($grouppid); //get raw xml data array
//echo "<pre>\n";
//echo print_r($squadgroup);
//echo "</pre>\n";
     
?>

<br>
<form name="compare" method="post">
<input type="hidden" name="pid1">
<input type="hidden" name="pid2">
<input type="hidden" name="url">

<p align="center">

<table border="0" cellpadding="0" cellspacing="0" width="50%">
  <tr>
    <td>

      <table border="0" cellpadding="0" cellspacing="0" width="100%">
        <tr>
          <td align="left"><input type="button" name="redir" value="Comparar" onClick="setItems_redir();" disabled>&nbsp;&nbsp;Selecciona dos jugadores para comparar stats!</td>
        </tr>
      </table>

<?php
    $leadercache = $mlb->getList('score'); //only need to call this once, default sort by 'score'
    foreach( $squadgroup as $group => $squad ) { //cycle through each group array
?>
      <table border="0" cellpadding="0" cellspacing="0" id="<?=$group?>" class="leader sortable" width="100%">
        <tr>
          <th style="padding: 0px 6px; text-align: right;" width="16" class="nosort" id="hdr"><img src="images/compare.gif" alt="Comparar Jugadores" width="16" height="16" style="border: 0;"/></th>
          <th width="16" class="nosort" id="hdr">&nbsp;</th>
          <th style="padding-left: 4px; text-align: left;" id="hdr">Jugador</th>
          <th style="padding: 0px 6px; text-align: right;" id="hdr">Puntuacion</th>
          <th style="padding: 0px 6px; text-align: right;" id="hdr">PPM</th>
          <th style="padding: 0px 6px; text-align: right;" id="hdr">Tiempo</th>
          <th style="padding: 0px 6px; text-align: right;" class="nosort" id="hdr">Progreso</th>
        </tr>
<?php
        foreach( $leadercache as $players ) { //cycle through each sub-array
            if ( in_array($players['PID'], $squad) ) { //verify, else loop

                //No one knows for sure what happens past Sergeant Major of the Corps
                //I suspect they become 2nd Lieutenant after Sergeant Major of the Corps, and stay there. (until expansion?)
                if ( ($players['RANK'] >= 11) ) {
                        $pcntDiff = number_format( 100, 2);
                        $newrank = "At ease soldier!";
                } else {
                    //Master Sergeant cannot advance to First Sergeant
                    //Master Gunnery Sergeant cannot advance to Sergeant Major
                    if(($players['RANK'] == 7) || ($players['RANK'] == 9))
                        $nextrank = $players['RANK'] + 2;
                    else
                        $nextrank = $players['RANK'] + 1;

                    $requiredPoints = $rankkeys[$nextrank]['req'];    //Required Points for next rank
                    $pointDiff = ($requiredPoints - $players['SCORE']);    //Point differential for next rank

                    if($pointDiff <= 0) {//WTF? over...
                        $pcntDiff = number_format( 100, 2);
                        //gotta find their proper/next rank..
                        foreach( $rankkeys as $k => $v ) {
                            if($rankkeys[$k]['req'] >= $players['SCORE']) {
                                $newrank = $rankkeys[($k - 1)]['rank']; //This is where they're supposed to be
                                break;
                            }
                        }
                    } else {
                        $pcntDiff = number_format( (($players['SCORE'] / $requiredPoints) * 100), 2);
                        $newrank = $rankkeys[$nextrank]['rank'];
                        $approx = sec2log( floor(($players['TIME'] / $players['SCORE']) * $pointDiff) );
                        $newrank .= "<br />Aprox.: " . $approx;
                    }
                }
?>
        <tr>
          <td valign="middle" width="16" nowrap><input type="checkbox" name="compare" value="<?=$players['PID']?>" onclick="setItems(this);"></td>
          <td valign="middle" width="16" nowrap><img src="images/rank_small_<?=$players['RANK']?>.gif" alt="<?=$rankkeys[$players['RANK']]['rank']?>" style="border: 0;"/></td>
          <td valign="middle" width="25%" style="padding-left: 4px; text-align: left;"><a href="<?=$players['LINK']?>" target="_blank"><?=$players['NICK']?></a></td>
          <td><?=number_format($players['SCORE'], 0, ',', ',')?></td>
          <td><?=number_format($players['SPM'], 2)?></td>
          <td><?=sec2log($players['TIME'])?></td>
          <td alt="Siguiente Rango: <?= $newrank ?>">
            <div class="progressbar">
              <div class="progress" style="width: <?=number_format($pcntDiff, 0) ?>%"><?= $pcntDiff ?>%</div>
            </div>
          </td>
        </tr>
<?php
            }
        }
?>
      </table>

<?php
    }
?>
      <table border="0" cellpadding="0" cellspacing="0" width="100%" class="misc">
        <tr>
          <td align="left" valign="top"><em>Stats sacados de <a href="http://www.bf2s.com" TARGET="_BLANK">bf2s.com</a></em></td>
          <td align="right"><?php echo "Ult. Actualizacion: " . $mlb->cacheage; ?><br /><?php echo "Prox. Actualizacion: " . $mlb->nextrefresh; ?></td>
        </tr>
      </table>

    </td>
  </tr>
</table>
</p>
</form>

</body>



<?php if($mlb->debug) { ?>
<!-- View page source to see debug info
<pre>
  <?php $mlb->printLog(); ?>
</pre>
-->
<?php }

closetable();
include("footer.php");
?>
The text is spanish replace it with your languaje, ranks etc...

For some extrange reason my site dont accept the default route to the class and js, i changed to my web location, change it it dont work for you, are the lines

<script type="text/javascript" src="modules/leaderboard/mlb.js" ></script>
<link rel="stylesheet" href="modules/leaderboard/mbl.css" type="text/css" />

Nothing more, only edit the PID on the squad_a, you have now you module Leaderboard.

Last edited by KaZaMa (2005-11-09 07:38:18)

Board footer

Privacy Policy - © 2024 Jeff Minard