I am testing the http referrer to see if it is from another page on my site but it is throwing me a problem in that sometimes people search for my domain name, or links to my site contain my domain name. I am currently using : (preg_match ("/www.eaguingamp.co.uk/i", "$refurl")) I think I need to check that it also has the http:// How can I add that to this statement, It keeps throwing me an error!
Do this... $referer = str_replace("www.", "", parse_url($_SERVER['HTTP_REFERER'], PHP_URL_HOST)); if(preg_match("/eaguingamp\.co\.uk/i", $referer)){ //the visitor came from eaguingamp.co.uk, theirfore proceed... } PHP:
if(stristr($_SERVER['HTTP_REFERER'], "eaguingamp.co.uk")){ //the visitor came from eaguingamp.co.uk, theirfore proceed... } PHP: Don't know if your still following this thread, but forgot to mention this method, you might find it easier then using regular expressions