dantm
06-07-2004, 11:48 PM
Hi, I am trying to accomplish the following:
-- redirect various visitors to my website to other sites, based on their IP. As I want to exclude various classes of IP, how would this be done with PHP. So far I have the following:
<?php
$ipi = getenv("REMOTE_ADDR");
if(eregi("111(.*)", $ipi) || eregi("222(.*)", $ipi))
{
echo "<META http-equiv='Refresh' content='0; url=welcome.html'>";
}
else
{
echo "<META http-equiv='Refresh' content='0; url=index2.html'>";
}
?>
In this case, welcome.html uses a redirect function to send people to somewhere.com.
In the above case, the IPs of the form 111.xxx.xxx.xxx and 222.xxx.xxx.xxx are restricted.
Anybody who can tell me how would I restrict 111.123.134.xxx and so on? This would restrict a very limited domain.
Can I use the same function?
THANKS!!!!
-- redirect various visitors to my website to other sites, based on their IP. As I want to exclude various classes of IP, how would this be done with PHP. So far I have the following:
<?php
$ipi = getenv("REMOTE_ADDR");
if(eregi("111(.*)", $ipi) || eregi("222(.*)", $ipi))
{
echo "<META http-equiv='Refresh' content='0; url=welcome.html'>";
}
else
{
echo "<META http-equiv='Refresh' content='0; url=index2.html'>";
}
?>
In this case, welcome.html uses a redirect function to send people to somewhere.com.
In the above case, the IPs of the form 111.xxx.xxx.xxx and 222.xxx.xxx.xxx are restricted.
Anybody who can tell me how would I restrict 111.123.134.xxx and so on? This would restrict a very limited domain.
Can I use the same function?
THANKS!!!!