Forum Moderators: coopster

Message Too Old, No Replies

all thanks to Anyango--Dynamic Sub-Domain with PHP

thanks anyango

         

bizzdeskers

1:56 pm on Nov 22, 2009 (gmt 0)

10+ Year Member



your code on Dynamic Sub-Domain with PHP was of so much help...

global $domainname;
global $subdomainname;
$domainarray = explode('.', $_SERVER['HTTP_HOST']);
$index=count($domainarray)-1;
$domainname= $domainarray[$index-1].".".$domainarray[$index];
$subdomainname="";
for($i=0;$i<$index-1;$i++)
{
if($subdomainname=="")
{
$subdomainname=$domainarray[$i];
}
else
{
$subdomainname=$subdomainname.".".$domainarray[$i];
}

}

if($subdomainname=='www'){include('page1');}else{
if($subdomainname==''){include('page1');}else{include('page2');}
}

$url=$subdomainname;
$url= str_replace("www.","","$url");

coopster

1:24 pm on Dec 5, 2009 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld, bizzdeskers.

I'll have to send a sticky message to Anyango as it's always nice to hear news like this :)