Souled
asked on
Ban IP's
Hi all,
I had a previous question here before on banning certain IPs and redirect them to another page
I got the following code
<?php
/* put this at the top of your page */
$certain_ips = array('62.215','62.150','1 95.226','1 95.39','21 3.189','21 3.181','16 8.187','19 4.54');
foreach($certain_ips as $ip)
{
if(substr($_SERVER['REMOTE _ADDR'], 0, strlen($ip)) == $ip)
{
header('Location:login.php ');
exit();
}
else
{
header('Location:chat.php' );
exit();
}
}
?>
The IPs shown are the banned IPs in my site. The problem with this code that it bans only the first two IPs but the rest still can access the site normally.
Anyone can fix that plz?
I had a previous question here before on banning certain IPs and redirect them to another page
I got the following code
<?php
/* put this at the top of your page */
$certain_ips = array('62.215','62.150','1
foreach($certain_ips as $ip)
{
if(substr($_SERVER['REMOTE
{
header('Location:login.php
exit();
}
else
{
header('Location:chat.php'
exit();
}
}
?>
The IPs shown are the banned IPs in my site. The problem with this code that it bans only the first two IPs but the rest still can access the site normally.
Anyone can fix that plz?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
sorry that last } should not be there
ASKER
I noticed that.
It gave me error when I processed it.
Now its all fine.
Thanks man
no problem :)
ASKER