Bitcoin Forum

Alternate cryptocurrencies => Altcoin Discussion => Topic started by: rikkejohn on September 11, 2014, 10:49:32 PM



Title: CallmeJake BlockCrawler removing Network H/s
Post by: rikkejohn on September 11, 2014, 10:49:32 PM
I would appreciate a response to this. does anyone know how to remove the function getnetworkhashps?

Basically, so it does not appear on the Crawler.

I've tried doing it, but I seem to slice off the right hand side of the Crawler, so get no information.

The reason I am asking is I do not have that function as an rpc call, so it just shows up as "error", which looks pretty stupid.

Sorry to post the whole file, but if anyone answers, it might be that they spot it right away without ever having used the BC


____________


<?php

   require_once ("bc_daemon.php");
   require_once ("bc_layout.php");
   
   
//   If a block hash was provided the block detail is shown
   if (isset ($_REQUEST["block_hash"]))
   {
      site_header ("Block Detail Page");
      
      block_detail ($_REQUEST["block_hash"], TRUE);
   }
   
//   If a block height is provided the block detail is shown
   elseif (isset ($_REQUEST["block_height"]))
   {
      site_header ("Block Detail Page");
      
      block_detail ($_REQUEST["block_height"]);
   }
   
//   If a TXid was provided the TX Detail is shown
   elseif (isset ($_REQUEST["transaction"]))
   {
      site_header ("Transaction Detail Page");
      
      tx_detail ($_REQUEST["transaction"]);
   }
   
//   If there were no request parameters the menu is shown
   else
   {
      site_header ("Block Crawler Home Page");
      
      echo "   <div id=\"node_info\">\n";
      echo "\n";
      
      $network_info = getinfo ();
      
      echo "      <div class=\"node_detail\">\n";
      echo "         <span class=\"node_desc\">Block Count:</span><br>\n";
      echo "         ".$network_info["blocks"]."\n";
      echo "      </div>\n";
      echo "\n";

      echo "      <div class=\"node_detail\">\n";
      echo "         <span class=\"node_desc\">Difficulty:</span><br>\n";
      echo "         ".$network_info["difficulty"]."\n";
      echo "      </div>\n";
      echo "\n";

      echo "      <div class=\"node_detail\">\n";
      echo "         <span class=\"node_desc\">Connections:</span><br>\n";
      echo "         ".$network_info["connections"]."\n";
      echo "      </div>\n";
      echo "\n";

      $net_speed = getnetworkhashps ();
      
      if ($net_speed != "")
      {
         echo "      <div class=\"node_detail\">\n";
         echo "         <span class=\"node_desc\">Network H/s:</span><br>\n";
         echo "         ".$net_speed."\n";
         echo "      </div>\n";
         echo "\n";
      }
      
      echo "   </div>\n";
      echo "\n";

      echo "   <div id=\"site_menu\">\n";
      echo "\n";
      
      echo "      <div class=\"menu_item\">\n";
      echo "         <span class=\"menu_desc\">Enter a Block Index / Height</span><br>\n";
      echo "         <form action=\"".$_SERVER["PHP_SELF"]."\" method=\"post\">\n";
      echo "            <input type=\"text\" name=\"block_height\" size=\"40\">\n";
      echo "            <input type=\"submit\" name=\"submit\" value=\"Jump To Block\">\n";
      echo "         </form>\n";
      echo "      </div>\n";
      echo "\n";

      echo "      <div class=\"menu_item\">\n";
      echo "         <span class=\"menu_desc\">Enter A Block Hash</span><br>\n";
      echo "         <form action=\"".$_SERVER["PHP_SELF"]."\" method=\"post\">\n";
      echo "            <input type=\"text\" name=\"block_hash\" size=\"40\">\n";
      echo "            <input type=\"submit\" name=\"submit\" value=\"Jump To Block\">\n";
      echo "         </form>\n";
      echo "      </div>\n";
      echo "\n";

      echo "      <div class=\"menu_item\">\n";
      echo "         <span class=\"menu_desc\">Enter A Transaction ID</span><br>\n";
      echo "         <form action=\"".$_SERVER["PHP_SELF"]."\" method=\"post\">\n";
      echo "            <input type=\"text\" name=\"transaction\" size=\"40\">\n";
      echo "               <input type=\"submit\" name=\"submit\" value=\"Jump To TX\">\n";
      echo "         </form>\n";
      echo "      </div>\n";
      echo "\n";

      echo "   </div>\n";
      echo "\n";
   }
   
   
   site_footer ();


Title: Re: CallmeJake BlockCrawler removing Network H/s
Post by: Willisius on September 12, 2014, 01:35:11 AM
Can't you just do this? (Look for the long strings of asterisks)

Code:
<?php

require_once (
"bc_daemon.php");
require_once ("bc_layout.php");


// If a block hash was provided the block detail is shown
if (isset ($_REQUEST["block_hash"]))
{
site_header ("Block Detail Page");

block_detail ($_REQUEST["block_hash"], TRUE);
}

// If a block height is provided the block detail is shown
elseif (isset ($_REQUEST["block_height"]))
{
site_header ("Block Detail Page");

block_detail ($_REQUEST["block_height"]);
}

// If a TXid was provided the TX Detail is shown
elseif (isset ($_REQUEST["transaction"]))
{
site_header ("Transaction Detail Page");

tx_detail ($_REQUEST["transaction"]);
}

// If there were no request parameters the menu is shown
else
{
site_header ("Block Crawler Home Page");

echo " <div id=\"node_info\">\n";
echo "\n";

$network_info getinfo ();

echo " <div class=\"node_detail\">\n";
echo " <span class=\"node_desc\">Block Count:</span><br>\n";
echo " ".$network_info["blocks"]."\n";
echo " </div>\n";
echo "\n";

echo " <div class=\"node_detail\">\n";
echo " <span class=\"node_desc\">Difficulty:</span><br>\n";
echo " ".$network_info["difficulty"]."\n";
echo " </div>\n";
echo "\n";

echo " <div class=\"node_detail\">\n";
echo " <span class=\"node_desc\">Connections:</span><br>\n";
echo " ".$network_info["connections"]."\n";
echo " </div>\n";
echo "\n";
                
//******************************************************************/
                //Cut below here
                //******************************************************************/
[b]$net_speed getnetworkhashps ();[/b]

if ($net_speed != "")
{
echo " <div class=\"node_detail\">\n";
echo " <span class=\"node_desc\">Network H/s:</span><br>\n";
echo " ".$net_speed."\n";
echo " </div>\n";
echo "\n";
}
//******************************************************************/
                //Cut above here
                //******************************************************************/
echo " </div>\n";
echo "\n";

echo " <div id=\"site_menu\">\n";
echo "\n";

echo " <div class=\"menu_item\">\n";
echo " <span class=\"menu_desc\">Enter a Block Index / Height</span><br>\n";
echo " <form action=\"".$_SERVER["PHP_SELF"]."\" method=\"post\">\n";
echo " <input type=\"text\" name=\"block_height\" size=\"40\">\n";
echo " <input type=\"submit\" name=\"submit\" value=\"Jump To Block\">\n";
echo " </form>\n";
echo " </div>\n";
echo "\n";

echo " <div class=\"menu_item\">\n";
echo " <span class=\"menu_desc\">Enter A Block Hash</span><br>\n";
echo " <form action=\"".$_SERVER["PHP_SELF"]."\" method=\"post\">\n";
echo " <input type=\"text\" name=\"block_hash\" size=\"40\">\n";
echo " <input type=\"submit\" name=\"submit\" value=\"Jump To Block\">\n";
echo " </form>\n";
echo " </div>\n";
echo "\n";

echo " <div class=\"menu_item\">\n";
echo " <span class=\"menu_desc\">Enter A Transaction ID</span><br>\n";
echo " <form action=\"".$_SERVER["PHP_SELF"]."\" method=\"post\">\n";
echo " <input type=\"text\" name=\"transaction\" size=\"40\">\n";
echo " <input type=\"submit\" name=\"submit\" value=\"Jump To TX\">\n";
echo " </form>\n";
echo " </div>\n";
echo "\n";

echo " </div>\n";
echo "\n";
}


site_footer ();


Title: Re: CallmeJake BlockCrawler removing Network H/s
Post by: Blazr2 on September 12, 2014, 03:49:49 AM
We second what Willisius says; but rather than cut we just // those lines out.


Title: Re: CallmeJake BlockCrawler removing Network H/s
Post by: rikkejohn on September 15, 2014, 04:18:53 PM
Thank you, Willisius, you are right.

I really appreciate your help.


Title: Re: CallmeJake BlockCrawler removing Network H/s
Post by: rikkejohn on September 15, 2014, 04:20:06 PM
We second what Willisius says; but rather than cut we just // those lines out.

I was trying with the // but I must have always gone too far, or missed one out. :-)