本文整理汇总了PHP中Itoa2函数的典型用法代码示例。如果您正苦于以下问题:PHP Itoa2函数的具体用法?PHP Itoa2怎么用?PHP Itoa2使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Itoa2函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
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>";
} else {
echo "<td align=right>{$percent}%</td>";
}
echo "<td align=right>{$block_count}</td>";
echo "<td align=right>{$block_diff}</td>";
echo "<td align=right>{$balance}</td>";
示例2: foreach
echo "<tr class='ssrow'>";
echo "<td><b>{$version}</b></td>";
echo "<td align=right>{$count}</td>";
echo "<td align=right>{$extranonce}</td>";
echo "<td align=right>{$percent}</td>";
echo "<td align=right>{$hashrate}</td>";
echo "<td align=right title='{$title}'>{$bad}</td>";
echo "</tr>";
}
echo "</tbody>";
$title = '';
foreach ($error_tab as $i => $s) {
$invalid2 = dboscalar("select sum(difficulty) * {$target} / {$interval} / 1000 from shares where error={$i} and time>{$delay} and\n\t\tworkerid in (select id from workers where algo=:algo)", array(':algo' => $algo));
if ($invalid2) {
$bad2 = round($invalid2 * 100 / ($total_hashrate + $invalid2), 2) . '%';
$title .= "{$bad2} - {$s}\n";
}
}
$bad = $total_hashrate + $total_invalid ? round($total_invalid * 100 / ($total_hashrate + $total_invalid), 1) . '%' : '';
$total_hashrate = Itoa2($total_hashrate) . 'h/s';
echo "<tr class='ssrow'>";
echo "<td><b>Total</b></td>";
echo "<td align=right>{$total_workers}</td>";
echo "<td align=right>{$total_extranonce}</td>";
echo "<td align=right></td>";
echo "<td align=right>{$total_hashrate}</td>";
echo "<td align=right title='{$title}'>{$bad}</td>";
echo "</tr>";
echo "</table>";
echo "<p style='font-size: .8em'>\n\t\t * approximate from the last 5 minutes submitted shares<br>\n\t\t</p>";
echo "<br></div></div><br>";
示例3: controller
$hashrate1 = controller()->memcache->get_database_scalar("history_hashrate1-{$algo}", "select avg(hashrate) from hashrate where time>{$t1} and algo=:algo", array(':algo' => $algo));
$hashrate2 = controller()->memcache->get_database_scalar("history_hashrate2-{$algo}", "select avg(hashrate) from hashrate where time>{$t2} and algo=:algo", array(':algo' => $algo));
$hashrate3 = controller()->memcache->get_database_scalar("history_hashrate3-{$algo}", "select avg(hashrate) from hashrate where time>{$t3} and algo=:algo", array(':algo' => $algo));
$hashrate4 = controller()->memcache->get_database_scalar("history_hashrate4-{$algo}", "select avg(hashrate) from hashstats where time>{$t4} and algo=:algo", array(':algo' => $algo));
$hashrate1 = max($hashrate1, 1);
$hashrate2 = max($hashrate2, 1);
$hashrate3 = max($hashrate3, 1);
$hashrate4 = max($hashrate4, 1);
$btcmhday1 = mbitcoinvaluetoa($total1 / $hashrate1 * 1000000 * 24 * 1000);
$btcmhday2 = mbitcoinvaluetoa($total2 / $hashrate2 * 1000000 * 1 * 1000);
$btcmhday3 = mbitcoinvaluetoa($total3 / $hashrate3 * 1000000 / 7 * 1000);
$btcmhday4 = mbitcoinvaluetoa($total4 / $hashrate4 * 1000000 / 30 * 1000);
$hashrate1 = Itoa2($hashrate1);
$hashrate2 = Itoa2($hashrate2);
$hashrate3 = Itoa2($hashrate3);
$hashrate4 = Itoa2($hashrate4);
$total1 = bitcoinvaluetoa($total1);
$total2 = bitcoinvaluetoa($total2);
$total3 = bitcoinvaluetoa($total3);
$total4 = bitcoinvaluetoa($total4);
echo "<tr class='ssrow' style='border-top: 2px solid #eee;'>";
echo "<td width=18><img width=16 src='/images/btc.png'></td>";
echo "<td><b>BTC Value</b></td>";
echo "<td align=right style='font-size: .9em;'>{$total1}</td>";
echo "<td align=right style='font-size: .9em;'>{$total2}</td>";
echo "<td align=right style='font-size: .9em;'>{$total3}</td>";
echo "<td align=right style='font-size: .9em;'>{$total4}</td>";
echo "</tr>";
///////////////////////////////////////////////////////////////////////
echo "<tr class='ssrow' style='border-top: 2px solid #eee;'>";
echo "<td width=18></td>";
示例4: time
$t3 = time() - 30 * 24 * 60 * 60;
$row1 = dborow("select avg(hashrate) as a, sum(earnings) as b from hashstats where time>{$t1} and algo=:algo", array(':algo' => $algo));
$row2 = dborow("select avg(hashrate) as a, sum(earnings) as b from hashstats where time>{$t2} and algo=:algo", array(':algo' => $algo));
$row3 = dborow("select avg(hashrate) as a, sum(earnings) as b from hashstats where time>{$t3} and algo=:algo", array(':algo' => $algo));
if ($row1['a'] > 0 && $row2['a'] > 0 && $row3['a'] > 0) {
$btcmhday1 = bitcoinvaluetoa($row1['b'] / $row1['a'] * 1000000 / 2);
$btcmhday2 = bitcoinvaluetoa($row2['b'] / $row2['a'] * 1000000 / 7);
$btcmhday3 = bitcoinvaluetoa($row3['b'] / $row3['a'] * 1000000 / 30);
} else {
$btcmhday1 = 0;
$btcmhday2 = 0;
$btcmhday3 = 0;
}
$hashrate1 = Itoa2($row1['a']);
$hashrate2 = Itoa2($row2['a']);
$hashrate3 = Itoa2($row3['a']);
$total1 = bitcoinvaluetoa($row1['b']);
$total2 = bitcoinvaluetoa($row2['b']);
$total3 = bitcoinvaluetoa($row3['b']);
$height = '240px';
$algos = yaamp_get_algos();
$string = '';
foreach ($algos as $a) {
if ($a == $algo) {
$string .= "<option value='{$a}' selected>{$a}</option>";
} else {
$string .= "<option value='{$a}'>{$a}</option>";
}
}
echo <<<end
示例5: getdbolist
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>";
echo "<td>{$user_bad}</td>";
if ($percent > 50) {
echo "<td align=right><b>{$percent}%</b></td>";
} else {
示例6: show_orders
function show_orders(&$allorders, &$services, $btcmhd = 0)
{
$algo = user()->getState('yaamp-algo');
$price = controller()->memcache->get_database_scalar("current_price-{$algo}", "select price from hashrate where algo=:algo order by time desc limit 1", array(':algo' => $algo));
foreach ($allorders as $i => $order) {
if ($order['price'] < $btcmhd) {
continue;
}
if ($order['workers'] <= 0 && !isset($order['me'])) {
continue;
}
if ($order['speed'] <= 0 && !isset($order['me'])) {
continue;
}
$service_btcmhd = mbitcoinvaluetoa($order['price']);
$hash = Itoa2($order['speed'] * 1000000000) . 'h/s';
$limit = Itoa2($order['limit'] * 1000000000) . 'h/s';
$btc = round($order['btc'] * 1000, 1);
$profit = $price > $service_btcmhd ? round(($price - $service_btcmhd) / $service_btcmhd * 100) . '%' : '';
show_services($services, $service_btcmhd);
if (isset($order['me'])) {
echo "<tr class='ssrow' style='background-color: #dfd'>";
} else {
echo "<tr class='ssrow'>";
}
echo "<td></td>";
echo "<td><b>{$hash}</b> ({$order['workers']})</td>";
echo "<td align=right style='font-size: .8em;'>{$limit}</td>";
echo "<td align=right style='font-size: .8em;'>{$btc}</td>";
echo "<td align=right style='font-size: .8em;'><b>{$profit}</b></td>";
echo "<td></td>";
echo "<td></td>";
echo "<td align=right style='font-size: .8em;'><b>{$service_btcmhd}</b></td>";
echo "</tr>";
unset($allorders[$i]);
}
}
示例7: round
echo " x";
}
if ($coin->block_height < $coin->target_height) {
$percent = round($coin->block_height * 100 / $coin->target_height, 2);
echo "<br><span style='font-size: .8em'>{$percent}%</span>";
}
}
echo "</b></td>";
$version = substr($coin->version, 0, 25);
echo "<td><b><a href='/site/coin?id={$coin->id}'>{$coin->name} ({$coin->symbol})</a></b>\n\t\t<br><span style='font-size: .8em'>{$version} ({$coin->symbol2})</span></td>";
echo "<td>{$coin->rpchost}:{$coin->rpcport}";
if ($coin->connections) {
echo " ({$coin->connections})";
}
echo "<br><span style='font-size: .8em'>{$coin->rpcencoding} <span style='background-color:{$algo_color};'> ({$coin->algo}) </span></span></td>";
$difficulty = Itoa2($coin->difficulty, 3);
if (!empty($coin->errors)) {
echo "<td align=right style='color: red; font-size: .9em;' title='{$coin->errors}'><b>{$difficulty}</b><br>{$coin->block_height}</td>";
} else {
echo "<td align=right style='font-size: .9em'><b>{$difficulty}</b><br>{$coin->block_height}</td>";
}
// $network_ttf = $coin->network_ttf? sectoa($coin->network_ttf): '';
// $actual_ttf = $coin->actual_ttf? sectoa($coin->actual_ttf): '';
// $pool_ttf = $coin->pool_ttf? sectoa($coin->pool_ttf): '';
$btcmhd = yaamp_profitability($coin);
$btcmhd = mbitcoinvaluetoa($btcmhd);
$h = $coin->block_height - 100;
$ss1 = dboscalar("select count(*) from blocks where coin_id={$coin->id} and height>={$h} and category!='orphan'");
$ss2 = dboscalar("select count(*) from blocks where coin_id={$coin->id} and height>={$h} and category='orphan'");
$percent_pool1 = $ss1 ? $ss1 . '%' : '';
$percent_pool2 = $ss2 ? $ss2 . '%' : '';
示例8: bitcoinvaluetoa
$price = bitcoinvaluetoa($coin->price);
$height = number_format($coin->block_height, 0, '.', ' ');
// $pool_ttf = $coin->pool_ttf? sectoa2($coin->pool_ttf): '';
$pool_ttf = $total_rate ? $coin->difficulty * 0x100000000 / $total_rate : 0;
$reward = round($coin->reward, 3);
$btcmhd = yaamp_profitability($coin);
$pool_hash = yaamp_coin_rate($coin->id);
$real_ttf = $pool_hash ? $coin->difficulty * 0x100000000 / $pool_hash : 0;
$pool_hash = $pool_hash ? Itoa2($pool_hash) . 'h/s' : '';
$real_ttf = $real_ttf ? sectoa2($real_ttf) : '';
$pool_ttf = $pool_ttf ? sectoa2($pool_ttf) : '';
$pool_hash_pow = yaamp_pool_rate_pow($coin->algo);
$pool_hash_pow = $pool_hash_pow ? Itoa2($pool_hash_pow) . 'h/s' : '';
$min_ttf = $coin->network_ttf > 0 ? min($coin->actual_ttf, $coin->network_ttf) : $coin->actual_ttf;
$network_hash = $coin->difficulty * 0x100000000 / ($min_ttf ? $min_ttf : 60);
$network_hash = $network_hash ? 'network hash ' . Itoa2($network_hash) . 'h/s' : '';
if (controller()->admin && $services) {
foreach ($services as $i => $service) {
if ($service->price * 1000 < $btcmhd) {
continue;
}
$service_btcmhd = mbitcoinvaluetoa($service->price * 1000);
echo "<tr class='ssrow'>";
echo "<td width=18><img width=16 src='/images/btc.png'></td>";
echo "<td><b>{$service->name}</b></td>";
echo "<td></td>";
echo "<td></td>";
echo "<td></td>";
echo "<td></td>";
echo "<td></td>";
echo "<td align=right style='font-size: .8em;'><b>{$service_btcmhd}</b></td>";
示例9: getdbolist
echo "<th>Address</th>";
echo "<th>Algo</th>";
echo "<th>Host</th>";
echo "<th>Max Price</th>";
echo "<th>Max Hash</th>";
echo "<th>Current Hash</th>";
echo "<th>Difficulty</th>";
echo "<th>Ready</th>";
echo "<th>Active</th>";
echo "</tr>";
echo "</thead><tbody>";
$list = getdbolist('db_jobs', "ready");
foreach ($list as $job) {
$hashrate = yaamp_job_rate($job->id);
$hashrate = $hashrate ? Itoa2($hashrate) . 'h/s' : '';
$speed = Itoa2($job->speed) . 'h/s';
$renter = getdbo('db_renters', $job->renterid);
if (!$renter) {
continue;
}
if ($deposit == $renter->address) {
echo "<tr class='ssrow' style='background-color: #dfd'>";
} else {
echo "<tr class='ssrow'>";
}
echo "<td>{$job->renterid}</td>";
echo "<td>{$job->id}</td>";
echo "<td><a href='/renting?address={$renter->address}'>{$renter->address}</a></td>";
echo "<td>{$job->algo}</td>";
echo "<td>{$job->host}:{$job->port}</td>";
echo "<td>{$job->price}</td>";
示例10: foreach
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 "</tr>";
}
echo "</table>";
}
示例11: foreach
foreach ($algos as $item) {
$norm = $item[0];
$algo = $item[1];
$count1 = getdbocount('db_jobs', "algo=:algo and ready and active", array(':algo' => $algo));
$count2 = getdbocount('db_jobs', "algo=:algo and ready", array(':algo' => $algo));
$total = yaamp_pool_rate($algo);
$hashrate = yaamp_pool_rate_rentable($algo);
$hashrate_jobs = yaamp_rented_rate($algo);
$hashrate = min($total, $hashrate);
$hashrate_jobs = min($hashrate, $hashrate_jobs);
$available = $hashrate - $hashrate_jobs;
$percent = $hashrate_jobs && $hashrate ? '(' . round($hashrate_jobs / $hashrate * 100, 1) . '%)' : '';
$hashrate_jobs = $hashrate_jobs > 0 ? Itoa2($hashrate_jobs) . 'h/s' : '';
$available = $available > 0 ? Itoa2($available) . 'h/s' : '';
$hashrate = $hashrate > 0 ? Itoa2($hashrate) . 'h/s' : '';
$total = $total > 0 ? Itoa2($total) . 'h/s' : '';
$renting = controller()->memcache->get_database_scalar("current_renting-{$algo}", "select rent from hashrate where algo=:algo order by time desc limit 1", array(':algo' => $algo));
$renting = mbitcoinvaluetoa($renting);
if ($defaultalgo == $algo) {
echo "<tr style='cursor: pointer; background-color: #e0d3e8;' onclick='javascript:select_algo(\"{$algo}\")'>";
} else {
echo "<tr style='cursor: pointer' class='ssrow' onclick='javascript:select_algo(\"{$algo}\")'>";
}
echo "<td><b>{$algo}</b></td>";
echo "<td align=right style='font-size: .9em;'>{$count1} / {$count2}</td>";
// echo "<td align=right style='font-size: .9em;'>$total</td>";
echo "<td align=right style='font-size: .9em;' title='pool hashrate {$total}'>{$hashrate}</td>";
echo "<td align=right style='font-size: .9em;'>{$hashrate_jobs}</td>";
echo "<td align=right style='font-size: .8em;'>{$percent}</td>";
echo "<td align=right style='font-size: .9em;'>{$available}</td>";
// echo "<td align=right style='font-size: .9em;'>$price</td>";
示例12: getdbo
echo "<td align=right style='font-size: .8em'></td>";
echo "<td align=right style='font-size: .8em'></td>";
echo "<td align=right style='font-size: .8em'>{$d} ago</td>";
echo "<td align=right style='font-size: .8em'>";
echo "<span style='padding: 2px; color: white; background-color: #5cb85c'>Confirmed</span>";
echo "</td>";
echo "</tr>";
continue;
}
$coin = getdbo('db_coins', $db_block->coin_id);
if (!$coin) {
debuglog("coin not found {$db_block->coin_id}");
continue;
}
$height = number_format($db_block->height, 0, '.', ' ');
$diff = Itoa2($db_block->difficulty, 3);
$algo_color = getAlgoColors($coin->algo);
echo "<tr style='background-color:{$algo_color};'>";
echo "<td width=18><img width=16 src='{$coin->image}'></td>";
echo "<td><b><a href='/site/coin?id={$coin->id}'>{$coin->name}</a></b></td>";
echo "<td align=right style='font-size: .8em'>{$db_block->amount} {$coin->symbol}</td>";
echo "<td align=right style='font-size: .8em' title='found {$db_block->difficulty_user}'>{$diff}</td>";
echo "<td align=right style='font-size: .8em'>{$height}</td>";
echo "<td align=right style='font-size: .8em'>{$d} ago</td>";
echo "<td align=right style='font-size: .8em'>";
if ($db_block->category == 'orphan') {
echo "<span style='padding: 2px; color: white; background-color: #d9534f'>Orphan</span>";
} else {
if ($db_block->category == 'immature') {
echo "<span style='padding: 2px; color: white; background-color: #f0ad4e'>Immature ({$db_block->confirmations})</span>";
} else {
示例13: cmp
}
function cmp($a, $b)
{
return $a[0] < $b[0];
}
usort($algos, 'cmp');
$total_coins = 0;
$total_miners = 0;
echo "<tbody>";
foreach ($algos as $item) {
$norm = $item[0];
$algo = $item[1];
$coins = getdbocount('db_coins', "enable and visible and auto_ready and algo=:algo", array(':algo' => $algo));
$count = getdbocount('db_workers', "algo=:algo", array(':algo' => $algo));
$hashrate = controller()->memcache->get_database_scalar("current_hashrate-{$algo}", "select hashrate from hashrate where algo=:algo order by time desc limit 1", array(':algo' => $algo));
$hashrate = $hashrate ? Itoa2($hashrate) . 'h/s' : '-';
$price = controller()->memcache->get_database_scalar("current_price-{$algo}", "select price from hashrate where algo=:algo order by time desc limit 1", array(':algo' => $algo));
$price = $price ? mbitcoinvaluetoa(take_yaamp_fee($price, $algo)) : '-';
$norm = mbitcoinvaluetoa($norm);
$t = time() - 24 * 60 * 60;
$avgprice = controller()->memcache->get_database_scalar("current_avgprice-{$algo}", "select avg(price) from hashrate where algo=:algo and time>{$t}", array(':algo' => $algo));
$avgprice = $avgprice ? mbitcoinvaluetoa(take_yaamp_fee($avgprice, $algo)) : '-';
$total1 = controller()->memcache->get_database_scalar("current_total-{$algo}", "select sum(amount*price) from blocks where category!='orphan' and time>{$t} and algo=:algo", array(':algo' => $algo));
$hashrate1 = controller()->memcache->get_database_scalar("current_hashrate1-{$algo}", "select avg(hashrate) from hashrate where time>{$t} and algo=:algo", array(':algo' => $algo));
// $btcmhday1 = $hashrate1 != 0? mbitcoinvaluetoa($total1 / $hashrate1 * 1000000 * 1000): '-';
if ($algo == 'sha256') {
$btcmhday1 = $hashrate1 != 0 ? mbitcoinvaluetoa($total1 / $hashrate1 * 1000000 * 1000000) : '';
} else {
$btcmhday1 = $hashrate1 != 0 ? mbitcoinvaluetoa($total1 / $hashrate1 * 1000000 * 1000) : '';
}
$fees = yaamp_fee($algo);
示例14: yaamp_hashrate_constant
$target = yaamp_hashrate_constant($algo);
$interval = yaamp_hashrate_step();
$delay = time() - $interval;
echo "<br><table class='dataGrid'>";
echo "<thead>";
echo "<tr>";
echo "<th>Version</th>";
echo "<th>Workers</th>";
echo "<th>Hashrate</th>";
echo "<th>Bad</th>";
echo "<th></th>";
echo "</tr>";
echo "</thead><tbody>";
$versions = dbolist("select version, count(*) as c from workers where algo=:algo group by version", array(':algo' => $algo));
foreach ($versions as $item) {
$version = $item['version'];
$count = $item['c'];
$hashrate = dboscalar("select sum(difficulty) * {$target} / {$interval} / 1000 from shares where valid and time>{$delay} and \r\n\t\tworkerid in (select id from workers where algo=:algo and version=:version)", array(':algo' => $algo, ':version' => $version));
$invalid = dboscalar("select sum(difficulty) * {$target} / {$interval} / 1000 from shares where not valid and time>{$delay} and \r\n\t\tworkerid in (select id from workers where algo=:algo and version=:version)", array(':algo' => $algo, ':version' => $version));
$percent = $hashrate ? round($invalid * 100 / $hashrate, 3) : 0;
$hashrate = Itoa2($hashrate) . 'h/s';
$invalid = Itoa2($invalid) . 'h/s';
echo "<tr class='ssrow'>";
echo "<td><b>{$version}</b></td>";
echo "<td>{$count}</td>";
echo "<td>{$hashrate}</td>";
echo "<td>{$invalid}</td>";
echo "<td align=right>{$percent}%</td>";
echo "</tr>";
}
echo "</tbody></table>";
示例15: getdbolist
echo "<th>Connections</th>";
echo "<th>Network Hash</th>";
echo "<th></th>";
echo "</tr>";
echo "</thead><tbody>";
$list = getdbolist('db_coins', "enable and visible order by name");
foreach ($list as $coin) {
if ($coin->symbol == 'BTC') {
continue;
}
if (!empty($coin->symbol2)) {
continue;
}
$coin->version = substr($coin->version, 0, 20);
$difficulty = Itoa2($coin->difficulty, 3);
$nethash = $coin->network_hash ? Itoa2($coin->network_hash) . 'h' : '';
echo "<tr class='ssrow'>";
echo "<td><img src='{$coin->image}' width=18></td>";
echo "<td><b><a href='/explorer?id={$coin->id}'>{$coin->name}</a></b></td>";
echo "<td><b>{$coin->symbol}</b></td>";
echo "<td>{$coin->algo}</td>";
echo "<td>{$coin->version}</td>";
echo "<td>{$coin->block_height}</td>";
echo "<td>{$difficulty}</td>";
echo "<td>{$coin->connections}</td>";
echo "<td>{$nethash}</td>";
echo "<td>";
if (!empty($coin->link_bitcointalk)) {
echo "<a href='{$coin->link_bitcointalk}' target=_blank>forum</a> ";
}
echo "</td>";