subdomain user question

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ecaandrew
Forum Commoner
Posts: 72
Joined: Fri Nov 12, 2004 5:05 pm

subdomain user question

Post 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!
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: subdomain user question

Post 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"
ecaandrew
Forum Commoner
Posts: 72
Joined: Fri Nov 12, 2004 5:05 pm

Post 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!
Post Reply