php-mpos/public/include/pages/api/getblocksfound.inc.php
Sebastian Grewe 69b2c2f517 Properly abort API calls if api_key is invalid
* Fixes an issue where any api_key would be validated
* Now returns user ID upon success, aborts script processing with error
  on fail
2013-05-29 12:41:53 +02:00

21 lines
448 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']);
// Set a sane limit, overwrite with URL parameter
$iLimit = 10;
if (@$_REQUEST['limit'])
$iLimit = $_REQUEST['limit'];
// Output JSON format
echo json_encode(array('getblocksfound' => $statistics->getBlocksFound($iLimit)));
// Supress master template
$supress_master = 1;
?>