';
$pg .= '
Address | ';
$pg .= 'Shares | ';
$pg .= 'Diff | ';
$pg .= 'Invalid | ';
$pg .= 'Block % | ';
$pg .= 'Hash Rate | ';
$pg .= 'Ratio | ';
$pg .= 'Addr % | ';
$pg .= "\n";
return $pg;
}
#
function perhashorder($a, $b)
{
return $b['payratio'] - $a['payratio'];
}
#
function peruser($data, $user, &$offset, &$totshare, &$totdiff,
&$totinvalid, &$totrate, &$blockacc,
&$blockreward, $srt = false)
{
$ans = getPercents($user);
$pg = '';
if ($ans['STATUS'] == 'ok')
{
if (isset($ans['blockacc']))
$blockacc = $ans['blockacc'];
if (isset($ans['blockreward']))
$blockreward = $ans['blockreward'];
$all = array();
$count = $ans['rows'];
for ($i = 0; $i < $count; $i++)
{
$all[] = array('payaddress' => $ans['payaddress:'.$i],
'payratio' => $ans['payratio:'.$i],
'paypercent' => $ans['paypercent:'.$i],
'p_shareacc' => $ans['p_shareacc:'.$i],
'p_diffacc' => $ans['p_diffacc:'.$i],
'p_diffinv' => $ans['p_diffinv:'.$i],
'p_uhr' => $ans['p_hashrate5m:'.$i]);
}
if ($srt)
usort($all, 'perhashorder');
for ($i = 0; $i < $count; $i++)
{
if ((($offset) % 2) == 0)
$row = 'even';
else
$row = 'odd';
$pg .= "";
$pg .= ''.$all[$i]['payaddress'].' | ';
$shareacc = number_format($all[$i]['p_shareacc'], 0);
$totshare += $all[$i]['p_shareacc'];
$diffacc = number_format($all[$i]['p_diffacc'], 0);
$totdiff += $all[$i]['p_diffacc'];
$pg .= "$shareacc | ";
$pg .= "$diffacc | ";
$dtot = $all[$i]['p_diffacc'] + $all[$i]['p_diffinv'];
if ($dtot > 0)
$rej = number_format(100.0 * $all[$i]['p_diffinv'] / $dtot, 3);
else
$rej = '0';
$totinvalid += $all[$i]['p_diffinv'];
$pg .= "$rej% | ";
if ($blockacc <= 0)
$blkpct = ' ';
else
$blkpct = number_format(100.0 * $all[$i]['p_diffacc'] / $blockacc, 3) . '%';
$pg .= "$blkpct | ";
$uhr = $all[$i]['p_uhr'];
if ($uhr == '?')
$uhr = '?GHs';
else
{
$totrate += $uhr;
$uhr = dsprate($uhr);
}
$pg .= "$uhr | ";
$pg .= ''.$all[$i]['payratio'].' | ';
$paypct = number_format($all[$i]['paypercent'], 3);
$pg .= "$paypct% | ";
$pg .= "
\n";
$offset++;
}
}
return $pg;
}
#
function pertotal($offset, $totshare, $totdiff, $totinvalid, $totrate, $blockacc, $blockreward)
{
$pg = '';
$totrate = dsprate($totrate);
if (($offset % 2) == 0)
$row = 'even';
else
$row = 'odd';
$pg .= "Total: | ";
$shareacc = number_format($totshare, 0);
$pg .= "$shareacc | ";
$diffacc = number_format($totdiff, 0);
$pg .= "$diffacc | ";
$dtot = $totdiff + $totinvalid;
if ($dtot > 0)
$rej = number_format(100.0 * $totinvalid / $dtot, 3);
else
$rej = '0';
$pg .= "$rej% | ";
if ($blockacc <= 0)
$blkpct = ' ';
else
$blkpct = number_format(100.0 * $totdiff / $blockacc, 3) . '%';
$pg .= "$blkpct | ";
$pg .= "$totrate | ";
$pg .= " |
\n";
return $pg;
}
#
function dopercent($data, $user)
{
$pg = 'Address Percents
';
$pg .= "\n";
$totshare = 0;
$totdiff = 0;
$totinvalid = 0;
$totrate = 0;
$offset = 0;
$blockacc = 0;
$blockreward = 0;
$pg .= pertitle($data, $user);
$pg .= peruser($data, $user, $offset, $totshare, $totdiff, $totinvalid,
$totrate, $blockacc, $blockreward, true);
$pg .= pertotal($offset, $totshare, $totdiff, $totinvalid, $totrate,
$blockacc, $blockreward);
if ($blockacc > 0 && $blockreward > 0)
{
$btc = btcfmt($totdiff / $blockacc * $blockreward);
$pg .= '';
$pg .= " Payout est if block found at 100%: ~$btc BTC";
$pg .= ' |
';
}
$pg .= "
\n";
return $pg;
}
#
function show_percent($info, $page, $menu, $name, $user)
{
gopage($info, NULL, 'dopercent', $page, $menu, $name, $user);
}
#
?>