Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-17-2003, 05:58 PM   PM User | #1
bhlinder
New to the CF scene

 
Join Date: Nov 2003
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
bhlinder is an unknown quantity at this point
Question any ideas would be helpful

Hello everyone--


I have a new project that I am unsure of how to do. Here's what I need to do: when a user signs up for this site, I need to create the sub domain: http://newUser.mySite.com where newUser is the new person that signs up. I know that this is possible because I some hosting companies have very similar capabilities with in their control panels. The ISP that I am using to host the site does support sub domains too.

Also, how can I grab the url the user entered? I need to be able to set variables based on the URL

i.e. http://user.mySite.com will have user specific elements added from the DB which will be different from http://user2.mySite.com

Any ideas/help would be greatly appreciated. Thanks.
bhlinder is offline   Reply With Quote
Old 11-18-2003, 12:51 AM   PM User | #2
celestine
Regular Coder

 
Join Date: Oct 2003
Location: Australia
Posts: 112
Thanks: 0
Thanked 0 Times in 0 Posts
celestine is an unknown quantity at this point
Hmm. seems like Deviantart.com did it in a similar manner as what you want. All account holders have their gallery in the form of username.deviantart.com.

What DA did (my guess) was to make a folder from the root or something like www.da.com/username, then write a htaccess to redirect username.da.com

Is this what you are looking for?

As for different user specifications for account, maybe you could create different levels of user rights for them.
celestine is offline   Reply With Quote
Old 11-18-2003, 02:40 PM   PM User | #3
bhlinder
New to the CF scene

 
Join Date: Nov 2003
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
bhlinder is an unknown quantity at this point
What do you think about setting up *.site.com as a DNS pointer to site.com and then pulling out the sub domain entered to customize the page for the given user?

So, for example:

test.site.com

would call the pages from site.com which would pull the HOST varialbe and get the 'test' part of the URL to customize the page from the database. What do you think?
bhlinder is offline   Reply With Quote
Old 11-18-2003, 04:27 PM   PM User | #4
PrObLeM
New to the CF scene

 
Join Date: Oct 2003
Location: Mesa, AZ
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
PrObLeM is an unknown quantity at this point
this should help

PHP Code:
<?

$headers 
getallheaders();
$domain_array explode("."$headers["Host"]); 
$i=sizeof($domain_array);

while ( (list(
$k,$v) = each($domain_array)) && $i>2) {
    
$name .= " " $v;
    
$i--;
}

$naam=ltrim($name);



$page_title ucwords($naam) . "Nice";
echo 
$page_title;
?>
PrObLeM is offline   Reply With Quote
Old 11-18-2003, 09:11 PM   PM User | #5
bhlinder
New to the CF scene

 
Join Date: Nov 2003
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
bhlinder is an unknown quantity at this point
working perfectly, thanks for the help.
bhlinder is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:52 PM.


Advertisement
Log in to turn off these ads.