Discussions
Categories
Groups
Advertisement
Child Item
Home
Topics
Technology & Internet
Software & Web Development
Design
(PHP) Redirection Based on IP - Problem?
justindublin
Hey Guys,
Currently using the following code from an redirection based on IP address....
<?php
if(isset($_SERVER) && $_SERVER == "IP Address One")
{
header("Location:
http://www.Site1.com);
}
else
header("Location:
http://www.Site2.com")
;
}
exit();
?>
But how do I add mulpital visitor IP's to the code?
Cheers,
Paul
Find more posts tagged with
Quick Links
All Categories
Recent Posts
Activity
Unanswered
Groups
Best Of
Advertisement
Advertisement
Comments
TheWaterboy
Not 100% sure of your actual question but ill give you an answer to what I think you are trying to achieve.
To add multiple visitors IP addresses just put them in an array and then use the in_array() function to check if the value of $_SERVER is in this array.
if(isset($_SERVER) {
if (in_array($_SERVER, $myIPList)) {
header("Location:
http://www.Site1.com);
} else {
header("Location:
http://www.Site2.com);
}
die();
}