2014-10-07 67 views
0

一些幫助將是偉大的!不同的網站標誌爲不同的隱藏(蒙面)網址

域名ABC1.com顯示一個圖片ABC1。我怎樣才能讓這個它顯示圖像ABC2時域ABC2.com前鋒,與屏蔽,以ABC1.com?

基本上,網站應根據其源自的域名更改其品牌。

+0

使用引用者? – 2014-10-07 20:51:17

回答

0

我會使用引用來設置一個變量作爲文件的基本名稱作爲回顯。例如:

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

?> 
+0

作品完美! ...感謝拼出所有的代碼!並再次感謝你這樣一個快速的答案:) ...不能投票給你,但似乎...我沒有狀態呢:( – Sach 2014-10-09 22:22:15