Maybe try this:
PHP Code:
$ref = str_replace("http://","",$HTTP_SERVER_VARS["HTTP_REFERER"]);
$ref = str_replace("www.","",$ref);
$ref = explode("/",$ref);
$ref = $ref[0];
switch ($ref)
{
case "ab.com":
$link = "ppc link";
break;
case "cd.com":
$link = "email link";
break;
case "de.com":
$link = "forum link";
break;
default:
$link = "Direct Request";
break;
}
It will remove the http:// and www. and if the referer is something like http://ab.com/index.php?p=something it will remove everything after the /
Also I have removed the if statement because it does the same thing as switch, only i've put a default in there which is the same as an else
Bookmarks