set variables based on HTTP_HOST

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Is this potentially bad, security wise, to do something like this? Can
you guys recommend any way to tighten this up a bit or do this sort of
thing better/more eloquently?


<?

$Host1 = array ('name1.host.com');
if (in_array ($_SERVER['HTTP_HOST'], $Host1))
         {
         $HeaderImg = "/headers/name1_header.gif"; // define graphic 
         $SiteCSS = "/css/name1_css.css"; // define css 
         }
$Host2 = array ('name2.host.com');
if (in_array ($_SERVER['HTTP_HOST'], $Host1))
         {
         $HeaderImg = "/headers/name2_header.gif"; // define graphic 
         $SiteCSS = "/css/name2_css.css"; // define css 
         }
$Host3 = array ('name3.host.com');
if (in_array ($_SERVER['HTTP_HOST'], $Host1))
         {
         $HeaderImg = "/headers/name3_header.gif"; // define graphic 
         $SiteCSS = "/css/name3_css.css"; // define css 
         }
$Host4 = array ('name4.host.com');
if (in_array ($_SERVER['HTTP_HOST'], $Host1))
         {
         $HeaderImg = "/headers/name4_header.gif"; // define graphic 
         $SiteCSS = "/css/name4_css.css"; // define css 
         }
else
         {
         $HeaderImg = "/headers/main_header.gif"; // define graphic 
         $SiteCSS = "/css/main_css.css"; // define css 
         }

?>




<link rel="stylesheet" href="<? echo $SiteCSS ?>" type="text/css" />
<img src="<? echo $HeaderImg ?>">


The idea is to use this in the global header of a site that may be
invoked through up to 20-30 different third level subdomains, for the
same content. Standard stuff, one site, one set of tools to run it,
but each subdomain's slightly unique content pulls based on host.

thanks,
Joe

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux