diff --git a/pool/page_blocks.php b/pool/page_blocks.php
index 1bf6b9f3..af7394ff 100644
--- a/pool/page_blocks.php
+++ b/pool/page_blocks.php
@@ -49,22 +49,31 @@ function doblocks($data, $user)
else
$ans = getBlocks($user);
- $pg .= "
\n";
- $pg .= "";
- $pg .= "Height | ";
- if ($user !== null)
- $pg .= "Who | ";
- $pg .= "Reward | ";
- $pg .= "When | ";
- $pg .= "Status | ";
- $pg .= "Diff | ";
- $pg .= "% | ";
- $pg .= "CDF | ";
- $pg .= "
\n";
+ if (nuem(getparam('csv', true)))
+ $wantcsv = false;
+ else
+ $wantcsv = true;
+
+ if ($wantcsv === false)
+ {
+ $pg .= "\n";
+ $pg .= "";
+ $pg .= "Height | ";
+ if ($user !== null)
+ $pg .= "Who | ";
+ $pg .= "Reward | ";
+ $pg .= "When | ";
+ $pg .= "Status | ";
+ $pg .= "Diff | ";
+ $pg .= "% | ";
+ $pg .= "CDF | ";
+ $pg .= "
\n";
+ }
$blktot = 0;
$nettot = 0;
$i = 0;
$orph = false;
+ $csv = "Height,Status,Timestamp,DiffAcc,NetDiff\n";
if ($ans['STATUS'] == 'ok')
{
$count = $ans['rows'];
@@ -130,19 +139,35 @@ function doblocks($data, $user)
$cdf = '?';
}
- $pg .= "";
- $pg .= "$hifld | ";
- if ($user !== null)
+ if ($wantcsv === false)
+ {
+ $pg .= "
";
+ $pg .= "$hifld | ";
+ if ($user !== null)
$pg .= "".htmlspecialchars($ans['workername:'.$i]).' | ';
- $pg .= "".btcfmt($ans['reward:'.$i]).' | ';
- $pg .= "".gmdate('Y-m-d H:i:s+00', $ans['firstcreatedate:'.$i]).' | ';
- $pg .= "".$stat.' | ';
- $pg .= "$stara$acc | ";
- $pg .= "$bpct | ";
- $pg .= "$cdf | ";
- $pg .= "
\n";
+ $pg .= "".btcfmt($ans['reward:'.$i]).' | ';
+ $pg .= "".gmdate('Y-m-d H:i:s+00', $ans['firstcreatedate:'.$i]).' | ';
+ $pg .= "".$stat.' | ';
+ $pg .= "$stara$acc | ";
+ $pg .= "$bpct | ";
+ $pg .= "$cdf | ";
+ $pg .= "\n";
+ }
+ else
+ {
+ $csv .= "$hi,";
+ $csv .= "\"$stat\",";
+ $csv .= $ans['firstcreatedate:'.$i].',';
+ $csv .= "$diffacc,";
+ $csv .= "$netdiff\n";
+ }
}
}
+ if ($wantcsv === true)
+ {
+ echo $csv;
+ exit(0);
+ }
if ($nettot > 0)
{
if (($i % 2) == 0)