|
|
|
@ -69,28 +69,12 @@ function pctcolour($pct)
|
|
|
|
|
return array($fg, $bg); |
|
|
|
|
} |
|
|
|
|
# |
|
|
|
|
function doblocks($data, $user) |
|
|
|
|
function statstable($poolfee, $ans, $data) |
|
|
|
|
{ |
|
|
|
|
$blink = '<a href=https://www.blocktrail.com/BTC/block/'; |
|
|
|
|
$poolfee = 0.9; # pool fee as a % out of 100 |
|
|
|
|
|
|
|
|
|
$pg = ''; |
|
|
|
|
|
|
|
|
|
if ($user === null) |
|
|
|
|
$ans = getBlocks('Anon'); |
|
|
|
|
else |
|
|
|
|
$ans = getBlocks($user); |
|
|
|
|
|
|
|
|
|
if (nuem(getparam('csv', true))) |
|
|
|
|
$wantcsv = false; |
|
|
|
|
else |
|
|
|
|
$wantcsv = true; |
|
|
|
|
if ($ans['STATUS'] != 'ok' or !isset($ans['s_rows']) or $ans['s_rows'] < 1) |
|
|
|
|
return ''; |
|
|
|
|
|
|
|
|
|
if ($wantcsv === false) |
|
|
|
|
{ |
|
|
|
|
if ($ans['STATUS'] == 'ok' and isset($ans['s_rows']) and $ans['s_rows'] > 0) |
|
|
|
|
{ |
|
|
|
|
$pg .= '<h1>Block Statistics</h1>'; |
|
|
|
|
$pg = '<h1>Block Statistics</h1>'; |
|
|
|
|
$pg .= "<table cellpadding=0 cellspacing=0 border=0>\n"; |
|
|
|
|
$pg .= "<thead><tr class=title>"; |
|
|
|
|
$pg .= "<td class=dl>Description</td>"; |
|
|
|
@ -146,14 +130,22 @@ function doblocks($data, $user)
|
|
|
|
|
$pg .= "</tr>\n"; |
|
|
|
|
} |
|
|
|
|
$pg .= "</tbody></table>\n"; |
|
|
|
|
return $pg; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ($ans['STATUS'] == 'ok' and isset($ans['rows']) and $ans['rows'] > 0) |
|
|
|
|
# |
|
|
|
|
function monthtable($poolfee, $ans, $limit) |
|
|
|
|
{ |
|
|
|
|
$pg .= '<br><h1>Monthly Statistics</h1>'; |
|
|
|
|
if ($ans['STATUS'] != 'ok' or !isset($ans['rows']) or $ans['rows'] < 1) |
|
|
|
|
return ''; |
|
|
|
|
|
|
|
|
|
$nowmon = intval(gmdate('n', $ans['STAMP'])); |
|
|
|
|
$nowyyyy = intval(gmdate('Y', $ans['STAMP'])); |
|
|
|
|
|
|
|
|
|
$pg = '<h1>Monthly Statistics</h1>'; |
|
|
|
|
$pg .= "<table cellpadding=0 cellspacing=0 border=0>\n"; |
|
|
|
|
$pg .= "<thead><tr class=title>"; |
|
|
|
|
$pg .= "<td class=dl>UTC Month</td>"; |
|
|
|
|
$pg .= "<td class=dr>Pool Avg</td>"; |
|
|
|
|
$pg .= "<td class=dr>Blocks</td>"; |
|
|
|
|
$pg .= "<td class=dr>Expected</td>"; |
|
|
|
|
$pg .= "<td class=dr>Mean Diff%</td>"; |
|
|
|
@ -164,7 +156,7 @@ function doblocks($data, $user)
|
|
|
|
|
|
|
|
|
|
$pg .= '<tbody>'; |
|
|
|
|
$count = $ans['rows']; |
|
|
|
|
$rout = $bcount = $bcd = $bmon = $byyyy = $bdiffratio = $btxn = 0; |
|
|
|
|
$rout = $bcount = $bcd = $bmon = $byyyy = $bdiffacc = $bdiffratio = $btxn = 0; |
|
|
|
|
$skipped = false; |
|
|
|
|
for ($i = 0; $i < $count; $i++) |
|
|
|
|
{ |
|
|
|
@ -194,36 +186,50 @@ function doblocks($data, $user)
|
|
|
|
|
else |
|
|
|
|
$row = 'odd'; |
|
|
|
|
|
|
|
|
|
if ($bmon == $nowmon && $byyyy == $nowyyyy) |
|
|
|
|
$dots = '…'; |
|
|
|
|
else |
|
|
|
|
$dots = ''; |
|
|
|
|
|
|
|
|
|
$elap = $bcd - $cd; |
|
|
|
|
$phr = ($bdiffacc / $elap) * pow(2, 32); |
|
|
|
|
$phrdsp = siprefmt($phr); |
|
|
|
|
|
|
|
|
|
$name = gmdate('Y M', $bcd); |
|
|
|
|
$exc = number_format($bdiffratio, 2); |
|
|
|
|
if ($bdiffratio > $bcount) |
|
|
|
|
$bcol = 'darkred'; |
|
|
|
|
else |
|
|
|
|
$bcol = 'darkgreen'; |
|
|
|
|
$md = number_format(100 * $bdiffratio / $bcount, 2); |
|
|
|
|
$mr = number_format(100 * $btxn / $bcount, 2); |
|
|
|
|
$ml = number_format(100 * $bcount / $bdiffratio, 2); |
|
|
|
|
$o = number_format((100 - $poolfee) * ($bcount / $bdiffratio) * ($btxn / $bcount), 2); |
|
|
|
|
$oa = (100 - $poolfee) * ($bcount / $bdiffratio) * ($btxn / $bcount); |
|
|
|
|
$odsp = number_format($oa, 2); |
|
|
|
|
|
|
|
|
|
$pg .= "<tr class=$row>"; |
|
|
|
|
$pg .= "<td class=dl>$name</td>"; |
|
|
|
|
$pg .= "<td class=dr>$bcount</td>"; |
|
|
|
|
$pg .= "<td class=dl>$name$dots</td>"; |
|
|
|
|
$pg .= "<td class=dr>${phrdsp}Hs</td>"; |
|
|
|
|
$pg .= "<td class=dr><b><font color=$bcol>$bcount</font></b></td>"; |
|
|
|
|
$pg .= "<td class=dr>$exc</td>"; |
|
|
|
|
$pg .= "<td class=dr>$md%</td>"; |
|
|
|
|
$pg .= "<td class=dr>$mr%</td>"; |
|
|
|
|
$pg .= "<td class=dr>$ml%</td>"; |
|
|
|
|
$pg .= "<td class=dr>$o%</td>"; |
|
|
|
|
$pg .= "<td class=dr>$odsp%</td>"; |
|
|
|
|
$pg .= "</tr>\n"; |
|
|
|
|
|
|
|
|
|
$rout++; |
|
|
|
|
} |
|
|
|
|
if ($rout > 7) |
|
|
|
|
if ($rout > $limit) |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
$bcd = $cd; |
|
|
|
|
$bmon = $mon; |
|
|
|
|
$byyyy = $yyyy; |
|
|
|
|
$bcount = 0; |
|
|
|
|
$bdiffratio = 0; |
|
|
|
|
$btxn = 0; |
|
|
|
|
$bcount = $bdiffacc = $bdiffratio = $btxn = 0; |
|
|
|
|
} |
|
|
|
|
$bdiffratio += floatval($ans['diffratio:'.$i]); |
|
|
|
|
$bdiffacc += floatval($ans['diffacc:'.$i]); |
|
|
|
|
|
|
|
|
|
if ($conf != 'O' and $conf != 'R') |
|
|
|
|
{ |
|
|
|
@ -235,7 +241,32 @@ function doblocks($data, $user)
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
$pg .= '</tbody></table>'; |
|
|
|
|
|
|
|
|
|
return $pg; |
|
|
|
|
} |
|
|
|
|
# |
|
|
|
|
function doblocks($data, $user) |
|
|
|
|
{ |
|
|
|
|
$blink = '<a href=https://www.blocktrail.com/BTC/block/'; |
|
|
|
|
$poolfee = 0.9; # pool fee as a % out of 100 |
|
|
|
|
|
|
|
|
|
$pg = ''; |
|
|
|
|
|
|
|
|
|
if ($user === null) |
|
|
|
|
$ans = getBlocks('Anon'); |
|
|
|
|
else |
|
|
|
|
$ans = getBlocks($user); |
|
|
|
|
|
|
|
|
|
if (nuem(getparam('csv', true))) |
|
|
|
|
$wantcsv = false; |
|
|
|
|
else |
|
|
|
|
$wantcsv = true; |
|
|
|
|
|
|
|
|
|
if ($wantcsv === false) |
|
|
|
|
{ |
|
|
|
|
$pg .= statstable($poolfee, $ans, $data); |
|
|
|
|
|
|
|
|
|
$pg .= monthtable($poolfee, $ans, 7); |
|
|
|
|
|
|
|
|
|
if ($ans['STATUS'] == 'ok') |
|
|
|
|
{ |
|
|
|
|