php-mpos/public/include/pages/api/getblockcount.inc.php
Sebastian Grewe d492b532b7 Adding ability to disable the sites API functions
Addresses #467 and will fix upon merge.
2013-07-17 09:43:02 +02:00

27 lines
550 B
PHP

<?php
// Make sure we are called from index.php
if (!defined('SECURITY')) die('Hacking attempt');
// Check if the API is activated
$api->isActive();
// Check user token
$id = $user->checkApiKey($_REQUEST['api_key']);
if ($bitcoin->can_connect() === true){
if (!$iBlock = $memcache->get('iBlock')) {
$iBlock = $bitcoin->query('getblockcount');
$memcache->set('iBlock', $iBlock);
}
} else {
$iBlock = 0;
}
// Output JSON format
echo json_encode(array('getblockcount' => $iBlock));
// Supress master template
$supress_master = 1;
?>