Hi people,
I am trying to redirect people on my site depending on their IP Address, and more specifically everyone who’s IP doesn’t match the one specified in the array, in my code.
Here is my code:
$allowed = array("94.171.121.121");
$ip = $REMOTE_ADDR;
if(!in_array($ip, $allowed))
{
header("Location: http://www.google.co.uk); /* Redirect browser */
/* Make sure that code below does not get executed when we redirect. */
exit;
}
else
{
}
?>
The problem is it redirects everyone even the specified IP address.
Any tips how to make it work?
Regards,
Aleksander