function showUser($userid, $what) { $user = getdbo('db_accounts', $userid); if (!$user) { return; } $d = datetoa2($user->last_login); $balance = bitcoinvaluetoa($user->balance); $paid = dboscalar("select sum(amount) from payouts where account_id={$user->id}"); $paid = bitcoinvaluetoa($paid); $t = time() - 24 * 60 * 60; $miner_count = getdbocount('db_workers', "userid={$user->id}"); $share_count = getdbocount('db_shares', "userid={$user->id}"); $block_count = getdbocount('db_blocks', "userid={$user->id} and time>{$t}"); $coin = getdbo('db_coins', $user->coinid); echo "<tr class='ssrow'>"; if ($coin) { echo "<td><img src='{$coin->image}' width=16> {$coin->symbol}</td>"; } else { echo "<td></td>"; } echo "<td>{$user->id}</td>"; echo "<td><a href='/site?address={$user->username}'>{$user->username}</a></td>"; echo "<td>{$what}</td>"; echo "<td>{$d}</td>"; echo "<td>{$block_count}</td>"; echo "<td>{$balance}</td>"; if (intval($paid) > 0.01) { echo "<td><b>{$paid}</b></td>"; } else { echo "<td>{$paid}</td>"; } echo "<td>{$miner_count}</td>"; echo "<td>{$share_count}</td>"; if ($user->is_locked) { echo "<td>locked</td>"; echo "<td><a href='/site/unblockuser?wallet={$user->username}'>unblock</a></td>"; } else { echo "<td></td>"; echo "<td><a href='/site/blockuser?wallet={$user->username}'>block</a></td>"; } echo "</tr>"; }
echo "<th></th>"; echo "</tr>"; echo "</thead><tbody>"; $total_balance = 0; $total_paid = 0; $total_unsold = 0; foreach ($users as $user) { $target = yaamp_hashrate_constant(); $interval = yaamp_hashrate_step(); $delay = time() - $interval; $user_rate = dboscalar("select sum(difficulty) * {$target} / {$interval} / 1000 from shares where valid and time>{$delay} and userid={$user->id}"); $user_bad = dboscalar("select sum(difficulty) * {$target} / {$interval} / 1000 from shares where not valid and time>{$delay} and userid={$user->id}"); $percent = $user_rate ? round($user_bad * 100 / $user_rate, 3) : 0; $balance = bitcoinvaluetoa($user->balance); $paid = dboscalar("select sum(amount) from payouts where account_id={$user->id}"); $d = datetoa2($user->last_login); $miner_count = getdbocount('db_workers', "userid={$user->id}"); $block_count = getdbocount('db_blocks', "userid={$user->id}"); $block_diff = $paid ? round(dboscalar("select sum(difficulty) from blocks where userid={$user->id}") / $paid, 3) : '?'; $paid = bitcoinvaluetoa($paid); $user_rate = Itoa2($user_rate); $user_bad = Itoa2($user_bad); echo "<tr class='ssrow'>"; echo "<td>{$user->id}</td>"; echo "<td><a href='/?address={$user->username}'><b>{$user->username}</b></a></td>"; echo "<td>{$d}</td>"; echo "<td align=right>{$miner_count}</td>"; echo "<td align=right>{$user_rate}</td>"; echo "<td align=right>{$user_bad}</td>"; if ($percent > 50) { echo "<td align=right><b>{$percent}%</b></td>";
echo "<p style='font-size: .8em'>\r\n\t * approximate from current exchange rates<br>\r\n\t ** bitstamp <b>{$usd}</b> USD/BTC\r\n\t</p>"; echo "</div><br>"; WriteBoxHeader("Last 24 Hours Payouts: {$user->username}"); $t = time() - 24 * 60 * 60; $list = getdbolist('db_payouts', "account_id={$user->id} and time>{$t} order by time desc"); echo "<table class='dataGrid2'>"; echo "<thead>"; echo "<tr>"; echo "<th align=right>Time</th>"; echo "<th align=right>Amount</th>"; echo "<th>Tx</th>"; echo "</tr>"; echo "</thead>"; $total = 0; foreach ($list as $payout) { $d = datetoa2($payout->time); $amount = bitcoinvaluetoa($payout->amount); $payout_tx = substr($payout->tx, 0, 36) . '...'; echo "<tr class='ssrow'>"; echo "<td align=right><b>{$d} ago</b></td>"; echo "<td align=right><b>{$amount}</b></td>"; if ($user->coinid == 6) { $txurl = "https://blockchain.info/tx/{$payout->tx}"; } else { $txurl = "/explorer?id={$user->coinid}&txid={$payout->tx}"; } echo "<td style='font-family: monospace;'><a href='{$txurl}' target=_blank>{$payout_tx}</a></td>"; echo "</tr>"; $total += $payout->amount; } $amount = bitcoinvaluetoa($total);
if (count($list) == 0) { return; } echo "<table class='dataGrid'>"; echo "<thead>"; echo "<tr>"; echo "<th>ID</th>"; echo "<th>Address</th>"; echo "<th align=right>Time</th>"; echo "<th align=right>Type</th>"; echo "<th align=right>Amount</th>"; echo "<th>Tx</th>"; echo "</tr>"; echo "</thead>"; foreach ($list as $tx) { $d = datetoa2($tx->time); $amount = bitcoinvaluetoa($tx->amount); $renter = getdbo('db_renters', $tx->renterid); if (!$renter) { continue; } echo "<tr class='ssrow'>"; echo "<td>{$renter->id}</td>"; echo "<td><a href='/renting?address={$renter->address}'>{$renter->address}</a></td>"; echo "<td align=right><b>{$d} ago</b></td>"; echo "<td align=right title='{$tx->address}'>{$tx->type}</td>"; echo "<td align=right><b>{$amount}</b></td>"; if (strlen($tx->tx) > 32) { $tx_show = substr($tx->tx, 0, 36) . '...'; $txurl = "https://blockchain.info/tx/{$tx->tx}"; echo "<td style='font-family: monospace;'><a href='{$txurl}' target=_blank>{$tx_show}</a></td>";
echo "<table class='dataGrid2'>"; echo "<thead>"; echo "<tr>"; echo "<td></td>"; echo "<th>Name</th>"; echo "<th align=right>Amount</th>"; echo "<th align=right>Percent</th>"; echo "<th align=right>mBTC</th>"; echo "<th align=right>Time</th>"; echo "<th align=right>Status</th>"; echo "</tr>"; echo "</thead>"; foreach ($earnings as $earning) { $coin = getdbo('db_coins', $earning->coinid); $block = getdbo('db_blocks', $earning->blockid); $d = datetoa2($earning->create_time); if (!$coin) { $reward = bitcoinvaluetoa($earning->amount); $value = altcoinvaluetoa($earning->amount * 1000); $percent = $block ? mbitcoinvaluetoa($earning->amount * 100 / $block->amount) : ''; $algo = $block ? $block->algo : ''; echo "<tr class='ssrow'>"; echo "<td width=18><img width=16 src='/images/btc.png'></td>"; echo "<td><b>Rental</b><span style='font-size: .8em'> ({$algo})</span></td>"; echo "<td align=right style='font-size: .8em'><b>{$reward} BTC</b></td>"; echo "<td align=right style='font-size: .8em'>{$percent}%</td>"; echo "<td align=right style='font-size: .8em'>{$value}</td>"; echo "<td align=right style='font-size: .8em'>{$d} ago</td>"; echo "<td align=right style='font-size: .8em'>Cleared</td>"; echo "</tr>"; continue;
$ts = $remote->listtransactions(yaamp_renter_account($renter), 10); $res_array = array(); foreach ($ts as $val) { $t = $val['time']; if ($t < $renter->created) { continue; } $res_array[$t] = $val; } krsort($res_array); $total = 0; foreach ($res_array as $transaction) { if ($transaction['category'] != 'receive') { continue; } $d = datetoa2($transaction['time']); echo "<tr class='ssrow'>"; echo "<td><b>{$d}</b></td>"; echo "<td>{$transaction['amount']}</td>"; if (isset($transaction['confirmations'])) { echo "<td>{$transaction['confirmations']}</td>"; } else { echo "<td></td>"; } echo "<td>"; if (isset($transaction['txid'])) { echo "<span style='font-family: monospace;'><a href='https://blockchain.info/tx/{$transaction['txid']}' target=_blank>{$transaction['txid']}</a></span>"; } echo "</td>"; echo "</tr>"; $total += $transaction['amount'];
echo "<th>BTC</th>"; echo "<th>Nicehash</th>"; echo "<th>Yaamp</th>"; echo "<th>Price</th>"; echo "<th>Speed</th>"; echo "<th>Last Dec</th>"; echo "<th>Workers</th>"; echo "<th>Accepted</th>"; echo "<th>Rejected</th>"; echo "<th></th>"; echo "</tr>"; echo "</thead><tbody>"; $list = getdbolist('db_nicehash'); foreach ($list as $nicehash) { $price2 = mbitcoinvaluetoa(dboscalar("select price from services where algo='{$nicehash->algo}'") * 1000); $d = datetoa2($nicehash->last_decrease); $yaamp = mbitcoinvaluetoa(dboscalar("select price from hashrate where algo='{$nicehash->algo}' order by time desc limit 1")); echo "<tr class='ssrow'>"; echo "<td>{$nicehash->orderid}</td>"; echo "<td>{$nicehash->algo}</td>"; echo "<td>{$nicehash->btc}</td>"; echo "<td>{$price2}</td>"; if ($yaamp > $price2 * 1.1) { echo "<td style='color: #4a4'>{$yaamp}</td>"; } else { echo "<td>{$yaamp}</td>"; } if ($nicehash->price > $yaamp) { echo "<td style='color: #a44'>{$nicehash->price}</td>"; } else { echo "<td>{$nicehash->price}</td>";
//echo "<table class='dataGrid'>"; showTableSorter('maintable'); echo "<thead>"; echo "<tr>"; echo "<th>ID</th>"; echo "<th>User</th>"; echo "<th>Host</th>"; echo "<th>Db</th>"; echo "<th>Idle</th>"; echo "<th>Created</th>"; echo "<th>Last</th>"; echo "<th></th>"; echo "</tr>"; echo "</thead><tbody>"; foreach ($list as $conn) { echo "<tr class='ssrow'>"; $d1 = sectoa($conn->idle); $d2 = datetoa2($conn->created); $d3 = datetoa2($conn->last); $b = Booltoa($conn->last == $last); echo "<td>{$conn->id}</td>"; echo "<td>{$conn->user}</td>"; echo "<td>{$conn->host}</td>"; echo "<td>{$conn->db}</td>"; echo "<td>{$d1}</td>"; echo "<td>{$d2}</td>"; echo "<td>{$d3}</td>"; echo "<td>{$b}</td>"; echo "</tr>"; } echo "</tbody></table><br>";
echo "<th>Transactions</th>"; echo "<th>Confirmations</th>"; echo "<th>Blockhash</th>"; echo "</tr>"; echo "</thead>"; $remote = new Bitcoin($coin->rpcuser, $coin->rpcpasswd, $coin->rpchost, $coin->rpcport); for ($i = $coin->block_height; $i > $coin->block_height - 25; $i--) { $hash = $remote->getblockhash($i); if (!$hash) { continue; } $block = $remote->getblock($hash); if (!$block) { continue; } $d = datetoa2($block['time']); $confirms = isset($block['confirmations']) ? $block['confirmations'] : ''; $tx = count($block['tx']); $diff = $block['difficulty']; // debuglog($block); echo "<tr class='ssrow'>"; echo "<td>{$d}</td>"; echo "<td><a href='/explorer?id={$coin->id}&height={$i}'>{$i}</a></td>"; echo "<td>{$diff}</td>"; echo "<td>{$tx}</td>"; echo "<td>{$confirms}</td>"; echo "<td><span style='font-family: monospace;'><a href='/explorer?id={$coin->id}&hash={$hash}'>{$hash}</a></span></td>"; echo "</tr>"; } echo "</table>"; echo <<<end
continue; } // $remote = new Bitcoin($coin->rpcuser, $coin->rpcpasswd, $coin->rpchost, $coin->rpcport); // $blockext = $remote->getblock($db_block->blockhash); // $tx = $remote->gettransaction($blockext['tx'][0]); // $db_block->category = $tx['details'][0]['category']; if ($db_block->category == 'immature') { echo "<tr style='background-color: #e0d3e8;'>"; } else { echo "<tr class='ssrow'>"; } echo "<td><img width=16 src='{$coin->image}'></td>"; echo "<td><b>{$coin->name} ({$coin->symbol})</b></td>"; // $db_block->confirmations = $blockext['confirmations']; // $db_block->save(); $d = datetoa2($db_block->time); echo "<td><b>{$d} ago</b></td>"; echo "<td>{$db_block->height}</td>"; echo "<td>{$db_block->amount}</td>"; echo "<td>"; if ($db_block->category == 'orphan') { echo "Orphan"; } else { if ($db_block->category == 'immature') { echo "Immature ({$db_block->confirmations})"; } else { if ($db_block->category == 'generate') { echo 'Confirmed'; } } }
if ($order->market == 'bleutrade') { $marketurl = "https://bleutrade.com/exchange/{$coin->symbol}/BTC"; } else { $marketurl = ""; } } } } } } if ($exchange->status == 'waiting') { echo "<tr style='background-color: #e0d3e8;'>"; } else { echo "<tr class='ssrow'>"; } $sent = datetoa2($exchange->send_time) . ' ago'; $received = $exchange->receive_time ? sectoa($exchange->receive_time - $exchange->send_time) : ''; $price = $exchange->price ? bitcoinvaluetoa($exchange->price) : bitcoinvaluetoa($coin->price); $estimate = bitcoinvaluetoa($exchange->price_estimate); $total = $exchange->price ? bitcoinvaluetoa($exchange->quantity * $exchange->price) : bitcoinvaluetoa($exchange->quantity * $coin->price); echo "<td><img width=16 src='{$coin->image}'></td>"; echo "<td><b><a href='/site/coin?id={$coin->id}'>{$coin->name} ({$coin->symbol})</a></b></td>"; echo "<td><b><a href='{$marketurl}' target=_blank>{$exchange->market}</a></b></td>"; echo "<td>{$sent}</td>"; echo "<td>{$exchange->quantity}</td>"; echo "<td>{$estimate}</td>"; echo "<td>{$price}</td>"; echo $total > 0.01 ? "<td><b>{$total}</b></td>" : "<td>{$total}</td>"; echo "<td>"; if ($exchange->status == 'waiting') { // echo "<a href='/site/clearexchange?id=$exchange->id'>[clear]</a>";
foreach ($earnings as $earning) { // if(!$earning) debuglog($earning); $coin = getdbo('db_coins', $earning->coinid); if (!$coin) { continue; } $user = getdbo('db_accounts', $earning->userid); if (!$user) { continue; } $block = getdbo('db_blocks', $earning->blockid); if (!$block) { continue; } $t1 = datetoa2($earning->create_time) . ' ago'; $t2 = datetoa2($earning->mature_time) . ' ago'; echo "<tr class='ssrow'>"; echo "<td><img width=16 src='{$coin->image}'></td>"; echo "<td><b>{$coin->name} ({$coin->symbol_show})</b></td>"; echo "<td><b>{$user->username}</b></td>"; echo "<td>{$earning->amount}</td>"; echo "<td>{$block->height}</td>"; echo "<td>{$block->category} ({$block->confirmations}) {$earning->status}</td>"; echo "<td>{$t1} {$t2}</td>"; echo "<td>\r\n\t\t<a href='/site/clearearning?id={$earning->id}'>[clear]</a>\r\n\t\t<a href='/site/deleteearning?id={$earning->id}'>[delete]</a>\r\n\t\t</td>"; // echo "<td style='font-size: .7em'>$earning->tx</td>"; echo "</tr>"; // if($block->category == 'generate' && $earning->status == 0) // { // $earning->status = 1; // $earning->mature_time = time()-100*60;
echo "</thead><tbody>"; $total_active = 0; $total_installed = 0; $coins = getdbolist('db_coins', "1 order by id desc"); foreach ($coins as $coin) { // if($coin->symbol == 'BTC') continue; if ($coin->enable) { $total_active++; } if ($coin->installed) { $total_installed++; } $coin->errors = substr($coin->errors, 0, 30); $coin->version = substr($coin->version, 0, 20); $difficulty = Itoa2($coin->difficulty, 3); $d = datetoa2($coin->created); echo "<tr class='ssrow' title='{$coin->specifications}'>"; echo "<td><img src='{$coin->image}' width=18></td>"; echo "<td><b><a href='/coin/update?id={$coin->id}'>{$coin->name}</a></b></td>"; if ($this->admin) { echo "<td><b><a href='/site/update?id={$coin->id}'>{$coin->symbol}</a></b></td>"; } else { echo "<td><b>{$coin->symbol}</b></td>"; } echo "<td>{$coin->algo}</td>"; if ($coin->enable) { echo "<td>running</td>"; } else { if ($coin->installed) { echo "<td>installed</td>"; } else {
foreach ($list as $job) { $hashrate_bad = yaamp_job_rate_bad($job->id); $hashrate = yaamp_job_rate($job->id) + $hashrate_bad; $title_percent = ''; if ($hashrate_bad) { $percent = round($hashrate_bad / $hashrate * 100, 1) . '%'; $hashrate_bad = Itoa2($hashrate_bad) . 'h/s'; $title_percent = "Rejected {$hashrate_bad} ({$percent})"; } $hashrate = $hashrate ? Itoa2($hashrate) . 'h/s' : ''; $maxhash = $job->speed ? Itoa2($job->speed) . 'h/s' : ''; $title = controller()->admin ? "-o stratum+tcp://{$job->host}:{$job->port} -u {$job->username} -p {$job->password}" : ''; $servername = substr($job->host, 0, 22); $price = mbitcoinvaluetoa($job->price); $diff = $job->difficulty > 0 ? round($job->difficulty, 3) : ''; $d = datetoa2($job->time); if ($job->active) { echo "<tr class='ssrow' style='background-color: #dfd'>"; } else { echo "<tr class='ssrow'>"; } if ($renter && $renter->id == $job->renterid) { echo "<td title='{$title}'>{$job->host}</td>"; } else { echo "<td title='{$title}'></td>"; } // echo "<td>$d</td>"; // echo "<td>$job->algo</td>"; echo "<td align=right>{$price}</td>"; echo "<td align=right>{$maxhash}</td>"; echo "<td align=right title='{$title_percent}'>{$hashrate}</td>";