<?php
function checkSpam($ipAddress) {
// Validate the IP address
if (!filter_var($ipAddress, FILTER_VALIDATE_IP)) {
echo "Invalid IP address format\n";
return;
}
// List of spam databases to check
$spamDatabases = array(
"b.barracudacentral.org",
"bl.spamcop.net",
"dnsbl.sorbs.net",
"zen.spamhaus.org"
);
// Check each database for the IP address
foreach ($spamDatabases as $db) {
$query = $ipAddress . "." . $db;
$result = gethostbyname($query);
// Check if the IP address is listed
if ($result == "127.0.0.2" || $result == "::1") {
echo "$ipAddress found in $db\n";
return;
} else {
echo "$ipAddress not found in $db\n";
}
}
}
// Example usage
$ipToCheck = "123.456.789.10"; // Replace this with the IP address you want to check
checkSpam($ipToCheck);
?>
See kontrollib IP-aadressi vormingut ja seejärel kontrollib seda mitme rämpsposti andmebaasiga, kasutades DNSBL-i (DNS Blacklist) otsinguid. Kui IP-aadress leitakse mõnest andmebaasist, prindib see teate, mis näitab, kust see leiti. Vastasel juhul prindib see teate, mis näitab, et IP-aadressi ei leitud konkreetsest andmebaasist.
Kommentaarid (0)
Siin pole veel kommentaare, võite olla esimene!