getState('yaamp-algo'); if($algo == 'all') return; echo "
"; echo "
Pool Stats ($algo)
"; echo "
"; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; $t1 = time() - 60*60; $t2 = time() - 24*60*60; $t3 = time() - 7*24*60*60; $t4 = time() - 30*24*60*60; $total1 = 0; $total2 = 0; $total3 = 0; $total4 = 0; $main_ids = array(); $algo = user()->getState('yaamp-algo'); $list = dbolist("SELECT coin_id FROM blocks WHERE coin_id IN (select id from coins where algo=:algo and enable=1 and visible=1) AND time>$t4 AND category!='orphan' GROUP BY coin_id ORDER BY coin_id DESC", array(':algo'=>$algo) ); foreach($list as $item) { $coin = getdbo('db_coins', $item['coin_id']); $id = $coin->id; $main_ids[$id] = $coin->symbol; if($coin->symbol == 'BTC') continue; $res1 = controller()->memcache->get_database_row("history_item1-$id-$algo", "SELECT COUNT(*) as a, SUM(amount*price) as b FROM blocks WHERE coin_id=$id AND category!='orphan' AND time>$t1 AND algo=:algo", array(':algo'=>$algo)); $res2 = controller()->memcache->get_database_row("history_item2-$id-$algo", "SELECT COUNT(*) as a, SUM(amount*price) as b FROM blocks WHERE coin_id=$id AND category!='orphan' AND time>$t2 AND algo=:algo", array(':algo'=>$algo)); $res3 = controller()->memcache->get_database_row("history_item3-$id-$algo", "SELECT COUNT(*) as a, SUM(amount*price) as b FROM blocks WHERE coin_id=$id AND category!='orphan' AND time>$t3 AND algo=:algo", array(':algo'=>$algo)); $res4 = controller()->memcache->get_database_row("history_item4-$id-$algo", "SELECT COUNT(*) as a, SUM(amount*price) as b FROM blocks WHERE coin_id=$id AND category!='orphan' AND time>$t4 AND algo=:algo", array(':algo'=>$algo)); $total1 += $res1['b']; $total2 += $res2['b']; $total3 += $res3['b']; $total4 += $res4['b']; $name = substr($coin->name, 0, 12); echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; } $others = dbolist("SELECT id, image, symbol, name FROM coins WHERE algo=:algo AND installed=1 AND enable=1 AND auto_ready=1 AND visible=1 ORDER BY symbol", array(':algo'=>$algo) ); foreach($others as $item) { if (array_key_exists($item['id'], $main_ids)) continue; echo ''; echo ''; echo ''; echo ''; echo ''; } /////////////////////////////////////////////////////////////////////// $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 ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ""; /////////////////////////////////////////////////////////////////////// echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; /////////////////////////////////////////////////////////////////////// echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
NameLast HourLast 24 HoursLast 7 DaysLast 30 Days
'.$name.''.$res1['a'].''.$res2['a'].''.$res3['a'].''.$res4['a'].'
'.$item['name'].'
BTC Value'.$total1.''.$total2.''.$total3.''.$total4.'
Avg Hashrate'.$hashrate1.'h/s'.$hashrate2.'h/s'.$hashrate3.'h/s'.$hashrate4.'h/s
mBTC/Mh/d'.$btcmhday1.''.$btcmhday2.''.$btcmhday3.''.$btcmhday4.'
'; echo '
'; echo '
'; echo '

';