You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
110 lines
2.4 KiB
110 lines
2.4 KiB
<?php |
|
# |
|
function stnum($num) |
|
{ |
|
$b4 = ''; |
|
$af = ''; |
|
$fmt = number_format($num, 0); |
|
if ($num > 99999999) |
|
$b4 = '<span class=urg>'; |
|
else if ($num > 9999999) |
|
$b4 = '<span class=warn>'; |
|
if ($b4 != '') |
|
$af = '</span>'; |
|
return $b4.$fmt.$af; |
|
} |
|
# |
|
function dopplns($data, $user) |
|
{ |
|
global $send_sep; |
|
|
|
$pg = '<h1>CKPool</h1>'; |
|
|
|
$blk = getparam('blk', true); |
|
if (nuem($blk)) |
|
{ |
|
$pg = "<br> |
|
<form action=index.php method=POST> |
|
<input type=hidden name=k value=pplns> |
|
Block: <input type=text name=blk size=10 value=''> |
|
<input type=submit name=Calc value=Calc> |
|
</form>"; |
|
} |
|
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 '<font color=red size=+1><br>'.$ans['STATUS'].': '.$ans['ERROR'].'</font>'; |
|
|
|
$data = array( 'Block' => 'block', |
|
'PPLNS Wanted' => 'diff_want', |
|
'PPLNS Used' => 'diffacc_total', |
|
'Elapsed Seconds' => 'pplns_elapsed', |
|
'Users' => 'rows', |
|
'Oldest Workinfoid' => 'begin_workinfoid', |
|
'Oldest Time' => 'begin_stamp', |
|
'Block Workinfoid' => 'block_workinfoid', |
|
'Block Time' => 'block_stamp', |
|
'Newest Workinfoid' => 'end_workinfoid', |
|
'Newest Time' => 'end_stamp', |
|
'Network Difficulty' => 'block_ndiff', |
|
'PPLNS Factor' => 'diff_times', |
|
'PPLNS Added' => 'diff_add', |
|
'Share Count' => 'share_count'); |
|
|
|
$pg = "<br><table callpadding=0 cellspacing=0 border=0>\n"; |
|
$pg .= '<tr class=title>'; |
|
$pg .= '<td class=dl>Name</td>'; |
|
$pg .= '<td class=dr>Value</td>'; |
|
$pg .= "</tr>\n"; |
|
$i = 0; |
|
foreach ($data as $dsp => $name) |
|
{ |
|
if (($i++ % 2) == 0) |
|
$row = 'even'; |
|
else |
|
$row = 'odd'; |
|
|
|
$pg .= "<tr class=$row>"; |
|
$pg .= "<td class=dl>$dsp</td>"; |
|
$pg .= '<td class=dr>'.$ans[$name].'</td>'; |
|
$pg .= "</tr>\n"; |
|
} |
|
|
|
$pg .= "</table><br><table callpadding=0 cellspacing=0 border=0>\n"; |
|
$pg .= '<tr class=title>'; |
|
$pg .= '<td class=dl>User</td>'; |
|
$pg .= '<td class=dr>Diff Accepted</td>'; |
|
$pg .= "</tr>\n"; |
|
$count = $ans['rows']; |
|
for ($i = 1; $i <= $count; $i++) |
|
{ |
|
if (($i % 2) == 0) |
|
$row = 'even'; |
|
else |
|
$row = 'odd'; |
|
|
|
$pg .= "<tr class=$row>"; |
|
$pg .= '<td class=dl>'.$ans['user'.$i].'</td>'; |
|
$pg .= '<td class=dr>'.$ans['diffacc_user'.$i].'</td>'; |
|
$pg .= "</tr>\n"; |
|
} |
|
$pg .= "</table>\n"; |
|
} |
|
|
|
return $pg; |
|
} |
|
# |
|
function show_pplns($menu, $name, $user) |
|
{ |
|
gopage(NULL, 'dopplns', $menu, $name, $user); |
|
} |
|
# |
|
?>
|
|
|