Forum Moderators: coopster
If you know the IP addresses to ban, store them in an array, then check against the array and if the IP is found, redirect. If you want a wild card entry, ie all entries beginning with 195 you can use substr().
$ip = $_SERVER['REMOTE_ADDR'];
if (substr($ip,0,3)=="195")
{
//redirect
}
Array version:
$ipaddresses = array('123','234','345');
if (in_array($ip,$ipaddresses))
{
//redirect
}
Hope that helps
Im a bit of a novice at php, so can you elaborate on the //Redirect function please?
Whats the actual format i need to write the redirect page in please?
Is it somethng like:
<?php
$ip = $_SERVER['REMOTE_ADDR'];
if (substr($ip,0,3)=="195")
{
[mydomain.com...]
}
?>
Thank you again.