I got 1 landing page for some cpa stuff. I would like to have 1 Iframe to be shown for everything except 1 user referer string. How can I do this? This is the following code I have now, but it's not working correctly. Im using regex match (preg_match) with the $SERVER_HTTP_REFERER varible to get the user search string. Code: So, basically I have two iframes on the same landing page. I want one to only show when the user is refered using the strings miami tshirts. But I want all other referer strings to be shown the 2nd landing page.
I don't understand... Do you want 1 out of every 2 people. Or do you want it from ref=miamitshirts.com?
Sorry, I will try to make it more clear. I want the first iframe to only display for people that found the page by typing Miami Tshirts in an SE. And the second to display for every other request.
The following should work : <?php $keywordfilter = "bmiami shirts"; $iframehtm = ""; if(PageIsReferedBy($keywordfilter)){ $iframehtm = "Your iframe stuff here for the Bmiami Shirts referers"; }else{ $iframehtm = "Your iframe stuff here for all other keywords and referers"; } echo $iframehtm; function PageIsReferedBy($keywords){ /* B.V.E. - 2006 - www.bv-evers.com */ //Referer must be set to be able to continue if(!isset($_SERVER['HTTP_REFERER'])) return false; //Setup different possible KW variations $variation1 = urlencode($keywords); $variation2 = str_replace(" ","%20",$keywords); $variation3 = $keywords; if(strpos($_SERVER['HTTP_REFERER'],$variation1) !== false) return true; if(strpos($_SERVER['HTTP_REFERER'],$variation2) !== false) return true; if(strpos($_SERVER['HTTP_REFERER'],$variation3) !== false) return true; return false; } ?> PHP:
Mmmm, it doesn't seem to be working. It doesn't seem to just abide to Miami Tshirts. If anything contains tshirts it doesn't show the first iframe.
The PageIsReferedBy function does work, so I guess I misunderstood when and what you exactly want to display... I'm still not 100% sure what you're exactly trying to achieve but you should be able to achieve it by using the provided function in combination with an IF/SWITCH statement...