-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
82 lines (66 loc) · 1.71 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<?php
/*
* Ixian Block Explorer
* Website: www.ixian.io
*/
include_once("config.php");
include_once("include/template.php");
include_once("wallets.php");
$current_page = "home";
if(isset($_GET['p']))
{
$new_page = $_GET['p'];
if($new_page === 'search' || $new_page === 'address' || $new_page === 'block' || $new_page === 'transaction'
|| $new_page === 'network' || $new_page === 'top' || $new_page === 'emissions'
|| $new_page === 'devblocks' || $new_page === 'superblocks' || $new_page === 'nodes'
)
{
$current_page = $new_page;
}
}
db_connect();
$page = new Template();
$page->cpage = $current_page;
$page->q = "";
if(isset($_GET['q'])) {
if($current_page === 'search' && $_GET['q'] != "")
{
$page->q = htmlspecialchars($_GET['q']);
redirectSearch($page->q);
}
else {
header("Location: index.php");
exit;
}
}
// Fetch the current network blockheight
$laststat = db_fetch("SELECT * FROM ixi_nodestats ORDER BY blockheight DESC LIMIT 1", []);
if ($laststat == null)
{
$laststat = array("blockheight" => 0);
}
else
{
$laststat = $laststat[0];
}
$networkbh = $laststat['blockheight'];
// Fetch the lastest stored block
$laststat = db_fetch("SELECT * FROM ixi_blocks ORDER BY id DESC LIMIT 1", []);
if ($laststat == null)
{
$laststat = array("id" => 0);
}else
{
$laststat = $laststat[0];
}
$explorerbh = $laststat['id'];
$page->alert = 0;
// If the explorer is more than 10 blocks behind the network blockheight, show the synchronizing alert
if($explorerbh < $networkbh - 10)
{
$page->alert = 1; // Synchronizing
}
$page->render('header.tpl');
include_once('pages/'.$current_page.'.php');
$page->render('footer.tpl');
?>