$refer = $_SERVER["HTTP_REFERER"]; #full URL searched for $keyterms = explode("&", $refer); #seperate the URL by & for($i=0;$i<10;$i++){ $keywords = explode("=", $keyterms[$i]); #find the section that has the words searched for if($keywords[0] == "q"){ $keywords = $keywords[1]; #set $keyword = to the keywords found $i = 10; #escape the loop } else{ $keywords = "None"; } } $keyword = explode("+", $keywords); #find individual words in the keywords for($i=0;$i<10;$i++){ #loop through the individual words found #selection of words to search for in the keywords if($keyword[$i] == "tesco" || $keyword[$i] == "tescos" || $keyword[$i] == "shopping"){ #what to do when a word is found header("Location: http://clk.tradedoubler.com/click?p=22593&a=1074098&g=12802541"); $i = 11; #escape the loop } } ?>