Hi guys im new here and I badly need help with a redirection script that im working on and need your advice.
My redirection script in PHP is meant to redirect people when they click on a link to my website to an affiliate link based on the url they are coming from, I also need the script to check to see if a search engine spider is visiting my website and to redirect to my homepage approprietly.
I have a decent script so far and this sounds easy enough but when i try to add multiple search engine spider ip adresses to the script it comes up with errors when i try to load my page.
My script is as follows:
Code:
<?
$source=getenv("HTTP_REFERER");
if( ($source=="REFERER URL HERE")||($source=="SECOND REFERER URL HERE") )
{
header("location:AFFILIATE LINK HERE");
}
?>
<?
$visitor = $_SERVER['REMOTE_ADDR'];
if (preg_match("/SPIDER IP HERE/",$visitor)) {
header('Location:HOMEPAGE LINK HERE');
} else {
header(' ');
};
?>
The first section of the code, the one with the affiliate link redirect, works fine but all i need to know is how to add more search engine spider ips to the script. Whenever i try to add more than one ip it comes up with an error, ive tried everything but nothing seems to work, can you help me out?