不同的传入(蒙面)网址的不同网站徽标

时间:2014-10-07 20:18:01

标签: php dns image-masking

一些帮助会很棒!

ABC1.com 显示图片ABC1 。当域 ABC2.com 转发屏蔽时,如何才能显示图片ABC2 ABC1.com?

基本上,网站应根据其来源的域名更改其品牌。

1 个答案:

答案 0 :(得分:0)

我会使用referrer设置一个作为文件基本名称回显的变量。类似的东西:

 <?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'];

?>