Search This Blog

ckeck ip address is in blocked list or not in php

ip-addr.php :

<?php

include 'ip.inc.php';
foreach($ip_block as $ipb)
 if($ipb==$ip_addr)
 {
   die('<br><br><center><b>your ip is bloacked</center></b>').'<br>';
 }

?>
<center><b><br><br>welcome world</center></b>

=========================================================
ip.inc.php :

<?php

$ip_addr=$_SERVER['REMOTE_ADDR'];
$ip_block=array('222.32.36.25');
?>
===========================================================
run " ip-addr.php "

output :
welcome world

note :
1) if your ip addsess is in block list then is displays  " your ip is bloacked "


Share Links

Related Posts Plugin for WordPress, Blogger...