I'm using php to make it so that incoming traffic to my website will append information depending on the search engine. I'm setting $_SESSION['kw'], if it's not already set, to tel me that it's seo and to append the search terms:
if (isset($result['q']))
$_SESSION['kw'] = 'seo-'.str_replace('\\"',"X",$result['q']);
elseif (isset($result['p']))
$_SESSION['kw'] = 'seo-'.$result['p'];
else {some other stuff}
q is what google, msn and ask use for their queries, p is for yahoo. That covers most of the incoming traffic. OK so now I want to change it a bit so that if the referring page is yahoo, it appends a Y, if it's google a G, msn M etc.
I tried:
if (isset($result['q'])& strstr($_SERVER['HTTP_REFERER'],'google'))
$_SESSION['kw'] = 'seo-G-'.str_replace('\\"',"X",$result['q']);
elseif (isset($result['q'])& !strstr($_SERVER['HTTP_REFERER'],'google'))
$_SESSION['kw'] = 'seo-M-'.str_replace('\\"',"X",$result['q']);
elseif (isset($result['p']))
$_SESSION['kw'] = 'seo-Y-'.$result['p'];
else {some other stuff}
But I can't make the first IF true. If I come from ask.com, I get "seo-M appended", but I can't even when coming from google, get it to append. Am I just formatting it wrong?