How to create folder or subdirectory with user registration?

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
StudioMedia
Forum Newbie
Posts: 4
Joined: Mon Jan 08, 2007 9:44 pm

How to create folder or subdirectory with user registration?

Post 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.
User avatar
aaronhall
DevNet Resident
Posts: 1040
Joined: Tue Aug 13, 2002 5:10 pm
Location: Back in Phoenix, missing the microbrews
Contact:

Post by aaronhall »

You could use mod_rewrite, have all request directed to a single file, and parse $_SERVER['REQUEST_URI'] to extract the username.
StudioMedia
Forum Newbie
Posts: 4
Joined: Mon Jan 08, 2007 9:44 pm

Post 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
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Post 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.
StudioMedia
Forum Newbie
Posts: 4
Joined: Mon Jan 08, 2007 9:44 pm

Post by StudioMedia »

What about using mk_dir to create folders in the public_html folder?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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.
StudioMedia
Forum Newbie
Posts: 4
Joined: Mon Jan 08, 2007 9:44 pm

Post by StudioMedia »

Where are these empty folders going to come from? Is it just a downside to that particular code or something?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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.
User avatar
aaronhall
DevNet Resident
Posts: 1040
Joined: Tue Aug 13, 2002 5:10 pm
Location: Back in Phoenix, missing the microbrews
Contact:

Post 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).
Post Reply