I'm trying to create an api like https://blackbox.ipinfo.app/lookup/ to detect suspicious ip addresses, but my code is not up to expectations.
<?php
$ips = array('127.0.0.1', '30.121.111.2', '1.2.3.4', '123'); // SUSPICIOUS IP, HTTPS://example.com/?123 WORK BUT NOT FOR 127.0.0.1 ETC
foreach($ips as $badips)
{
if (isset($_GET[$badips])) // CALL LIKE HTTPS://example.org/?1234
{
$blacklists = 'Y';
}
}
if ($blacklists == "Y")
{
echo "Y";
} else {
echo "N";
}
?>
what's wrong with this code? when i call htttps://example.org/?1234 it outputs result ="Y" but when i call with https://example.org/?127.0.0.1 // etc it outputs "N" result