0

some help would be great!

Domain ABC1.com shows an image ABC1. How can I make it so that it shows image ABC2 when domain ABC2.com forwards, with masking, to ABC1.com?

Basically, the website should change its branding based on the domain name from which it originated.

0

1 Answer 1

0

I would use the referrer to set a variable that is echoed as the base name of the file. Something like:

 <?php

//check to see if referrer is set
if(isset($_SERVER['HTTP_REFERER'])){

    //if referrer is set, evaluate to see if it matches a specified site.  plug in desired where somewebsite appears in quotes in the following line
    if($_SERVER['HTTP_REFERER'] == 'somewebsite'){

        //set baseName for first website
        $baseName = "base1";
    }
    else if($_SERVER['HTTP_REFERER'] == 'somewebsite'){

        //set baseName for second website
        $baseName = "base2";
    }

    //evaluate as many websites in this manner as you'd like        

    //set baseName value if http referrer does not match any specified site
    else{
        $baseName = "basenone";
    }
}

//set baseName value if no HTTP_REFERER

else{
    $baseName = "basenotset";
}

//echo baseName as first part of logo filename.  note that for this solution to work, you will have to name your logo files base1_logo.jpg, base2_logo, ... $basenone_logo  

echo "<img src=\"".$baseName."_logo.jpg.\">";
echo '<a href="test.php">TEST</a>'; 
echo "<p>".$_SERVER['HTTP_REFERER'];

?>
1
  • Works Perfect !! ... thanks for spelling out ALL the code!!! and thank you again for such a fast answer :) ... cant vote you up yet it seems ... i dont have the status yet :(
    – Sach
    Oct 9, 2014 at 22:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.