Page 1 of 1

subdomain user question

Posted: Sun Mar 20, 2005 6:01 am
by ecaandrew
how do you make it so when a u ser registers, they are giving a subdomain

http://username.domain.com

and how would you make it so if someone goes to that subdomain, it would grab the username frmo the url, like usually I would use a $_GET command to grab

?name=username


$_GET['name']

any ideas, thanks!

Re: subdomain user question

Posted: Sun Mar 20, 2005 6:07 am
by Chris Corbyn
ecaandrew wrote:how do you make it so when a <span style='color:blue' title='ignorance is bliss'>you</span> ser registers, they are giving a subdomain

http://username.domain.com

and how would you make it so if someone goes to that subdomain, it would grab the username frmo the url, like usually I would use a $_GET command to grab

?name=username


$_GET['name']

any ideas, thanks!
To get the username from the URL:

Code: Select all

$url = $_SERVER['SERVER_NAME'];
$url_bits = explode('.', $url);
$username = $url_bits[0];
Not sure on how adding subdomains on-the-fly works but I'm sure Google may help :wink:

Google "Add subdomains dynamically"

Posted: Sun Mar 20, 2005 6:25 am
by ecaandrew
thankyou very much, i did a search and came up with this

http://www.liquidpulse.net/articles/php ... subdomains


looks useful, if anyone has any tips or so, let me know, thankyou!