View Single Post
Old 2012-02-29, 03:14 AM   #1
A.J. Angel
And Lord, we are especially thankful for nuclear power, the cleanest, safest
energy source there is. Except for solar, which is just a pipe dream
 
Join Date: Sep 2008
Posts: 229
PHP Referrer & Display Help

Hello,

I am currently using the following code below to display two different codes depending on referrers. It came to my attention that if the page is visited from a direct url or a bookmark for example, the include is not working. It only works if the page is visited from "somewhere".

As such, I wish to ask if someone may be able to "fix" the code. Basically, I wish to display the first code if the visitor comes from domain.com otherwise, the include is displayed no matter where else they come from. Thank you in advance.

PHP Code:
      if(isset($_SERVER['HTTP_REFERER'])) {
          
$referrer $_SERVER['HTTP_REFERER'];
          if(
stristr($referrer'domain.com')) {
               echo 
'<INSERT CODE>';
          } else {
               include 
$_SERVER['DOCUMENT_ROOT'].("/path/to/file.html");
          }
     } 

Last edited by A.J. Angel; 2012-02-29 at 03:22 AM..
A.J. Angel is offline   Reply With Quote