Hi with the ChipLeaders.php file how can i show the "Real Name" to be shown on the list
Thanks
ChipLeaders.php
ChipLeaders.php
New Team Concept poker site
http://www.huskyteampoker.co.uk
-
- Site Admin
- Posts: 5878
- Joined: Wed Mar 19, 2008 8:47 pm
Re: ChipLeaders.php
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 = " ";
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>
Re: ChipLeaders.php
perfect thanks so much
New Team Concept poker site
http://www.huskyteampoker.co.uk