if (count($workers)) {
    echo "<br>";
    echo "<table  class='dataGrid2'>";
    echo "<thead>";
    echo "<tr>";
    echo "<th align=left>Details</th>";
    echo "<th align=left>Extra</th>";
    echo "<th align=left>Algo</th>";
    echo "<th align=right>Diff</th>";
    echo "<th align=right title='extranonce.subscribe'>ES**</th>";
    echo "<th align=right width=80>Hashrate*</th>";
    echo "<th align=right width=60>Reject*</th>";
    echo "</tr>";
    echo "</thead>";
    foreach ($workers as $worker) {
        $user_rate1 = yaamp_worker_rate($worker->id, $worker->algo);
        $user_rate1_bad = yaamp_worker_rate_bad($worker->id, $worker->algo);
        $percent = $user_rate1 + $user_rate1_bad ? $user_rate1_bad * 100 / ($user_rate1 + $user_rate1_bad) : 0;
        $percent = $percent ? round($percent, 1) . '%' : '';
        $user_rate1 = $user_rate1 ? Itoa2($user_rate1) . 'h/s' : '';
        $version = substr($worker->version, 0, 16);
        $password = substr($worker->password, 0, 16);
        $subscribe = Booltoa($worker->subscribe);
        echo "<tr class='ssrow'>";
        echo "<td title='{$worker->version}'>{$version}</td>";
        echo "<td title='{$worker->password}'>{$password}</td>";
        echo "<td>{$worker->algo}</td>";
        echo "<td align=right>{$worker->difficulty}</td>";
        echo "<td align=right>{$subscribe}</td>";
        echo "<td align=right>{$user_rate1}</td>";
        echo "<td align=right>{$percent}</td>";
echo "<thead>";
echo "<tr>";
echo "<th>Wallet</th>";
echo "<th>Pass</th>";
echo "<th>Client</th>";
echo "<th>Version</th>";
echo "<th>Diff</th>";
echo "<th>Hashrate</th>";
echo "<th>Bad</th>";
echo "<th></th>";
//echo "<th>Nonce1</th>";
echo "</tr>";
echo "</thead><tbody>";
$workers = getdbolist('db_workers', "algo=:algo order by name", array(':algo' => $algo));
foreach ($workers as $worker) {
    $user_rate = yaamp_worker_rate($worker->id);
    $user_bad = yaamp_worker_rate_bad($worker->id);
    $percent = $user_rate + $user_bad ? round($user_bad * 100 / ($user_rate + $user_bad), 3) : 0;
    $user_rate = Itoa2($user_rate) . 'h/s';
    $user_bad = Itoa2($user_bad) . 'h/s';
    $dns = !empty($worker->dns) ? $worker->dns : $worker->ip;
    if (strlen($worker->dns) > 40) {
        $dns = '...' . substr($worker->dns, strlen($worker->dns) - 40);
    }
    echo "<tr class='ssrow'>";
    echo "<td><a href='/?address={$worker->name}'><b>{$worker->name}</b></a></td>";
    echo "<td>{$worker->password}</td>";
    echo "<td title='{$worker->ip}'>{$dns}</td>";
    echo "<td>{$worker->version}</td>";
    echo "<td>{$worker->difficulty}</td>";
    echo "<td>{$user_rate}</td>";
Beispiel #3
0
 public function actionWalletEx()
 {
     if (!LimitRequest('api-wallet', 10)) {
         return;
     }
     $wallet = getparam('address');
     $user = getuserparam($wallet);
     if (!$user || $user->is_locked) {
         return;
     }
     $total_unsold = yaamp_convert_earnings_user($user, "status!=2");
     $total_paid = bitcoinvaluetoa(controller()->memcache->get_database_scalar("api_wallet_paid-{$user->id}", "select sum(amount) from payouts where account_id={$user->id}"));
     $balance = bitcoinvaluetoa($user->balance);
     $total_unpaid = bitcoinvaluetoa($balance + $total_unsold);
     $total_earned = bitcoinvaluetoa($total_unpaid + $total_paid);
     $coin = getdbo('db_coins', $user->coinid);
     if (!$coin) {
         return;
     }
     echo "{";
     echo "\"currency\": \"{$coin->symbol}\", ";
     echo "\"unsold\": {$total_unsold}, ";
     echo "\"balance\": {$balance}, ";
     echo "\"unpaid\": {$total_unpaid}, ";
     echo "\"paid\": {$total_paid}, ";
     echo "\"total\": {$total_earned}, ";
     echo "\"miners\": ";
     echo "[";
     $workers = getdbolist('db_workers', "userid={$user->id} order by password");
     foreach ($workers as $i => $worker) {
         $user_rate1 = yaamp_worker_rate($worker->id, $worker->algo);
         $user_rate1_bad = yaamp_worker_rate_bad($worker->id, $worker->algo);
         if ($i) {
             echo ", ";
         }
         echo "{";
         echo "\"version\": \"{$worker->version}\", ";
         echo "\"password\": \"{$worker->password}\", ";
         echo "\"ID\": \"{$worker->worker}\", ";
         echo "\"algo\": \"{$worker->algo}\", ";
         echo "\"difficulty\": {$worker->difficulty}, ";
         echo "\"subscribe\": {$worker->subscribe}, ";
         echo "\"accepted\": {$user_rate1}, ";
         echo "\"rejected\": {$user_rate1_bad}";
         echo "}";
     }
     echo "]";
     echo "}";
 }