Skip to content

Commit

Permalink
re-ordered server stats so it makes a little more sense
Browse files Browse the repository at this point in the history
  • Loading branch information
tomlightspeed committed Jun 21, 2011
1 parent 9718bf0 commit 471546c
Showing 1 changed file with 26 additions and 25 deletions.
51 changes: 26 additions & 25 deletions stats.php
Expand Up @@ -82,17 +82,17 @@ function CoinsPerDay( $time_per_block, $btc_block ){
{
echo "&nbsp;<img src=\"/images/crown.png\" />";
}

$user_hash_rate = $resultrow->hashrate;

echo "</td><td>" . $username . "</td><td>" . number_format( $user_hash_rate ) . "</td><td>&nbsp;";

$time_per_block = CalculateTimePerBlock($difficulty, $user_hash_rate);

$coins_day = CoinsPerDay($time_per_block, $BTC_per_block);

echo number_format( $coins_day, 3 );

echo "</td></tr>";

$rank++;
Expand All @@ -110,15 +110,15 @@ function CoinsPerDay( $time_per_block, $btc_block ){
mysql_query( $query_init );
$result = mysql_query( $query_getrank );
$row = mysql_fetch_array( $result );

$user_hashrate = $row['hashrate'];

echo "<tr class=\"user_position\"><td>" . $row['rank'] . "</td><td>" . $userInfo->username . "</td><td>" . number_format( $user_hashrate ) . "</td><td>";

$time_per_block = CalculateTimePerBlock($difficulty, $user_hashrate);

$coins_day = CoinsPerDay($time_per_block, $BTC_per_block);

echo number_format( $coins_day, 3 ) . "</td></tr>";
}
?>
Expand Down Expand Up @@ -186,6 +186,18 @@ function CoinsPerDay( $time_per_block, $btc_block ){
// START SERVER STATS *************************************************************************************************************************
echo "<tr><th colspan=\"2\" scope=\"col\">Server Stats</td></tr>";

$hashrate = $settings->getsetting('currenthashrate');
$show_hashrate = round($hashrate / 1000,3);

echo "<tr><td class=\"leftheader\">Pool Hash Rate</td><td>". number_format($show_hashrate, 3) . " Ghashes/s</td></tr>";

$res = mysql_query("SELECT count(webUsers.id) FROM webUsers WHERE hashrate > 0") or sqlerr(__FILE__, __LINE__);
$row = mysql_fetch_array($res);
$users = $row[0];

echo "<tr><td class=\"leftheader\">Current Users Mining</td><td>" . number_format($users) . "</td></tr>";
echo "<tr><td class=\"leftheader\">Current Total Miners</td><td>" . number_format($settings->getsetting('currentworkers')) . "</td></tr>";

$current_block_no = $bitcoinController->query("getblocknumber");

echo "<tr><td class=\"leftheader\">Current Block</td><td><a href=\"http://blockexplorer.com/b/" . $current_block_no . "\">";
Expand Down Expand Up @@ -214,31 +226,20 @@ function CoinsPerDay( $time_per_block, $btc_block ){
}

echo "</td></tr>";

$time_last_found = $resultrow->timestamp;

echo "<tr><td class=\"leftheader\">Time Found</td><td>".strftime("%B %d %Y %r", $time_last_found)."</td></tr>";

$show_time_since_found = true;
}

$res = mysql_query("SELECT count(webUsers.id) FROM webUsers WHERE hashrate > 0") or sqlerr(__FILE__, __LINE__);
$row = mysql_fetch_array($res);
$users = $row[0];

echo "<tr><td class=\"leftheader\">Current Users Mining</td><td>" . number_format($users) . "</td></tr>";
echo "<tr><td class=\"leftheader\">Current Total Miners</td><td>" . number_format($settings->getsetting('currentworkers')) . "</td></tr>";

$hashrate = $settings->getsetting('currenthashrate');
$show_hashrate = round($hashrate / 1000,3);

$time_to_find = CalculateTimePerBlock($difficulty, $hashrate);
// change 25.75 hours to 25:45 hours
$intpart = floor( $time_to_find );
$fraction = $time_to_find - $intpart; // results in 0.75
$minutes = number_format(($fraction * 60 ),0);

echo "<tr><td class=\"leftheader\">Pool Hash Rate</td><td>". number_format($show_hashrate, 3) . " Ghashes/s</td></tr>";
echo "<tr><td class=\"leftheader\">Est. Time To Find Block</td><td>" . number_format($time_to_find,0) . " Hours " . $minutes . " Minutes</td></tr>";

$now = new DateTime( "now" );
Expand Down Expand Up @@ -294,7 +295,7 @@ function CoinsPerDay( $time_per_block, $btc_block ){
echo "</thead><tbody>";
echo "</tbody></table>";
*/
/*
<table>
Expand Down Expand Up @@ -323,7 +324,7 @@ function CoinsPerDay( $time_per_block, $btc_block ){
</tbody>
</table>
*/

echo "</div><div class=\"clear\"></div>";

include("includes/footer.php");
Expand Down

0 comments on commit 471546c

Please sign in to comment.