Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

HTML Forum


You are currently viewing our HTML Forum as a guest. Please register to participate.
Login



Post a Project »

Find a Professional HTML Freelancer!

Find a Freelancer to help you with your HTML projects

FREE Outsourcing eBook!

Reply
showing different images when coming from certain urls
Old 10-20-2008, 04:11 PM showing different images when coming from certain urls
Novice Talker

Posts: 5
Trades: 0
Hi
I have a query, and am not sure even if this can be implemented - not sure even what language it could be written in....

Basically I have 2 websites (with similer designs - but different headers) , and 1 oscommerce store.

What I want is when customers come from 1 url it will show 1 header / logo

and when they come from the other url - it will show the other header / logo

this would mean that the design will be concurrent from the website the customer has visited from

Can this be done - any pointers on how it could be implemented

again 2 urls 2 different headers

Thanks
Ron
fernyburn is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 10-20-2008, 04:55 PM Re: showing different images when coming from certain urls
wayfarer07's Avatar
Poo on You

Latest Blog Post:
Introducing WowWindow
Posts: 3,987
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
There is a header known as the Referer, that is by no means accurate, as some browsers do not send it. That is about your best shot. The referer can be read either with JavaScript or with any server-side code, which is probably what you should choose for maximum stability.

Just remember, it isn't reliable, and it can be faked.
__________________
I build web things. I work for the startup
Please login or register to view this content. Registration is FREE
.
wayfarer07 is offline
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Old 10-20-2008, 04:59 PM Re: showing different images when coming from certain urls
.Gary's Avatar
Experienced Talker

Posts: 43
Name: Gary
Location: Colchester, UK
Trades: 0
PHP Code:
<?php
// edit yoursite & yourothersite to the referring domains
$site['yoursite'] = 'header_image_1.jpg';
$site['yourothersite'] = 'header_image_2.jpg';

if(!empty(
$_SERVER['HTTP_REFERER'])) {
    
$data parse_url($_SERVER['HTTP_REFERER']);
    foreach(
$site as $domain => $text) {
        if(
strpos(strtolower($data['host']), $domain) !== false) {
            echo 
'<img src="'.$text.'" alt="AltText" />';
            break;
        }
    }
} else {
    
// If no referring domain is given, use this
    
echo '<img src="header_image.jpg" alt="AltText" />';
}
?>
Et voila.
Credit goes to BlueHatSEO - I've simply modified the code for your needs.
__________________
» For Hire:
Please login or register to view this content. Registration is FREE

»
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
- real.forum.design.by.experts

Last edited by .Gary; 10-20-2008 at 05:02 PM..
.Gary is offline
Reply With Quote
View Public Profile Visit .Gary's homepage!
 
Old 10-21-2008, 12:04 PM Re: showing different images when coming from certain urls
Novice Talker

Posts: 5
Trades: 0
Thankyou so much that is a great help !!
fernyburn is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to showing different images when coming from certain urls
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.23100 seconds with 12 queries