<?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);
?>
IP 주소 형식의 유효성을 검사한 다음 DNSBL(DNS 블랙리스트) 조회를 사용하여 여러 스팸 데이터베이스와 비교하여 확인합니다. IP 주소가 데이터베이스 중 하나에서 발견되면 발견된 위치를 나타내는 메시지가 인쇄됩니다. 그렇지 않으면 특정 데이터베이스에서 IP 주소를 찾을 수 없다는 메시지를 인쇄합니다.
댓글 (0)
여기에는 아직 댓글이 없습니다. 첫 번째 댓글이 되실 수 있습니다!