mirror of
https://0xacab.org/dCF/deCloudflare.git
synced 2025-01-15 03:37:00 -05:00
Implement snippet
This commit is contained in:
parent
da5af21962
commit
fdd0edc55b
@ -6,10 +6,10 @@ header('Cache-Control: private, no-cache, no-store, max-age=0');
|
||||
//
|
||||
// { Example API for IsAT }
|
||||
//
|
||||
define('JSON_FILE', './attd.json');
|
||||
define('JSON_DIR', 'listdata/');
|
||||
//
|
||||
//
|
||||
if (!file_exists(JSON_FILE))
|
||||
if (!file_exists(JSON_DIR) || !file_exists(JSON_DIR . 'antitor_e.json'))
|
||||
{
|
||||
die('File Not Found');
|
||||
}
|
||||
@ -19,15 +19,15 @@ elseif ($_SERVER['REQUEST_METHOD'] != 'POST')
|
||||
exit;
|
||||
}
|
||||
header('Content-Type: application/json');
|
||||
$got = @json_decode(file_get_contents(JSON_FILE) , true);
|
||||
if (!is_array($got))
|
||||
{
|
||||
die('File Error');
|
||||
}
|
||||
$fqdn = htmlspecialchars($_POST['f']);
|
||||
if (!preg_match("/^([a-z0-9]{1})([a-z0-9.-]{0,254})\.([a-z]{2,50})$/", $fqdn))
|
||||
{
|
||||
echo ('[false,false]');
|
||||
exit;
|
||||
}
|
||||
$got = @json_decode(file_get_contents(JSON_DIR . 'antitor_' . $fqdn[0] . '.json') , true);
|
||||
if (!is_array($got))
|
||||
{
|
||||
die('File Error');
|
||||
}
|
||||
echo (isset($got[$fqdn]) ? '[true,true]' : '[true,false]');
|
Loading…
Reference in New Issue
Block a user