* Fixes an issue where any api_key would be validated * Now returns user ID upon success, aborts script processing with error on fail
25 lines
498 B
PHP
25 lines
498 B
PHP
<?php
|
|
|
|
// Make sure we are called from index.php
|
|
if (!defined('SECURITY'))
|
|
die('Hacking attempt');
|
|
|
|
// 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;
|
|
?>
|