Create index.php

main
Muhammad Daffa 2021-04-23 17:32:10 +07:00 committed by GitHub
parent f0f646d655
commit 8bd623c6bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 35 additions and 0 deletions

35
index.php Normal file
View File

@ -0,0 +1,35 @@
<?php
$param = $_GET["spf"];
$param2 = "_dmarc." . $_GET["dmarc"];
if ($param) {
check($param,"v=spf1");
}
if ($param2) {
check($param2,"v=DMARC1");
}
function check($url, $string) {
$array = dns_get_record($url, DNS_ALL);
for ($i = 0; $i <= count($array) - 1; $i++) {
$nestedarray = $array[$i];
for ($j = 0; $j <= count($nestedarray) - 1; $j++) {
if (array_key_exists("txt", $nestedarray)) {
$str = $nestedarray['txt'];
$search = $string;
if (preg_match("/{$search}/i", $str)) {
echo (prepareAPIResponse("success", $str, "found"));
break;
}
}
}
}
}
function prepareAPIResponse($status='success', $data=null, $msg=null) {
header('content-type: application/json');
return json_encode([
'status'=>$status,
'data'=>$data,
'message'=>$msg
]);
}