} // Verify that a block descriptor was provided and attempt retrieval if (isset($_REQUEST["height"]) && $_REQUEST["height"] != "") { $block = mysqli_getrow($GLOBALS["tables"]["block"], "`height` = '" . $_REQUEST["height"] . "'"); } elseif (isset($_REQUEST["hash"]) && $_REQUEST["hash"] != "") { $block = mysqli_getrow($GLOBALS["tables"]["block"], "`hash` = '" . $_REQUEST["hash"] . "'"); } else { $message = "<p> \n"; $message .= "\tYou must provide either a block hash or a block height to use this page. \n"; $message .= "</p> \n\n"; spectra_page_error("Missing Block Descriptor", $message); } // Verify that block data was retrieved if ($block["success"] < 1 || $block["data"] == "") { $message = "<p> \n"; $message .= "\tUnable To Retrieve Specified Block \n"; $message .= "</p> \n\n"; $message .= "<p> \n"; $message .= "\tPlease verify your block hash/height and try again. \n"; $message .= "</p> \n\n"; spectra_page_error("Invalid Block Descriptor", $message); } // If there were no errors render the block detail view spectra_site_head($GLOBALS["currency"]["code"] . " Block Detail"); spectra_block_detail($block["data"]); spectra_site_foot(); /****************************************************************************** Developed By Jake Paysnoe - Copyright © 2015 SPEC Development Team SPEC Block Explorer is released under the MIT Software License. For additional details please read license.txt in this package. ******************************************************************************/
<?php // Enable the spectra functionality require_once "lib/spectra_config.php"; // If there is no live node the page is a spew of errors if (!spectra_node_isalive()) { $message = "<p>"; $message .= "\tUnable to connect to the specified node."; $message .= "</p>"; spectra_page_error("No Network", $message); } spectra_site_head($GLOBALS["currency"]["code"] . " Network Status"); // Network status and description spectra_network_statistics(); // Connection list for the specified node spectra_network_nodelist(); spectra_site_foot(); /****************************************************************************** Developed By Jake Paysnoe - Copyright © 2015 SPEC Development Team SPEC Block Explorer is released under the MIT Software License. For additional details please read license.txt in this package. ******************************************************************************/ ?>
// Exit without rendering the full transaction page exit; } // Error handling for a missing txid if (!isset($_REQUEST["tx"]) || $_REQUEST["tx"] == "") { $message = "<p> \n"; $message .= "\tYou must provide a transaction ID to use this page. \n"; $message .= "</p> \n\n"; spectra_page_error("Missing Transaction ID", $message); } // Attempt to retrieve the specified transaction $tx = mysqli_getrow($GLOBALS["tables"]["tx"], "`txid` = '" . $_REQUEST["tx"] . "'"); // Error handling for unrecognized transaction if ($tx["success"] < 1 || $tx["data"] == "") { $message = "<p> \n"; $message .= "\tInvalid or Unrecognized TX ID \n"; $message .= "</p> \n\n"; $message .= "<p> \n"; $message .= "\tPlease verify your TX ID and try again. \n"; $message .= "</p> \n\n"; spectra_page_error("Invalid Transaction ID", $message); } // The rest of the code generates the normal tx detail page for the site spectra_site_head($GLOBALS["currency"]["code"] . " Transaction Detail"); spectra_tx_detail($tx["data"]); spectra_site_foot(); /****************************************************************************** Developed By Jake Paysnoe - Copyright © 2015 SPEC Development Team SPEC Block Explorer is released under the MIT Software License. For additional details please read license.txt in this package. ******************************************************************************/
// Enable the spectra functionality require_once "lib/spectra_config.php"; // Error handling for missing address if (!isset($_REQUEST["address"]) || $_REQUEST["address"] == "") { $message = "<p> \n"; $message .= "\tYou must provde an address to use this page. \n"; $message .= "</p> \n\n"; spectra_page_error("No Address Provided", $message); } // Attempt to fetch the specified address $address = mysqli_getrow($GLOBALS["tables"]["ledger"], "`address` = '" . $_REQUEST["address"] . "'"); // Error handling for invalid or unrecognized address if ($address["success"] < 1 || $address["data"] == "") { $message = "<p> \n"; $message .= "\tInvalid or Unrecognized Address \n"; $message .= "</p> \n\n"; $message .= "<p> \n"; $message .= "\tPlease verify your address and try again. \n"; $message .= "</p> \n\n"; spectra_page_error("Invalid Address", $message); } // If there were no error the address details are rendered spectra_site_head($GLOBALS["currency"]["code"] . " Address Detail"); spectra_address_detail($address["data"]); spectra_site_foot(); /****************************************************************************** Developed By Jake Paysnoe - Copyright © 2015 SPEC Development Team SPEC Block Explorer is released under the MIT Software License. For additional details please read license.txt in this package. ******************************************************************************/
<?php // This script provides the MySQL configuration and status-enabled // wrappers for some commonly used database functions and enables // other task-specific libraries used by the SPECTRA Block Explorer. /****************************************************************************** All scripts share a common database connection /*****************************************************************************/ $GLOBALS["db"]["obj"] = new mysqli($GLOBALS["db"]["host"], $GLOBALS["db"]["user"], $GLOBALS["db"]["pass"], $GLOBALS["db"]["name"]); if (mysqli_connect_errno($GLOBALS["db"]["obj"])) { spectra_page_error("Database Connection Error", "Unable to connect to MySQL Database Server", mysqli_connect_errno($GLOBALS["db"]["obj"])); } // When invoked from the command line the block explorer loads a set // of prepared statements used to manage the block data if (!isset($_SERVER["HTTP_HOST"]) && mysqli_istable($GLOBALS["tables"]["block"])) { $GLOBALS["db"]["prep"]["block"] = $GLOBALS["db"]["obj"]->prepare("INSERT INTO `" . $GLOBALS["tables"]["block"] . "` (`hash`, `proofhash`, `size`, `height`, `version`, `mint`, `flags`, `entropybit`, `merkleroot`, `tx`, `time`, `nonce`, `bits`, `difficulty`, `modifier`, `modifierchecksum`, `signature`, `previousblockhash`, `nextblockhash`, `val_in`, `val_out`, `val_fee`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"); if (!$GLOBALS["db"]["prep"]["block"]) { spectra_log_write(1, "(prep_block: " . __LINE__ . ") " . $GLOBALS["db"]["obj"]->error); } $GLOBALS["db"]["prep"]["tx"] = $GLOBALS["db"]["obj"]->prepare("INSERT INTO `" . $GLOBALS["tables"]["tx"] . "` (`in_block`, `txid`, `version`, `time`, `locktime`, `blocktime`, `tx-comment`, `val_in`, `val_out`, `val_fee`) VALUES (?,?,?,?,?,?,?,?,?,?)"); if (!$GLOBALS["db"]["prep"]["tx"]) { spectra_log_write(1, "(prep_tx: " . __LINE__ . ") " . $GLOBALS["db"]["obj"]->error); } $GLOBALS["db"]["prep"]["vin"] = $GLOBALS["db"]["obj"]->prepare("INSERT INTO `" . $GLOBALS["tables"]["vin"] . "` (`src_block`, `src_tx`, `src_vout`, `src_address`, `src_value`, `in_block`, `in_tx`, `time`, `coinbase`, `sequence`) VALUES (?,?,?,?,?,?,?,?,?,?)"); if (!$GLOBALS["db"]["prep"]["vin"]) { spectra_log_write(1, "(prep_vin: " . __LINE__ . ") " . $GLOBALS["db"]["obj"]->error); } $GLOBALS["db"]["prep"]["vout"] = $GLOBALS["db"]["obj"]->prepare("INSERT INTO `" . $GLOBALS["tables"]["vout"] . "` (`in_block`, `in_tx`, `time`, `value`, `n`, `reqsigs`, `type`, `addresses`) VALUES (?,?,?,?,?,?,?,?)"); if (!$GLOBALS["db"]["prep"]["vout"]) { spectra_log_write(1, "(prep_vout: " . __LINE__ . ") " . $GLOBALS["db"]["obj"]->error); }