title: Reliability of php HTTP_HOST & HTTP_REFERER for critical task
body: <p>I'm going to develop a website in PHP. But not sure if the method i'm going to use is the best approach. There will be many addon domains for the same site. But content will be filtered based on the domain used to visit the site.</p>
  
  <p>For Example If a user comes from the domain siteusa.com then the content will be shown filtered accordingly specific user. If the user comes from siteuk.com/sitechina.com the content will be filetered accordingly etc...</p>
  
  <p>I'm planning to do something like this to detect the url and serve content</p>
  
  <pre><code> $ref = getenv("HTTP_REFERER");
      echo $ref; 
  </code></pre>
  
  <p>or by</p>
  
  <pre><code>$host = $_SERVER['HTTP_HOST'];
  echo $host ;
  </code></pre>
  
  <p>Is this is the best method to do this? Is there any possible bottleneck I may get into? This should not fail to detect the domain as its critical.</p>
  
  <p>The main domain of the site will be serving unfiltered content and each addon domain will filter it according to filter set for each domain from backend. </p>
  
  <p>There is a smilar question but in regard with codeigniter <a href="https://stackoverflow.com/questions/3896162/serving-different-content-based-on-the-domain-in-codeigniter">here</a>.</p>