Skip to content

Commit

Permalink
Several fixes (layout, stats, transaction view).
Browse files Browse the repository at this point in the history
  • Loading branch information
glv2 committed Apr 28, 2014
1 parent 469f3fe commit 86abd7d
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 24 deletions.
17 changes: 8 additions & 9 deletions index.php
Expand Up @@ -49,29 +49,28 @@


$net_speed = getnetworkhashps ();
}
?>
<div id="site_menu">
<p class="center"></p>
<center>Explore the Peercoin blockchain by looking for a Block Number (Index), Block Hash, or Transaction ID.</center>
<div class="menu_item">
<form action="<?php $_SERVER["PHP_SELF"]; ?>" method="post">
<form action="index.php" method="post">
<label for="block_height" class="menu_desc">Enter a Block Number</label><br>
<input class="form-control" type="text" name="block_height" id="block_height">
<input class="btn btn-success" type="submit" name="submit" value="Jump To Block">
</form>
</div>

<div class="menu_item">
<form action="/index.php" method="post">
<form action="index.php" method="post">
<label for="block_hash" class="menu_desc">Enter a Block Hash</label><br>
<input class="form-control" type="text" name="block_hash" id="block_hash">
<input class="btn btn-success" type="submit" name="submit" value="Jump To Block">
</form>
</div>

<div class="menu_item">
<form action="/index.php" method="post">
<form action="index.php" method="post">
<label for="transaction" class="menu_desc">Enter a Transaction ID</label><br>
<input class="form-control" type="text" name="transaction" id="transaction">
<input class="btn btn-success" type="submit" name="submit" value="Jump To TX">
Expand Down Expand Up @@ -100,7 +99,7 @@
$totalblocks = intval($network_info["blocks"]);

// POS:POW Ratio
$ratio1 = ratio($POS1, $POW1);
$ratio1 = ratio($POS1, $POW1);
$ratio24 = ratio($POS24, $POW24);
?>

Expand All @@ -111,10 +110,11 @@
<dd>
<?php
if (intval($net_speed) < 1024) {
echo "".number_format($net_speed,2)." MH/s";
echo "".number_format($net_speed,2)." GH/s";
} else {
$net_speed = number_format(($net_speed / 1024),2);
echo "".$net_speed." GH/s";
echo "".$net_speed." TH/s";
}
?>
</dd>
</dl>
Expand Down Expand Up @@ -156,7 +156,7 @@
</dl>
<dl>
<dt>Total Blocks:</dt>
<dd><?php echo number_format($totalblocks, 0 , '.' , ','); ?>Blocks</dd>
<dd><?php echo number_format($totalblocks, 0 , '.' , ','); ?></dd>
</dl>
<dl>
<dt>PoS Blocks (last 1h/24h):</dt>
Expand All @@ -183,7 +183,6 @@


<?php

}

site_footer ();
Expand Down
2 changes: 1 addition & 1 deletion src/PPC_daemon.php
Expand Up @@ -120,7 +120,7 @@ function getnetworkhashps ()

// This function returns a string containing the calculated
// network hash rate for the latest block
return ($info["netmhashps"]);
return ($info["networkghps"]);
}

/**
Expand Down
5 changes: 4 additions & 1 deletion src/PPC_layout.php
@@ -1,5 +1,7 @@
<?php

date_default_timezone_set("UTC");

/**
* Output the site header HTML
*
Expand Down Expand Up @@ -114,7 +116,8 @@ function tx_detail ($tx_id)

detail_display ("TX Type", $txout["scriptPubKey"]["type"]);

detail_display ("Required Sigs", $txout["scriptPubKey"]["reqSigs"]);
if (isset ($txout["scriptPubKey"]["reqSigs"]))
detail_display ("Required Sigs", $txout["scriptPubKey"]["reqSigs"]);

detail_display ("Script Pub Key (ASM)", $txout["scriptPubKey"]["asm"], 50);

Expand Down
14 changes: 11 additions & 3 deletions src/stats_controller.php
Expand Up @@ -65,22 +65,30 @@ function get_num_pos($hours)
$POScoins = 0;
$POWcoins = 0;
$POS = 0;
$POW = 0;
$avgPOScoins = 0;
$avgPOWcoins = 0;
while ($iblock != intval($currentblock))
{
$flag = block_flag($iblock);
$coins = block_mint($iblock);
if ($flag == "proof-of-stake")
if (strpos($flag ,"proof-of-stake") !== false)
{
$POS++;
$POScoins += $coins;
}
else {
$POW++;
$POWcoins += $coins;
}
$iblock++;
}
return array($POS, $POScoins , $POWcoins);

if ($POS > 0)
$avgPOScoins = $POScoins / $POS;
if ($POW > 0)
$avgPOWcoins = $POWcoins / $POW;

return array($POS, $POW, $POScoins, $POWcoins, $avgPOScoins, $avgPOWcoins);
}

//Find the flag for a block
Expand Down
15 changes: 5 additions & 10 deletions src/views/site_header.php
Expand Up @@ -10,16 +10,11 @@

function startRefresh() {
setTimeout(startRefresh, 10000);
var turl = 'https://btc-e.com/api/2/ppc_usd/ticker';
var murl = 'http://coinmarketcap.northpole.ro/api/usd/ppc.json';
$.getJSON('http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20json%20where%20url%3D%22' + encodeURIComponent(turl) + '%22&format=json', function (data) {
jQuery('#ticker').html('$');
jQuery('#ticker').append(data['query'].results.ticker.last);
jQuery('#ticker').append(' PPC/USD');
});
$.getJSON('http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20json%20where%20url%3D%22' + encodeURIComponent(murl) + '%22&format=json&callback=?', function(data) {
jQuery('#marketcap').html('$');
jQuery('#marketcap').append(data.query.results.json.marketCap);
var murl = 'http://coinmarketcap.northpole.ro/api/usd/ppc.json';
$.getJSON('http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20json%20where%20url%3D%22' + encodeURIComponent(murl) + '%22&format=json&callback=?', function(data) {
jQuery('#ticker').html(data.query.results.json.price);
jQuery('#ticker').append(' USD');
jQuery('#marketcap').html(data.query.results.json.marketCap);
jQuery('#marketcap').append(' USD');
});
}
Expand Down

0 comments on commit 86abd7d

Please sign in to comment.