\n";
$pg .= "
";
$pg .= "Shift | ";
$pg .= "Start | ";
$pg .= "Length | ";
$pg .= "Your Diff | ";
$pg .= "Inv Diff | ";
$pg .= "Avg Hs | ";
$pg .= "Shares | ";
$pg .= "Avg Share | ";
$pg .= "Rewards | ";
$pg .= "
\n";
if (($ans['STATUS'] != 'ok') || !isset($ans['prefix_all']))
$pg = 'Shifts
'.$pg;
else
{
$pre = $ans['prefix_all'];
$count = $ans['rows'];
$pg = 'Last '.($count+1).' Shifts
'.$pg;
for ($i = 0; $i < $count; $i++)
{
$u = '';
if (isset($ans['lastpayoutstart:'.$i])
&& $ans['lastpayoutstart:'.$i] != '')
$u = 'u';
if (($i % 2) == 0)
$row = "even$u";
else
$row = "odd$u";
$pg .= "";
$shifname = $ans['shift:'.$i];
$shif = preg_replace(array('/^.* to /','/^.*fin: /'), '', $shifname);
$ablock = false;
if (preg_match('/to.*Block.* fin/', $shifname) == 1)
$ablock = true;
else
{
$shifex = $ans['endmarkextra:'.$i];
if (preg_match('/Block .* fin/', $shifex) == 1)
$ablock = true;
}
if ($ablock === true)
$btc = ' ';
else
$btc = '';
$pg .= "$shif$btc | ";
$start = $ans['start:'.$i];
$pg .= ''.utcd($start).' | ';
$nd = $ans['end:'.$i];
$elapsed = $nd - $start;
$pg .= ''.howmanyhrs($elapsed).' | ';
$diffacc = $ans[$pre.'diffacc:'.$i];
$pg .= ''.difffmt($diffacc).' | ';
$diffinv = $ans[$pre.'diffinv:'.$i];
$pg .= ''.difffmt($diffinv).' | ';
$hr = $diffacc * pow(2,32) / $elapsed;
$pg .= ''.dsprate($hr).' | ';
$shareacc = $ans[$pre.'shareacc:'.$i];
$pg .= ''.difffmt($shareacc).' | ';
if ($shareacc > 0)
$avgsh = $diffacc / $shareacc;
else
$avgsh = 0;
$pg .= ''.number_format($avgsh, 2).' | ';
$pg .= ''.$ans['rewards:'.$i].' | ';
$pg .= "
\n";
}
}
$pg .= "\n";
return $pg;
}
#
function show_shifts($info, $page, $menu, $name, $user)
{
gopage($info, NULL, 'doshifts', $page, $menu, $name, $user);
}
#
?>