topical media & game development

talk show tell print

professional-search-06-seophp-include-popup-utils.inc.php / php



  <?php
  
  // include config file
  require_once 'config.inc.php';
  
  // display popup navigation only when visitor comes from a SERP
  function display_popup_navigation()
  {
    // display navigation?
    disp_nav = false;
  
    // if there is no REFERER (visitor loaded popup directly), display navigation
    if (!isset(_SERVER['HTTP_REFERER'])) 
    {
      disp_nav = true;
    }
    // if the REFERER not from our domain, display navigation
    else
    {
      // parse the REFERER and the local site using parse_url()
      parsed_referer = parse_url(_SERVER['HTTP_REFERER']);
      parsed_local = parse_url(SITE_DOMAIN);
  
      // extract the domain of the referer, and that of the local site
      referer_host = parsed_referer['host'];
      local_host = parsed_local['host'];
  
      // display navigation if the REFERER URL is not from the local domain
      if (referer_host != local_host)
      {
        disp_nav = true;
      }
    }
  
    // display navigation if necessary
    if (disp_nav == true)
    {
      echo '<a href="catalog.html">Visit our catalog page!</a>';
    }
  }
  
  ?>


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.