forked from craigwatson/bitcoind-status
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
44 lines (36 loc) · 1.25 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
<?php
/**
* Bitcoin Status Page
*
* @category File
* @package BitcoinStatus
* @author Craig Watson <craig@cwatson.org>
* @license https://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
* @link https://github.com/craigwatson/bitcoind-status
*/
if (!is_file('./php/config.php')) {
die("Configuration file not found. To continue, please create a config.php file.");
}
require_once './php/config.php';
require_once './php/functions.php';
if ($config['timezone'] !== null) {
date_default_timezone_set($config['timezone']);
}
// If we're good to clear cache, remove cache file
if (isset($_GET['clearcache']) & in_array($_SERVER['REMOTE_ADDR'], $config['nocache_whitelist']) & is_file($config['cache_file'])) {
unlink($config['cache_file']);
$cache_message = 'Cache has been cleared!';
}
// Check if we need to use the cache
if ($config['use_cache'] === false) {
$use_cache = false;
} elseif (isset($_GET['nocache']) & in_array($_SERVER['REMOTE_ADDR'], $config['nocache_whitelist'])) {
$use_cache = false;
$cache_message = 'Cache has been bypassed!';
} else {
$use_cache = true;
}
// Get the data
$data = getData($use_cache);
// Add the IP of the server, and include template
require_once './html/template.html';