Show specific image based on visitor's referrer

I would like a script that will show an image (called from an external website) to visitors of my website ONLY if they've come from a Bing search engine result.

For example:

If a visitor arrives on my site via a Bing search result, then I would like the results of the following code shown to them;

<img width="65" height="37" border="0" src="//www.examplesite.com/image1.gif" alt="blah">

However, if they came from any other referrer (or just typed-in the URL), then they will not be shown the above code. (Obviously I don't mind it being present if they look in the source code.)

Hope this makes sense. Thanks.
phaygarthAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jet-blackCommented:
Try this:

<?php
if (isset($_SERVER['HTTP_REFERER']))
{
    $parseUrl = parse_url($_SERVER['HTTP_REFERER']);
    if ($parseUrl['host'] == "www.bing.com" || $parseUrl['host'] == "bing.com")
    {
?>
<img width="65" height="37" border="0" src="//www.examplesite.com/image1.gif" alt="blah">
<?php
    }
}
?>

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
phaygarthAuthor Commented:
Perfect, thanks.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.