goback(); $PoS = ($coin->algo == 'PoS'); // or if 'stake' key is present in 'getinfo' method $remote = new Bitcoin($coin->rpcuser, $coin->rpcpasswd, $coin->rpchost, $coin->rpcport); $reserved1 = dboscalar("select sum(balance) from accounts where coinid=$coin->id"); $reserved2 = dboscalar("select sum(amount*price) from earnings where status!=2 and userid in (select id from accounts where coinid=$coin->id)"); $reserved = bitcoinvaluetoa(($reserved1 + $reserved2) * 2); $reserved1 = altcoinvaluetoa($reserved1); $reserved2 = bitcoinvaluetoa($reserved2); $balance = altcoinvaluetoa($coin->balance); $owed = dboscalar("select sum(amount) from earnings where status!=2 and coinid=$coin->id"); $owed_btc = $owed? bitcoinvaluetoa($owed*$coin->price): ''; $owed = $owed? altcoinvaluetoa($owed): ''; echo "cleared $reserved1, earnings $reserved2, reserved $reserved, balance $balance, owed $owed, owned btc $owed_btc

"; ////////////////////////////////////////////////////////////////////////////////////// $list = getdbolist('db_markets', "coinid=$coin->id order by price desc"); echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; $bestmarket = getBestMarket($coin); foreach($list as $market) { $marketurl = '#'; $price = bitcoinvaluetoa($market->price); $price2 = bitcoinvaluetoa($market->price2); $marketurl = getMarketUrl($coin, $market->name); if($bestmarket && $market->id == $bestmarket->id) echo ""; else echo ""; echo ""; echo ""; echo ""; $sent = datetoa2($market->lastsent); $traded = datetoa2($market->lasttraded); $late = $market->lastsent > $market->lasttraded ? 'late': ''; echo ''; echo ''; echo ''; echo ''; echo ""; echo ""; } echo "
NamePricePrice2SentTradedLateDepositMessage
$market->name$price$price2'.(empty($sent) ? "" : "$sent ago").''.(empty($traded) ? "" : "$traded ago").''.$late.''; echo "edit "; echo "sell "; echo "del"; echo ' '.$market->deposit_address.'$market->message

"; ////////////////////////////////////////////////////////////////////////////////////// $info = $remote->getinfo(); if (!empty($info)) { $stake = isset($info['stake'])? $info['stake']: ''; if ($stake !== '') $PoS = true; } echo ""; //showTableSorter('maintable'); echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; if ($PoS) echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; if($coin->enable) echo ""; else echo ""; echo ''; echo ''; echo ''; if(!$info) { echo ""; echo "
NameSymbolAlgoDifficultyBlocksBalanceBTCStakeConnsPriceRewardIndex *
[ + ][    ]'.$coin->name.''.$coin->symbol.''.$coin->algo.'ERROR $remote->error
"; return; } $errors = isset($info['errors'])? $info['errors']: ''; $balance = isset($info['balance'])? $info['balance']: ''; $txfee = isset($info['paytxfee'])? $info['paytxfee']: ''; $connections = isset($info['connections'])? $info['connections']: ''; $blocks = isset($info['blocks'])? $info['blocks']: ''; echo ''.$coin->difficulty.''; if(!empty($errors)) echo "$blocks"; else echo "$blocks"; echo ''.altcoinvaluetoa($balance).''; $btc = bitcoinvaluetoa($balance*$coin->price); echo "$btc"; if ($PoS) echo ''.$stake.''; echo "$connections"; echo ''.bitcoinvaluetoa($coin->price).''; echo ''.$coin->reward.''; $index = ''; if($coin->difficulty) $index = round($coin->reward * $coin->price / $coin->difficulty * 10000, 3); echo ''.$index.''; echo ''; echo ''; echo '
'; ////////////////////////////////////////////////////////////////////////////////////// echo << tr.ssrow.orphan { color: darkred; } end; // last week $list_since = time()-(7*24*3600); $txs = $remote->listtransactions('', 2500); $txs_array = array(); $lastday = ''; if (!empty($txs)) { // to hide truncated days sums $tx = reset($txs); if (count($txs) == 2500) $lastday = strftime('%F', $tx['time']); if (!empty($txs)) foreach($txs as $tx) { if (intval($tx['time']) > $list_since) $txs_array[] = $tx; } krsort($txs_array); } $rows = 0; foreach($txs_array as $tx) { $block = null; if(isset($tx['blockhash'])) $block = $remote->getblock($tx['blockhash']); $d = datetoa2($tx['time']); $category = $tx['category']; echo ''; echo ''; echo ''; echo ''; if($block) { echo ''; } else echo ''; if(isset($tx['confirmations'])) echo ''; else echo ''; echo ''; echo ''; echo ''; $rows++; if ($rows > 15) break; } echo '
Time Category Amount Height Difficulty Confirm Address Tx(s)
'.$d.''.$category.''.$tx['amount'].''.$block['height'].''.$block['difficulty'].''.$tx['confirmations'].''; if(isset($tx['address'])) { $address = $tx['address']; echo $address.'
'; } echo '
'; if(!empty($block)) foreach($block['tx'] as $i => $txid) { $label = substr($txid, 0, 7); echo CHtml::link($label, '/explorer?id='.$coin->id.'&txid='.$txid, array('target'=>'_blank')); if (count($block['tx']) > 5) { echo ' ('.count($block['tx']).')'; break; } else { echo ' '; } } echo '
'; ////////////////////////////////////////////////////////////////////////////////////// echo << end; $sums = array(); foreach($txs_array as $tx) { $day = strftime('%F', $tx['time']); // YYYY-MM-DD if ($day == $lastday) break; // do not show truncated days $key = $day.' '.$tx['category']; $sums[$key] = arraySafeVal($sums, $key) + $tx['amount']; } foreach($sums as $key => $amount) { $keys = explode(' ', $key); $day = substr($keys[0], 5); // remove year $category = $keys[1]; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; } if (empty($sums)) { echo ''; echo ''; echo ''; } echo '
Day Category Sum BTC
'.$day.''.$category.''.$amount.''.bitcoinvaluetoa($coin->price * $amount).'
No activity during the last 7 days
';