ChipLeaders.php

For discussion of the Poker Mavens server module and other administration topics
Post Reply
Bonza
Posts: 31
Joined: Fri Feb 17, 2012 2:54 pm
Location: UK
Contact:

ChipLeaders.php

Post by Bonza »

Hi with the ChipLeaders.php file how can i show the "Real Name" to be shown on the list

Thanks
Image
New Team Concept poker site
http://www.huskyteampoker.co.uk
Kent Briggs
Site Admin
Posts: 5878
Joined: Wed Mar 19, 2008 8:47 pm

Re: ChipLeaders.php

Post by Kent Briggs »

Something like this:

Code: Select all

<html>
<body>
<?php

  $topcount = 10;  // display top 10, use any number you like

  include "API.php";  // API $url and $pw values set here

  // Fetch the Site Name using the SystemGet API command.

  $params = "Password=" . $pw . "&Command=SystemGet&Property=SiteName";
  $api = Poker_API($url,$params,true);
  $result = $api["Result"];
  if ($result == "Error") die("Error: " . $api["Error"]);
  $sitename = $api["Value"];

  // Fetch the list of players using the AccountsList API command.

  $params = "Password=" . $pw . "&Command=AccountsList&Fields=Player,Balance,RealName";
  $api = Poker_API($url,$params,true);
  $result = $api["Result"];
  if ($result == "Error") die("Error: " . $api["Error"]);

  // Iterate through the players in the response and create a associative
  // chips array keyed on player name.

  $accounts = $api["Accounts"];
  $chips = Array();
  for ($i = 1; $i <= $accounts; $i++)
  {
    $player = $api["Player" . $i];
    $realname[$player] = $api["RealName" . $i];
    $chips[$player] = $api["Balance" . $i];
  }

  // Sort array in decending order.

  arsort($chips);

  // Display results in an html table.

  echo "<table border='1' cellpadding='5'>\r\n";
  echo "<tr><th colspan='4'>$sitename - Chip Leaders</th></tr>\r\n";
  echo "<tr><th>Rank</th><th>Player</th><th>Name</th><th>Balance</th></tr>\r\n";
  $rank = 0;
  foreach ($chips as $p => $c)
  {
    $rank++;
    $rn = $realname[$p];
    if ($rn == "") $rn = "&nbsp;";
    echo "<tr><td>$rank</td><td>$p</td><td>$rn</td><td>$c</td></tr>\r\n";
    if ($rank == $topcount) break;
  }
  echo "</table><br>\r\n";

?>
</body>
</html>
Bonza
Posts: 31
Joined: Fri Feb 17, 2012 2:54 pm
Location: UK
Contact:

Re: ChipLeaders.php

Post by Bonza »

perfect thanks so much :)
Image
New Team Concept poker site
http://www.huskyteampoker.co.uk
Post Reply