Forum Moderators: coopster

Message Too Old, No Replies

Folder created with username and with files within it

php, user profiles, user directory

         

redfoxhound

2:20 am on Feb 18, 2009 (gmt 0)

10+ Year Member



Hello guys,

I am not a total nub with php. I know how to create a dynamic site with php and sql. I just wanted to know what I would have to do to the following.

A user registers stores information in database. A profile gets created inside a generated directory called their username. So if "yomama" is your username, once you submit registration, a directory is created for that user called "yomama" and inside this directory are files like index.php, page.php, page2.php. It will still be getting data from the database, it won't be static.

From what I'm thinking is, I create a script after registration to create a directory named their username, then add a file and write to the file the php and html scripts? Like the source code of their template with html body, css linking, body, php includes, etc. is this the best way to do this?

thanks guys any help will be appreciated

webfoo

12:18 pm on Feb 19, 2009 (gmt 0)

10+ Year Member



is this the best way to do this?

It depends. If each user's PHP files are different, then this is the way to go. But if you're creating copies of the same files to put in each user's directory, its not such a great way to do it.

Because if you need to make a change to everyone's page2.php, then you have to go through every single user's directory and modify. But if you have one page2.php that all users access, like
page2.php?user=yomama

That might be better. So please clarify a little on what you're doing, so we can better understand the problem.

redfoxhound

2:42 pm on Feb 19, 2009 (gmt 0)

10+ Year Member



I have a site that I'm developing.

It requires user profile with multiple pages. Basically it's the same type of template. If say a file is called profile.php, it will have the same source code. They will be able to customize their profile with themes, with CSS only.

They will also have different pages within their profile, like about.php, rsvp.php, events.php, etc.

Coincidentally I only recently remembered about mod_rewrites and I could probably achieve that same thing without creating directories.

Also, they will have the option to disable/enable different pages within their profile.

webfoo

6:51 pm on Feb 19, 2009 (gmt 0)

10+ Year Member



If it's the same source code within each user, I'd opt for NOT using a seperate directory for each one. Instead, go with

about.php?user=yomama
rsvp.php?user=yomama

The CSS can be dynamically written based on the user's prefercnes.

Yes, some sort of mod_rewrites could acomplish this also.