示例#1
0
	}
</style>
</head>
<body>
<?php 
if ($start || !$start && !$block_id) {
    if (!$start && !$block_id) {
        print '<h1>Latest Blocks</h1>';
        $sql = "SELECT `data`,  `hash`\n\t\t\t\tFROM `" . DB_PREFIX . "block_chain`\n\t\t\t\tORDER BY `id` DESC\n\t\t\t\tLIMIT 15";
    } else {
        $sql = "SELECT `data`,  `hash`\n\t\t\t\tFROM `" . DB_PREFIX . "block_chain`\n\t\t\t\tORDER BY `id` ASC\n\t\t\t\tLIMIT " . ($start - 1) . ", 100";
    }
    print '<table class="table"><tr><th>Block</th><th>Hash</th><th>Time</th><th>User id</th><th>Level</th><th>Transactions</th></tr>';
    $res = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, $sql);
    $bin_to_hex_array = array('sign', 'public_key', 'encrypted_message', 'comment', 'bin_public_keys');
    while ($row = $db->fetchArray($res)) {
        //$hash = substr(bin2hex($row['hash']), 0, 8);
        $hash = bin2hex($row['hash']);
        $binary_data = $row['data'];
        $parsedata = new ParseData($binary_data, $db);
        $parsedata->ParseData_tmp();
        $block_data = $parsedata->block_data;
        $tx_array = $parsedata->tx_array;
        $block_data['sign'] = bin2hex($block_data['sign']);
        print "<tr><td><a href='block_explorer.php?block_id={$block_data['block_id']}'>{$block_data['block_id']}</a></td><td>{$hash}</td><td>" . date('d-m-Y H:i:s', $block_data['time']) . "</td><td>{$block_data['user_id']}</td><td>{$block_data['level']}</td><td>";
        if ($tx_array) {
            print sizeof($tx_array);
            /*
            			print "<div style=\"width: 500px; height: 400px; overflow: auto; background-color: #f2dede\"><pre>";
            			for ($i=0; $i<sizeof($tx_array); $i++) {
            				foreach ($tx_array[$i] as $k=>$v) {