";
}
$mining = getdbosql('db_mining');
$defaultalgo = user()->getState('yaamp-algo');
$show_details = getparam('showdetails');
$user = getuserparam(getparam('address'));
if(!$user) return;
WriteBoxHeader("Wallet: $user->username");
$refcoin = getdbo('db_coins', $user->coinid);
if(!$refcoin)
{
if($user->coinid != null)
echo "
This wallet address is not valid.
You will not receive payments using this address.
";
$refcoin = getdbosql('db_coins', "symbol='BTC'");
} elseif (!YAAMP_ALLOW_EXCHANGE && $user->coinid == 6 && $defaultalgo != 'sha256') {
echo "
This pool does not convert/trade currencies.
You will not receive payments using this BTC address.
";
return;
}
echo "
";
echo "";
echo "";
echo " | ";
echo "Name | ";
echo "Immature | ";
echo "Confirmed | ";
echo "Total | ";
echo "Value* | ";
echo "
";
echo "";
$total_pending = 0;
if($show_details)
{
$t1 = microtime(true);
$list = dbolist("select coinid from earnings where userid=$user->id group by coinid");
if(!count($list))
echo " | -none- |
";
else
{
// sort by value
foreach($list as $item)
{
$coin = getdbo('db_coins', $item['coinid']);
if(!$coin) continue;
$name = substr($coin->name, 0, 12);
$confirmed = controller()->memcache->get_database_scalar("wallet_confirmed-$user->id-$coin->id",
"select sum(amount) from earnings where status=1 and userid=$user->id and coinid=$coin->id");
$unconfirmed = controller()->memcache->get_database_scalar("wallet_unconfirmed-$user->id-$coin->id",
"select sum(amount) from earnings where status=0 and userid=$user->id and coinid=$coin->id");
$total = $confirmed + $unconfirmed;
// $value = bitcoinvaluetoa($total * $coin->price / $refcoin->price);
$value = bitcoinvaluetoa(yaamp_convert_amount_user($coin, $total, $user));
$confirmed = altcoinvaluetoa($confirmed);
$unconfirmed = altcoinvaluetoa($unconfirmed);
$total = altcoinvaluetoa($total);
echo "";
echo " | ";
echo "$name ($coin->algo) | ";
echo "$unconfirmed | ";
echo "$confirmed | ";
echo "$total | ";
echo "$value $refcoin->symbol | ";
echo "
";
}
}
$d1 = microtime(true) - $t1;
controller()->memcache->add_monitoring_function('wallet_results-1', $d1);
}
//////////////////////////////////////////////////////////////////////////////
// $confirmed = bitcoinvaluetoa(controller()->memcache->get_database_scalar("wallet_confirmed-$user->id",
// "select sum(amount*price) from earnings where status=1 and userid=$user->id"))/$refcoin->price;
// $unconfirmed = bitcoinvaluetoa(controller()->memcache->get_database_scalar("wallet_unconfirmed-$user->id",
// "select sum(amount*price) from earnings where status=0 and userid=$user->id"))/$refcoin->price;
$confirmed = yaamp_convert_earnings_user($user, "status=1");
$unconfirmed = yaamp_convert_earnings_user($user, "status=0");
$total_unsold = bitcoinvaluetoa($confirmed + $unconfirmed);
$confirmed = $confirmed? bitcoinvaluetoa($confirmed): '';
$unconfirmed = $unconfirmed? bitcoinvaluetoa($unconfirmed): '';
//$total_usd = number_format($total_unsold*$mining->usdbtc*$refcoin->price, 3, '.', ' ');
$total_pending = bitcoinvaluetoa($total_pending);
if(!$show_details && $total_unsold > 0)
{
echo "
|
";
}
echo "";
echo " | ";
echo "";
if($refcoin->symbol == 'BTC')
echo "$refcoin->name";
else
echo "$refcoin->name";
echo " (total pending) | ";
echo "$unconfirmed | ";
echo "$confirmed | ";
echo " | ";
echo "$total_unsold $refcoin->symbol | ";
echo "
";
echo " |
";
// ////////////////////////////////////////////////////////////////////////////
$balance = bitcoinvaluetoa($user->balance);
//$balance_usd = number_format($user->balance*$mining->usdbtc*$refcoin->price, 3, '.', ' ');
echo "";
echo " | ";
echo "Balance | ";
echo " | ";
echo "$balance $refcoin->symbol | ";
echo "
";
////////////////////////////////////////////////////////////////////////////
$total_unpaid = bitcoinvaluetoa($balance + $total_unsold);
//$total_unpaid_usd = number_format($total_unpaid*$mining->usdbtc*$refcoin->price, 3, '.', ' ');
echo "";
echo " | ";
echo "Total Unpaid | ";
echo " | ";
echo "$total_unpaid $refcoin->symbol | ";
echo "
";
////////////////////////////////////////////////////////////////////////////
$total_paid = controller()->memcache->get_database_scalar("wallet_total_paid-$user->id",
"select sum(amount) from payouts where account_id=$user->id");
$total_paid = bitcoinvaluetoa($total_paid);
//$total_paid_usd = number_format($total_paid*$mining->usdbtc*$refcoin->price, 3, '.', ' ');
echo "";
echo " | ";
echo "Total Paid | ";
echo " | ";
echo "$total_paid $refcoin->symbol | ";
echo "
";
////////////////////////////////////////////////////////////////////////////
//$delay = 7*24*60*60;
$total_earned = bitcoinvaluetoa($total_unsold + $balance + $total_paid);
//$total_earned_usd = number_format($total_earned*$mining->usdbtc*$refcoin->price, 3, '.', ' ');
echo "";
echo " | ";
echo "Total Earned | ";
echo " | ";
echo "$total_earned $refcoin->symbol | ";
echo "
";
echo "
";
echo "
";
$usd = number_format($mining->usdbtc, 2, '.', ' ');
echo "