diff --git a/pool/page_allwork.php b/pool/page_allwork.php new file mode 100644 index 00000000..ac1d9471 --- /dev/null +++ b/pool/page_allwork.php @@ -0,0 +1,43 @@ +All Workers'; + + $pg .= "\n"; + + $totshare = 0; + $totdiff = 0; + $totinvalid = 0; + $totrate = 0; + $offset = 0; + + $pg .= worktitle($data, $user); + + $ans = getAllUsers(); + if ($ans['STATUS'] == 'ok') + { + $count = $ans['rows']; + for ($i = 0; $i < $count; $i++) + { + $pg .= workuser($data, $ans['username:'.$i], + $offset, $totshare, $totdiff, + $totinvalid, $totrate, 3600); + } + } + + $pg .= worktotal($offset, $totshare, $totdiff, $totinvalid, $totrate); + + $pg .= "
\n"; + + return $pg; +} +# +function show_allwork($page, $menu, $name, $user) +{ + gopage(NULL, 'doallwork', $page, $menu, $name, $user); +} +# +?> diff --git a/pool/page_workers.php b/pool/page_workers.php index 4eb8707b..625630e6 100644 --- a/pool/page_workers.php +++ b/pool/page_workers.php @@ -1,62 +1,47 @@ '; + $pg .= 'Worker Name'; + $pg .= 'Work Diff'; + $pg .= 'Last Share'; + $pg .= 'Shares'; + $pg .= 'Diff'; + $pg .= 'Invalid'; + $pg .= 'Hash Rate'; + $pg .= "\n"; + return $pg; +} +# +function workuser($data, $user, &$offset, &$totshare, &$totdiff, + &$totinvalid, &$totrate, $old = false) { - $pg = '

Workers

'; - $ans = getWorkers($user); - $pg .= "\n"; - $pg .= ""; - $pg .= ""; -// $pg .= ""; -// $pg .= ""; -// $pg .= ""; - $pg .= ""; - $pg .= ""; - $pg .= ""; - $pg .= ""; - $pg .= ""; - $pg .= ""; - $pg .= "\n"; - $tsh = 0; - $tdif = 0; - $tinv = 0; - $thr = 0; - $i = 0; + $pg = ''; if ($ans['STATUS'] == 'ok') { $count = $ans['rows']; for ($i = 0; $i < $count; $i++) { - if (($i % 2) == 0) + $lst = $ans['STAMP'] - $ans['w_lastshare:'.$i]; + if ($old !== false && $lst > $old) + continue; + + if ((($offset) % 2) == 0) $row = 'even'; else $row = 'odd'; $pg .= ""; $pg .= ''; -/* - $pg .= ''; - $nots = $ans['idlenotificationenabled:'.$i]; - switch ($nots) - { - case 'Y': - case 'y': - $nots = 'Y'; - break; - default: - $nots = 'N'; - } - $pg .= ''; - $pg .= ''; -*/ if ($ans['w_lastdiff:'.$i] > 0) $ld = difffmt($ans['w_lastdiff:'.$i]); else $ld = ' '; $pg .= ""; - $lst = $ans['STAMP'] - $ans['w_lastshare:'.$i]; + if ($lst < 60) $lstdes = $lst.'s'; else @@ -90,9 +75,9 @@ function doworker($data, $user) $pg .= ""; $shareacc = number_format($ans['w_shareacc:'.$i], 0); - $tsh += $ans['w_shareacc:'.$i]; + $totshare += $ans['w_shareacc:'.$i]; $diffacc = number_format($ans['w_diffacc:'.$i], 0); - $tdif += $ans['w_diffacc:'.$i]; + $totdiff += $ans['w_diffacc:'.$i]; $pg .= ""; $pg .= ""; @@ -101,7 +86,7 @@ function doworker($data, $user) $rej = number_format(100.0 * $ans['w_diffinv:'.$i] / $dtot, 3); else $rej = '0'; - $tinv += $ans['w_diffinv:'.$i]; + $totinvalid += $ans['w_diffinv:'.$i]; $pg .= ""; @@ -113,7 +98,7 @@ function doworker($data, $user) $uhr = '?GHs'; else { - $thr += $uhr; + $totrate += $uhr; $uhr /= 10000000; if ($uhr < 0.01) $uhr = '0GHs'; @@ -128,34 +113,62 @@ function doworker($data, $user) $pg .= ""; $pg .= "\n"; + + $offset++; } } - $thr /= 10000000; - if ($thr < 0.01) - $thr = '0GHs'; + return $pg; +} +# +function worktotal($offset, $totshare, $totdiff, $totinvalid, $totrate) +{ + $pg = ''; + $totrate /= 10000000; + if ($totrate < 0.01) + $totrate = '0GHs'; else { - if ($thr < 100000) - $thr = number_format(round($thr)/100,2).'GHs'; + if ($totrate < 100000) + $totrate = number_format(round($totrate)/100,2).'GHs'; else - $thr = number_format(round($thr/1000)/100,2).'THs'; + $totrate = number_format(round($totrate/1000)/100,2).'THs'; } - if (($i % 2) == 0) + if (($offset % 2) == 0) $row = 'even'; else $row = 'odd'; $pg .= ""; - $shareacc = number_format($tsh, 0); + $shareacc = number_format($totshare, 0); $pg .= ""; - $diffacc = number_format($tdif, 0); + $diffacc = number_format($totdiff, 0); $pg .= ""; - $dtot = $tdif + $tinv; + $dtot = $totdiff + $totinvalid; if ($dtot > 0) - $rej = number_format(100.0 * $tinv / $dtot, 3); + $rej = number_format(100.0 * $totinvalid / $dtot, 3); else $rej = '0'; $pg .= ""; - $pg .= "\n"; + $pg .= "\n"; + return $pg; +} +# +function doworker($data, $user) +{ + $pg = '

Workers

'; + + $pg .= "
Worker NameDifficultyIdle NotificationsIdle Notification TimeWork DiffLast ShareSharesDiffInvalidHash Rate
'.$ans['workername:'.$i].''.$ans['difficultydefault:'.$i].''.$nots.''.$ans['idlenotificationtime:'.$i].'$ld$lstdes$shareacc$diffacc$rej%$uhr
Total:$shareacc$diffacc$rej%$thr
$totrate
\n"; + + $totshare = 0; + $totdiff = 0; + $totinvalid = 0; + $totrate = 0; + $offset = 0; + + $pg .= worktitle($data, $user); + $pg .= workuser($data, $user, $offset, $totshare, $totdiff, $totinvalid, + $totrate, false); + $pg .= worktotal($offset, $totshare, $totdiff, $totinvalid, $totrate); + $pg .= "
\n"; return $pg; diff --git a/pool/prime.php b/pool/prime.php index 3b1dd670..ab73a08e 100644 --- a/pool/prime.php +++ b/pool/prime.php @@ -18,16 +18,21 @@ function process($p, $user) 'Stats' => 'stats', 'Blocks' => 'blocks' ), + 'Admin' => NULL, 'gap' => NULL, 'Help' => array( 'Help' => 'help', 'Payouts' => 'payout' ) ); - if ($user == 'Kano' || $user == 'ckolivas' || $user == 'aphorise') - $menu['Help']['ckp'] = 'ckp'; if ($user == 'Kano' || $user == 'ckolivas' || $user == 'wvr2' || $user == 'aphorise') - $menu['Pool']['PPLNS'] = 'pplns'; + { + $menu['Admin']['ckp'] = 'ckp'; + $menu['Admin']['PPLNS'] = 'pplns'; + $menu['Admin']['AllWork'] = 'allwork'; + } + else + unset($menu['Admin']); $page = ''; $n = ''; foreach ($menu as $item => $options)