<?php

$percent = 16;
$user = getuserparam(getparam('address'));
if (!$user) {
    return;
}
$algo = getparam('algo');
if (empty($algo)) {
    $algo = user()->getState('yaamp-algo');
}
$target = yaamp_hashrate_constant($algo);
$step = 15 * 60;
$t = time() - 24 * 60 * 60;
$stats = getdbolist('db_hashuser', "time>{$t} and algo=:algo and userid={$user->id} order by time", array(':algo' => $algo));
$averages = array();
echo '[[';
for ($i = $t + $step, $j = 0; $i < time(); $i += $step) {
    if ($i != $t + $step) {
        echo ',';
    }
    $m = 0;
    if ($i + $step >= time()) {
        $m = round(yaamp_user_rate($user->id, $algo) / 1000000, 3);
        //	debuglog("last $m");
    } else {
        if (isset($stats[$j]) && $i > $stats[$j]->time) {
            $m = round($stats[$j]->hashrate / 1000000, 3);
            $j++;
        }
    }
Exemple #2
0
 public function actionUnblockuser()
 {
     if (!$this->admin) {
         return;
     }
     $wallet = getparam('wallet');
     $user = getuserparam($wallet);
     $user->is_locked = false;
     $user->save();
     $this->redirect('/site/monsters');
 }
Exemple #3
0
<?php

$algo = user()->getState('yaamp-algo');
JavascriptFile("/extensions/jqplot/jquery.jqplot.js");
JavascriptFile("/extensions/jqplot/plugins/jqplot.dateAxisRenderer.js");
JavascriptFile("/extensions/jqplot/plugins/jqplot.barRenderer.js");
JavascriptFile("/extensions/jqplot/plugins/jqplot.highlighter.js");
$height = '240px';
$wallet = user()->getState('yaamp-wallet');
$user = getuserparam($wallet);
echo <<<end

<table cellspacing=20 width=100%>
<tr><td valign=top width=50%>

<div id='mining_results'>
<br><br><br><br><br><br><br><br><br><br>
</div>

<div id='main_miners_results'>
<br><br><br><br><br><br><br><br><br><br>
</div>

<div class="main-left-box">
<div class="main-left-title">Last 24 Hours Hashrate ({$algo})</div>
<div class="main-left-inner"><br>
<div id='graph_results_hashrate' style='height: {$height};'></div><br>
</div></div><br>

<div class="main-left-box">
<div class="main-left-title">Last 24 Hours Estimate ({$algo})</div>
Exemple #4
0
END;
}
echo <<<END
<div class="main-left-box">
<div class="main-left-title">Search Wallet:</div>
<div class="main-left-inner">
<form action="/" method="get" style="padding: 10px;">
<input type="text" name="address" class="main-text-input" placeholder="Wallet Address">
<input type="submit" value="Submit" class="main-submit-button" ><br><br>
END;
echo "<table class='dataGrid2'>";
foreach ($recents as $address) {
    if (empty($address)) {
        continue;
    }
    $user = getuserparam($address);
    if (!$user) {
        continue;
    }
    $coin = getdbo('db_coins', $user->coinid);
    if ($user->username == $username) {
        echo "<tr style='background-color: #e0d3e8;'><td width=24>";
    } else {
        echo "<tr class='ssrow'><td width=24>";
    }
    if ($coin) {
        echo "<img width=16 src='{$coin->image}'>";
    } else {
        echo "<img width=16 src='/images/base/delete.png'>";
    }
    echo "</td><td><a href='/?address={$address}' style='font-family: monospace; font-size: 1.1em;'>{$address}</a></td>";
Exemple #5
0
 public function actionWalletEx()
 {
     if (!LimitRequest('api-wallet', 10)) {
         return;
     }
     $wallet = getparam('address');
     $user = getuserparam($wallet);
     if (!$user || $user->is_locked) {
         return;
     }
     $total_unsold = yaamp_convert_earnings_user($user, "status!=2");
     $total_paid = bitcoinvaluetoa(controller()->memcache->get_database_scalar("api_wallet_paid-{$user->id}", "select sum(amount) from payouts where account_id={$user->id}"));
     $balance = bitcoinvaluetoa($user->balance);
     $total_unpaid = bitcoinvaluetoa($balance + $total_unsold);
     $total_earned = bitcoinvaluetoa($total_unpaid + $total_paid);
     $coin = getdbo('db_coins', $user->coinid);
     if (!$coin) {
         return;
     }
     echo "{";
     echo "\"currency\": \"{$coin->symbol}\", ";
     echo "\"unsold\": {$total_unsold}, ";
     echo "\"balance\": {$balance}, ";
     echo "\"unpaid\": {$total_unpaid}, ";
     echo "\"paid\": {$total_paid}, ";
     echo "\"total\": {$total_earned}, ";
     echo "\"miners\": ";
     echo "[";
     $workers = getdbolist('db_workers', "userid={$user->id} order by password");
     foreach ($workers as $i => $worker) {
         $user_rate1 = yaamp_worker_rate($worker->id, $worker->algo);
         $user_rate1_bad = yaamp_worker_rate_bad($worker->id, $worker->algo);
         if ($i) {
             echo ", ";
         }
         echo "{";
         echo "\"version\": \"{$worker->version}\", ";
         echo "\"password\": \"{$worker->password}\", ";
         echo "\"ID\": \"{$worker->worker}\", ";
         echo "\"algo\": \"{$worker->algo}\", ";
         echo "\"difficulty\": {$worker->difficulty}, ";
         echo "\"subscribe\": {$worker->subscribe}, ";
         echo "\"accepted\": {$user_rate1}, ";
         echo "\"rejected\": {$user_rate1_bad}";
         echo "}";
     }
     echo "]";
     echo "}";
 }