99999999) $b4 = ''; else if ($num > 9999999) $b4 = ''; if ($b4 != '') $af = ''; return $b4.$fmt.$af; } # function dopplns($data, $user) { global $send_sep; $pg = '

CKPool

'; $blk = getparam('blk', true); if (nuem($blk)) { $pg = '
'.makeForm('pplns')." Block:   "; } else { $msg = msgEncode('pplns', 'pplns', array('height' => $blk, 'allow_aged' => 'Y')); $rep = sendsockreply('pplns', $msg); if ($rep == false) $ans = array(); else $ans = repDecode($rep); if ($ans['ERROR'] != null) return '
'.$ans['STATUS'].': '.$ans['ERROR'].'
'; $data = array( 'Block' => 'block', 'Block Hash' => 'block_hash', 'Block Reward (Satoshis)' => 'block_reward', 'PPLNS Wanted' => 'diff_want', 'PPLNS Used' => 'diffacc_total', 'Elapsed Seconds' => 'pplns_elapsed', 'Users' => 'rows', 'Oldest Workinfoid' => 'begin_workinfoid', 'Oldest Time' => 'begin_stamp', 'Oldest Epoch' => 'begin_epoch', 'Block Workinfoid' => 'block_workinfoid', 'Block Time' => 'block_stamp', 'Block Epoch' => 'block_epoch', 'Newest Workinfoid' => 'end_workinfoid', 'Newest Share Time' => 'end_stamp', 'Newest Share Epoch' => 'end_epoch', 'Network Difficulty' => 'block_ndiff', 'PPLNS Factor' => 'diff_times', 'PPLNS Added' => 'diff_add', 'Share Count' => 'share_count'); $pg = '
Blockchain '.$ans['block']."
\n"; $pg .= "
\n"; $pg .= ''; $pg .= ''; $pg .= ''; $pg .= "\n"; $i = 0; foreach ($data as $dsp => $name) { if (($i++ % 2) == 0) $row = 'even'; else $row = 'odd'; $pg .= ""; $pg .= ""; $pg .= ''; $pg .= "\n"; } $pg .= "
NameValue
$dsp'.$ans[$name].'

\n"; $pg .= ''; $pg .= ''; $pg .= ''; $pg .= ''; $pg .= ''; $pg .= ''; $pg .= ''; $pg .= ''; $pg .= "\n"; $diffacc_total = $ans['diffacc_total']; if ($diffacc_total == 0) $diffacc_total = pow(10,15); $reward = $ans['block_reward'] / pow(10,8); $elapsed = $ans['pplns_elapsed']; $count = $ans['rows']; $tot_btc = 0; $tot_pay = 0; for ($i = 0; $i < $count; $i++) { $diffacc_user = $ans['diffacc_user:'.$i]; $diffacc_percent = number_format(100.0 * $diffacc_user / $diffacc_total, 2).'%'; $base_btc = $reward * $diffacc_user / $diffacc_total; $diffacc_btc = number_format($base_btc, 8); $avg_hash = number_format($diffacc_user / $elapsed * pow(2,32), 0); $pay_btc = $base_btc * 0.985; $dsp_btc = number_format($pay_btc, 8); $payaddress = $ans['payaddress:'.$i]; if (($i % 2) == 0) $row = 'even'; else $row = 'odd'; $pg .= ""; $pg .= ''; $pg .= ""; $pg .= ""; $pg .= ""; $pg .= ""; $pg .= ""; $pg .= ""; $pg .= "\n"; $tot_btc += $base_btc; $tot_pay += $pay_btc; } if (($i % 2) == 0) $row = 'even'; else $row = 'odd'; $pg .= ""; $pg .= ''; $pg .= ""; $pg .= ''; $pg .= ''; $pg .= ''; $pg .= "\n"; $pg .= "
UserDiff Accepted%Base BTCAvg HashrateBTC -1.5%Address
'.$ans['user:'.$i].'$diffacc_user$diffacc_percent$diffacc_btc$avg_hash$dsp_btc$payaddress
".number_format($tot_btc,8)."'.number_format($pay_btc,8).'
\n"; } return $pg; } # function show_pplns($page, $menu, $name, $user) { gopage(NULL, 'dopplns', $page, $menu, $name, $user); } # ?>