init
This commit is contained in:
4
LICENSE
4
LICENSE
@@ -1,6 +1,8 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2019
|
||||
Copyright (c) 2019 Bubasik and cpu-pool.com
|
||||
|
||||
Copyright (c) 2018 Elicoin
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
25
block.php
Normal file
25
block.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
require_once('./coinapi.php');
|
||||
require_once('./functions.php');
|
||||
$blockInfo = getJSONArray('getblock', array($_GET['hash']))['result'];
|
||||
echo '<h1>Block info</h1>';
|
||||
echo '<table class="hundred">';
|
||||
echo '<tr><td><strong>Block number:</strong></td><td>' . $blockInfo['height'] . '</td></tr>';
|
||||
echo '<tr><td><strong>Hash:</strong></td><td><a href="./?page=block&hash=' . $blockInfo['hash'] . '">' . $blockInfo['hash'] . '</td></tr>';
|
||||
echo '<tr><td><strong>Time:</strong></td><td>' . date($GLOBALS['timeFormat'], $blockInfo['time']) . '</td></tr>';
|
||||
echo '<tr><td><strong>Size:</strong></td><td>' . humansize($blockInfo['size'], 1024) . 'B</td></tr>';
|
||||
echo '<tr><td><strong>Number of confirmations:</strong></td><td>' . $blockInfo['confirmations'] . '</td></tr>';
|
||||
echo '<tr><td><strong>Number of transactions:</strong></td><td>' . count($blockInfo['tx']) . '</td></tr>';
|
||||
echo '<tr><td><strong>Difficulty:</strong></td><td>' . $blockInfo['difficulty'] . '</td></tr>';
|
||||
echo '<tr><td><strong>Nonce:</strong></td><td>' . $blockInfo['nonce'] . '</td></tr>';
|
||||
echo '<tr><td><strong>Chainwork:</strong></td><td>' . $blockInfo['chainwork'] . '</td></tr>';
|
||||
if (isset($blockInfo['previousblockhash'])) echo '<tr><td><strong>Previous block hash:</strong></td><td><a href="./?page=block&hash=' . $blockInfo['previousblockhash'] . '">' . $blockInfo['previousblockhash'] . '</td></tr>';
|
||||
if (isset($blockInfo['nextblockhash'])) echo '<tr><td><strong>Next block hash:</strong></td><td><a href="./?page=block&hash=' . $blockInfo['nextblockhash'] . '">' . $blockInfo['nextblockhash'] . '</td></tr>';
|
||||
echo '</table>';
|
||||
echo '<h1>Transactions</h1>';
|
||||
echo '<table class="hundred">';
|
||||
foreach ($blockInfo['tx'] as $tx) {
|
||||
echo '<tr><td><a href="./?page=tx&id=' . $tx . '">' . $tx . '</a></td></tr>';
|
||||
}
|
||||
echo '</table>';
|
||||
?>
|
||||
35
blocklist.php
Normal file
35
blocklist.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
require_once('./coinapi.php');
|
||||
require_once('./functions.php');
|
||||
$listCount = 20;
|
||||
$pgid = (isset($_GET['id']) ? $_GET['id'] : 1);
|
||||
echo '<h2>Network info</h2>';
|
||||
$miningInfo = getJSONArray('getmininginfo', '')['result'];
|
||||
$totalCoins = getJSONArray('gettxoutsetinfo', '')['result']['total_amount'];
|
||||
echo '<table>';
|
||||
echo '<tr><td>Difficulty:</td><td>' . round($miningInfo['difficulty'], 5) . '</td></tr>';
|
||||
echo '<tr><td>Network hashrate:</td><td>' . humansize($miningInfo['networkhashps'], 1000) . 'H/s</td></tr>';
|
||||
echo '<tr><td>Total mined coins:</td><td>' . round($totalCoins) . '</td></tr>';
|
||||
echo '</table>';
|
||||
echo '<h2>Last mined blocks</h2>';
|
||||
$blockCount = getJSONArray('getblockcount', '')['result'];
|
||||
$j = $blockCount - (($pgid - 1) * $listCount);
|
||||
$k = $j - $listCount + 1;
|
||||
if ($j < $blockCount) echo '<span><a href="./?id=' . ($pgid - 1) . '">Newer</a></span>';
|
||||
if ($k > 0) echo '<span class="right"><a href="./?id=' . ($pgid + 1) . '">Older</a></span>';
|
||||
echo '<br /><br />';
|
||||
echo '<table style="width: 100%">';
|
||||
echo '<tr><th>Number</th><th>Mined</th><th>Transactions</th><th>Size</th></tr>';
|
||||
for ($i = $j; $i >= $k && $i >= 0; $i--) {
|
||||
if ($i <= $blockCount) {
|
||||
$blockHash = getJSONArray('getblockhash', array($i))['result'];
|
||||
$blockData = getJSONArray('getblock', array($blockHash))['result'];
|
||||
echo '<tr class="center"><td><a href="./?page=block&hash=' . $blockHash . '">' . $i . '</a></td><td>' . date($GLOBALS['timeFormat'], $blockData['time']) . '</td><td>' . count($blockData['tx']) . '</td><td>' . humansize($blockData['size'], 1024) . 'B</td></tr>';
|
||||
}
|
||||
}
|
||||
echo '</table>';
|
||||
echo '<br />';
|
||||
if ($j < $blockCount) echo '<span><a href="./?id=' . ($pgid - 1) . '">Newer</a></span>';
|
||||
if ($k > 0) echo '<span class="right"><a href="./?id=' . ($pgid + 1) . '">Older</a></span>';
|
||||
echo '<br />';
|
||||
?>
|
||||
29
coinapi.php
Normal file
29
coinapi.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
function getJSONArray($method, $params) {
|
||||
return json_decode(getJSON($method, $params), true);
|
||||
}
|
||||
function getJSON($method, $params) {
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, 'http://' . $GLOBALS['ip'] . ':' . $GLOBALS['port']);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
$paramString = '';
|
||||
if ($params != '') {
|
||||
foreach ($params as $v) {
|
||||
$paramString .= (is_numeric($v) || $v == '' || $v == null ? $v : '"' . $v . '"') . ', ';
|
||||
}
|
||||
$paramString = substr($paramString, 0, strlen($paramString) - 2);
|
||||
}
|
||||
$post = '{"jsonrpc":"1.0", "id":"' . $method . '", "method":"' . $method . '", "params":[' . $paramString . '] }';
|
||||
//echo $post;
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
|
||||
curl_setopt($ch, CURLOPT_POST, 1);
|
||||
curl_setopt($ch, CURLOPT_USERPWD, $GLOBALS['user'] . ':' . $GLOBALS['pass']);
|
||||
$headers = array();
|
||||
$headers[] = 'Content-Type: text/plain';
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
|
||||
$result = curl_exec($ch);
|
||||
if (curl_errno($ch)) return 'Error:' . curl_error($ch);
|
||||
curl_close ($ch);
|
||||
return $result;
|
||||
}
|
||||
?>
|
||||
11
config.php
Normal file
11
config.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
$GLOBALS['name'] = 'Cryply';
|
||||
$GLOBALS['web'] = 'https://cranepay.io';
|
||||
$GLOBALS['web_block'] = 'http://cryply-explorer.ml';
|
||||
$GLOBALS['email'] = 'info@cryply-explorer.ml';
|
||||
$GLOBALS['ip'] = '127.0.0.1';
|
||||
$GLOBALS['port'] = '48887';
|
||||
$GLOBALS['user'] = 'userrrr';
|
||||
$GLOBALS['pass'] = 'passss';
|
||||
$GLOBALS['timeFormat'] = 'Y-m-d, H:i:s';
|
||||
?>
|
||||
6
contact.php
Normal file
6
contact.php
Normal file
@@ -0,0 +1,6 @@
|
||||
<h2>Contact</h2>
|
||||
<table>
|
||||
<tr><td><?php echo $name; ?> homepage:</td><td><a href="<?php echo $web; ?>"><?php echo $web; ?></a></td></tr>
|
||||
<tr><td><?php echo $name; ?> block explorer:</td><td><a href="<?php echo $web_block; ?>"><?php echo $web_block; ?></a></td></tr>
|
||||
<tr><td>E-mail:</td><td><a href="mailto:<?php echo $email; ?>"><?php echo $email; ?></a></td></tr>
|
||||
</table>
|
||||
BIN
favicon.ico
Normal file
BIN
favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.2 KiB |
BIN
fonts/OpenSans-Bold.ttf
Normal file
BIN
fonts/OpenSans-Bold.ttf
Normal file
Binary file not shown.
BIN
fonts/OpenSans-BoldItalic.ttf
Normal file
BIN
fonts/OpenSans-BoldItalic.ttf
Normal file
Binary file not shown.
BIN
fonts/OpenSans-Italic.ttf
Normal file
BIN
fonts/OpenSans-Italic.ttf
Normal file
Binary file not shown.
BIN
fonts/OpenSans-Regular.ttf
Normal file
BIN
fonts/OpenSans-Regular.ttf
Normal file
Binary file not shown.
11
functions.php
Normal file
11
functions.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
function humansize($bytes, $devider) {
|
||||
$type = array('', 'k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y');
|
||||
$i = 0;
|
||||
while ($bytes >= $devider) {
|
||||
$bytes /= $devider;
|
||||
$i++;
|
||||
}
|
||||
return round($bytes, 2) . ' ' . $type[$i];
|
||||
}
|
||||
?>
|
||||
BIN
img/back.png
Normal file
BIN
img/back.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.6 KiB |
BIN
img/content.png
Normal file
BIN
img/content.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
BIN
img/footer.png
Normal file
BIN
img/footer.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 998 B |
BIN
img/header.png
Normal file
BIN
img/header.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 63 KiB |
BIN
img/logo.png
Normal file
BIN
img/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 18 KiB |
57
index.php
Normal file
57
index.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
require_once('./config.php');
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<link rel="stylesheet" href="./style.css" type="text/css" />
|
||||
<link rel="shortcut icon" href="./favicon.ico" type="image/x-icon">
|
||||
<title><?php echo $GLOBALS['name']; ?> block explorer</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="menuback">
|
||||
<div id="menubar">
|
||||
<div id="logo"><a href="./"><img class="logobig" src="./img/logo.png" alt="Cryptoz" /></div>
|
||||
<div id="logotext"> <?php echo $GLOBALS['name']; ?> block explorer</a></div>
|
||||
<div id="searchbox"><form action="./?page=search" method="get"><input type="hidden" name="page" value="search" /><input type="text" name="id" /> <input type="submit" value="Search" /></form></div>
|
||||
<div id="menu">
|
||||
<a href="./">Home</a> | <a href="./?page=contact">Contact</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="content">
|
||||
<?php
|
||||
$page = isset($_GET['page']) ? $_GET['page'] : '';
|
||||
switch ($page) {
|
||||
case 'contact':
|
||||
require_once('contact.php');
|
||||
break;
|
||||
case 'block':
|
||||
require_once('block.php');
|
||||
break;
|
||||
case 'search':
|
||||
require_once('search.php');
|
||||
break;
|
||||
case 'tx':
|
||||
require_once('tx.php');
|
||||
break;
|
||||
default:
|
||||
require_once('blocklist.php');
|
||||
break;
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<div id="footerback">
|
||||
<div id="footer" style="line-height: 18px;">
|
||||
<div style="text-align: center;
|
||||
color: #b3b3b3;
|
||||
text-decoration: none;
|
||||
font-size: 0.8em;
|
||||
padding: 15px;
|
||||
line-height: 24px;">This site is powered by the open source <a target="_blank" href="https://github.com/bubasik/lite-block-explorer">lite-block-explorer</a> project forked by <a target="_blank" href="http://cpu-pool.com/">CPU-POOL.COM</a>, created by Bubasik and Elicoin and is licensed under the MIT License.</div>
|
||||
<a href="./"><img class="logosmall" src="./img/logo.png" alt="" /> <?php echo $GLOBALS['name']; ?> block explorer, <?php echo date('Y'); ?></a>
|
||||
</div>
|
||||
</div>
|
||||
</html>
|
||||
</body>
|
||||
</html>
|
||||
31
search.php
Normal file
31
search.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
require_once('./coinapi.php');
|
||||
$_GET['id'] = trim($_GET['id']);
|
||||
echo '<h1>Search result:</h1>';
|
||||
echo 'Searching for: <a href="./?page=search&id=' . $_GET['id'] . '">' . $_GET['id'] . '</a><br />';
|
||||
echo '<h2>Block ID:</h2>';
|
||||
$request = getJSONArray('getblockhash', array($_GET['id']))['result'];
|
||||
if (isset($request)) {
|
||||
echo '<table class="hundred"><tr><td><a href="./?page=block&hash=' . $request . '">' . $request . '</td></tr></table>';
|
||||
} else echo 'Found no results.';
|
||||
echo '<h2>Block hash:</h2>';
|
||||
$request = getJSONArray('getblock', array($_GET['id']))['result'];
|
||||
if (isset($request)) {
|
||||
echo '<table class="hundred"><tr><td><a href="./?page=block&hash=' . $request['hash'] . '">' . $request['hash'] . '</td></tr></table>';
|
||||
/*
|
||||
echo '<pre>';
|
||||
print_r($request);
|
||||
echo '</pre>';
|
||||
*/
|
||||
} else echo 'Found no results.';
|
||||
echo '<h2>Transactions:</h2>';
|
||||
$request = getJSONArray('getrawtransaction', array($_GET['id'], 1))['result'];
|
||||
if (isset($request)) {
|
||||
echo '<table class="hundred"><tr><td><a href="./?page=tx&id=' . $request['hash'] . '">' . $request['hash'] . '</td></tr></table>';
|
||||
/*
|
||||
echo '<pre>';
|
||||
print_r($request);
|
||||
echo '</pre>';
|
||||
*/
|
||||
} else echo 'Found no results.';
|
||||
?>
|
||||
196
style.css
Normal file
196
style.css
Normal file
@@ -0,0 +1,196 @@
|
||||
@font-face {
|
||||
font-family: 'OpenSans';
|
||||
src: url('./fonts/OpenSans-Regular.ttf') format('truetype');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'OpenSans';
|
||||
src: url('./fonts/OpenSans-Italic.ttf') format('truetype');
|
||||
font-weight: normal;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'OpenSans';
|
||||
src: url('./fonts/OpenSans-Bold.ttf') format('truetype');
|
||||
font-weight: bold;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'OpenSans';
|
||||
src: url('./fonts/OpenSans-BoldItalic.ttf') format('truetype');
|
||||
font-weight: bold;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: OpenSans;
|
||||
margin: 0 0 0 0;
|
||||
}
|
||||
|
||||
table {
|
||||
border: 0px solid #000000;
|
||||
border-spacing: 0px;
|
||||
box-shadow: 0px 0px 10px -2px rgba(0,0,0,0.5);
|
||||
}
|
||||
|
||||
table th {
|
||||
background-color: #aaaaaa;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
table td {
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
table tr:nth-child(odd) td {
|
||||
background-color: #eeeeee;
|
||||
}
|
||||
|
||||
table tr:nth-child(even) td {
|
||||
background-color: #dddddd;
|
||||
}
|
||||
|
||||
input[type=text] {
|
||||
border: 2px solid #000000;
|
||||
width: 250px;
|
||||
height: 30px;
|
||||
border-radius: 10px;
|
||||
padding-left: 10px;
|
||||
padding-right: 10px;
|
||||
}
|
||||
|
||||
input[type=submit] {
|
||||
border: 2px solid #000000;
|
||||
height: 30px;
|
||||
border-radius: 10px;
|
||||
background-color: #CC3300;
|
||||
color: #FFFFFF;
|
||||
font-weight: bold;
|
||||
padding-left: 15px;
|
||||
padding-right: 15px;
|
||||
}
|
||||
|
||||
#menuback {
|
||||
background: url('./img/back.png');
|
||||
}
|
||||
|
||||
#menubar {
|
||||
background: url('./img/header.png') no-repeat;
|
||||
box-shadow: 0px -10px 9px rgba(0,0,0,0.7);
|
||||
width: 940px;
|
||||
height: 88px;
|
||||
margin: auto;
|
||||
padding-left: 20px;
|
||||
padding-right: 20px;
|
||||
color: #FFFFFF;
|
||||
line-height: 88px;
|
||||
}
|
||||
|
||||
#logo {
|
||||
float: left;
|
||||
padding-top: 12px;
|
||||
padding-right: 10px;
|
||||
}
|
||||
|
||||
#logotext {
|
||||
float: left;
|
||||
width: 350px;
|
||||
font-size: 30px;
|
||||
}
|
||||
|
||||
#logotext a {
|
||||
color: #FFFFFF;
|
||||
font-weight: bold;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
#searchbox {
|
||||
float: left;
|
||||
height: 88px;
|
||||
line-height: 88px;
|
||||
}
|
||||
|
||||
#menu {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
#menu a {
|
||||
color: #FFFF00;
|
||||
font-weight: bold;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
#content {
|
||||
background: url('./img/content.png') repeat-x 0 0;
|
||||
box-shadow: 0px -4px 10px rgba(0,0,0,0.4);
|
||||
background-color: #FFFFFF;
|
||||
width: 920px;
|
||||
min-height: 570px;
|
||||
padding: 30px 30px 30px 30px;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
#content a {
|
||||
color: #CC3300;
|
||||
font-weight: bold;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
#footerback {
|
||||
background: url('./img/back.png') repeat 0 0;
|
||||
}
|
||||
|
||||
#footer {
|
||||
background: url('./img/footer.png') repeat 0 0;
|
||||
width: 920px;
|
||||
height: 100px;
|
||||
margin: auto;
|
||||
padding: 0px 30px 0px 30px;
|
||||
line-height: 100px;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
#footer a {
|
||||
color: #FFFFFF;
|
||||
font-weight: bold;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.bigbold {
|
||||
font-size: 25px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.logosmall {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
}
|
||||
|
||||
.logobig {
|
||||
width: 64px;
|
||||
height: 64px;
|
||||
}
|
||||
|
||||
.center {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.right {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.hundred {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.fifty {
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
.top {
|
||||
vertical-align: top;
|
||||
}
|
||||
48
tx.php
Normal file
48
tx.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
require_once('./coinapi.php');
|
||||
require_once('./functions.php');
|
||||
$tx = getJSONArray('getrawtransaction', array($_GET['id'], '1'))['result'];
|
||||
echo '<h1>Transaction details</h2>';
|
||||
if (isset($tx['vin'])) {
|
||||
echo '<table class="hundred">';
|
||||
echo '<tr><td>Transaction ID:</td><td><a href="./?page=tx&id=' . $tx['txid'] . '">' . $tx['txid'] . '</a></td></tr>';
|
||||
echo '<tr><td>Time:</td><td>' . date($GLOBALS['timeFormat'], $tx['time']) . '</td></tr>';
|
||||
echo '<tr><td>Size:</td><td>' . humansize($tx['size'], 1024) . 'B</td></tr>';
|
||||
echo '<tr><td>Confirmations:</td><td>' . $tx['confirmations'] . '</td></tr>';
|
||||
echo '</table>';
|
||||
echo '<h1>Transaction</h1>';
|
||||
echo '<table class="hundred">';
|
||||
echo '<tr><th class="fifty">Input</th><th class="fifty">Output</th></tr>';
|
||||
echo '<tr class="top"><td class="fifty">';
|
||||
foreach ($tx['vin'] as $vin) {
|
||||
if (isset($vin['coinbase'])) {
|
||||
echo 'COINBASE:<br /><strong>' . $vin['coinbase'] . '</strong><br />';
|
||||
} else {
|
||||
echo 'TX ID: <a href="./?page=tx&id=' . $vin['txid'] . '">' . substr($vin['txid'], 0, 30) . '...</a><br />';
|
||||
echo 'VOUT: ' . $vin['vout'] . '<br />';
|
||||
}
|
||||
echo '<br />';
|
||||
/*
|
||||
echo '<pre>';
|
||||
print_r($vin);
|
||||
echo '</pre>';
|
||||
*/
|
||||
}
|
||||
echo '</td><td class="fifty">';
|
||||
foreach ($tx['vout'] as $vout) {
|
||||
foreach ($vout['scriptPubKey']['addresses'] as $addr) {
|
||||
echo '<strong>' . $addr . '</strong><br />';
|
||||
}
|
||||
echo $vout['value'] . ' CRP<br /><br />';
|
||||
/*
|
||||
echo '<pre>';
|
||||
print_r($vout);
|
||||
echo '</pre>';
|
||||
*/
|
||||
}
|
||||
echo '</td></tr>';
|
||||
echo '</table>';
|
||||
} else {
|
||||
echo 'Transaction not found.';
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user