Add JSON header setting to the api functions

This commit is contained in:
pxgamer
2018-10-08 12:39:16 +01:00
parent 33587258a8
commit 3ddc0dd90e

View File

@@ -24,6 +24,10 @@ function san_host($a)
function api_err($data)
{
global $_config;
if (!headers_sent()) {
header('Content-Type: application/json');
}
echo json_encode(["status" => "error", "data" => $data, "coin" => $_config['coin']]);
exit;
}
@@ -32,6 +36,10 @@ function api_err($data)
function api_echo($data)
{
global $_config;
if (!headers_sent()) {
header('Content-Type: application/json');
}
echo json_encode(["status" => "ok", "data" => $data, "coin" => $_config['coin']]);
exit;
}