What I want to do:
Remote addresses are in this format:
"xxx.xxx.xxx.xxx."
I want ANYONE visiting my page with a remote address beginning with "206.221.223.xxx" (the last 3 digits don't matter), to be redirected to another location.
Here is what I've BEEN using....but something tells me maybe I should use ereg or preg. If I SHOULD be using ereg, or preg, could someone please type the correct syntax that would be most efficient:
$z = $REMOTE_ADDR
$match = "206.221.223";
if (!strncmp($z, $match, strlen($match)))
{
$url= "/alternatelocation;
header("location: $url");
}
Also.... if you would be kind enough to take a moment to tell me something: As I look at the code I have been using, I would read it like this: "If string does NOT compare (remote address, match), go to alternate location." However, it seems to work the OPPOSITE! Anyway, should I be using this code anyway, or be using if (preg... or if(ereg....