Page 1 of 1

How to create folder or subdirectory with user registration?

Posted: Mon Jan 08, 2007 10:16 pm
by StudioMedia
I am creating a classified ad website for a particular market.

I am trying to focus on high-quality ads instead of huge dinky listings.

One of my main selling points is having them register and create a subdirectory for them right off the home page, similar to MySpace, ex:
http://www.domainname.com/user/

That way when their item is listed for sale on my online directory, they can also tell people their own website URL until the item is sold.

The items are $100K+ value so I would really like to be the one offering a high quality service.

Thanks for any direction on this as I am yet to find anything related at all.

Posted: Mon Jan 08, 2007 11:55 pm
by aaronhall
You could use mod_rewrite, have all request directed to a single file, and parse $_SERVER['REQUEST_URI'] to extract the username.

Posted: Tue Jan 09, 2007 9:42 am
by StudioMedia
I dont have any experience with mod_rewrite at all. I took a look at the link but that stuff is over my head at this point.... 8O

Posted: Tue Jan 09, 2007 10:08 am
by Kieran Huggins
Technically, this is also over your head as well.

mod_rewrite is likely your fastest way out of the woods, learning included.

Posted: Tue Jan 09, 2007 11:31 am
by StudioMedia
What about using mk_dir to create folders in the public_html folder?

Posted: Tue Jan 09, 2007 11:53 am
by feyd
You're going to have a lot of basically empty folders. While technically you can do it, it's a waste of space and resources over mod_rewrite solutions in this case.

While it may be easier to manage in the beginning for yourself, it will become a massive pain later on when you have hundreds or thousands of these folders.

Posted: Tue Jan 09, 2007 11:57 am
by StudioMedia
Where are these empty folders going to come from? Is it just a downside to that particular code or something?

Posted: Tue Jan 09, 2007 12:22 pm
by feyd
mkdir() will create an empty directory. You'll then likely place a single file in it that directs somewhere.

Repeat that over say one thousand users. Your server may start having problems accessing the parent directory, depending on its basic limits. No to mention the frustration you may incur using FTP.

Posted: Tue Jan 09, 2007 3:15 pm
by aaronhall
If you don't like mod_rewrite, you could have URLs like "http://www.mysite.com/?username" which would have all requests directed to your index.php file, with the username available as $argv[0] (I think).