Forum Moderators: coopster
$RemoteIP = $_SERVER['REMOTE_ADDR'];
if (!preg_match("#^20[0-5]#",$RemoteIP))
{
showAds();
}
Modify the regex to your needs, but matching IPs should be fairly simple. The above example would show ads to everyone that is NOT in the 200-205 class A range.
If you want to get more specific, you can do something like:
preg_match("#^123\.123\.123\.[0-2][0-5][0-5]$#",$RemoteIP)
which would match anything in the 123.123.123 class C range