<?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);
?>
Ini memvalidasi format alamat IP, lalu memeriksanya terhadap beberapa database spam menggunakan pencarian DNSBL (DNS Blacklist). Jika alamat IP ditemukan di salah satu database, ia akan mencetak pesan yang menunjukkan di mana alamat tersebut ditemukan. Jika tidak, ia akan mencetak pesan yang menunjukkan bahwa alamat IP tidak ditemukan dalam database tertentu.
Komentar (0)
Belum ada komentar di sini, Anda bisa menjadi yang pertama!