0

Hello i want to match my ip address with ip text list. How would it do? Whereas my ip address with ip address in my ip text list is correct. And already several times I open and always access denied when it has the same ip address

<?php
function inStr($s, $as){
    $s = strtoupper($s);
    if(!is_array($as)) 
        $as=array($as);

    for($i=0;$i<count($as);$i++) 
        if(strpos(($s),strtoupper($as[$i]))!==false) 
            return true;
    return false;
}

$ipchecker = file_get_contents('http://anonsec.us/iplist.txt');
$ip = _SERVER['REMOTE_ADDR'];
if (instr($ipchecker, ''.$ip.'')) {
    echo 'GRANTED';
} else {
    echo 'Access Denied';
}
?>
RiggsFolly
  • 93,638
  • 21
  • 103
  • 149

1 Answers1

0

If you know what delimite your ipchecker you can use that : Example with ipchecker delimite with commat like that: 127.0.0.1,255.255.255.255,...

$delimiter = ",";
$ipList = explode($delimiter, $ipchecker);

if (in_array($ip, $ipList)) {
    echo 'GRANTED';
} else {
    echo 'Access Denied';
}
Kaenn
  • 76
  • 3