Hey, I'm creating a usersystem that has a profile system. I'm stuck on a problem. I want the profile to be viewed by a url like:

www.mysite.com/member/phillip/

So every time someone registers it automatically creates this folder. The problem that I'm having is that I need to place an 'index.php' file into that folder. The question is: How do I transfer a file into the folder? i.e.:

Create folder "Phillip"
Copy index.php TO "Phillip"

Thanks :)

use the mkdir() function to create a directory the the copy() function to copy the index file
:)

Hey, I'm creating a usersystem that has a profile system. I'm stuck on a problem. I want the profile to be viewed by a url like:

www.mysite.com/member/phillip/

So every time someone registers it automatically creates this folder. The problem that I'm having is that I need to place an 'index.php' file into that folder. The question is: How do I transfer a file into the folder? i.e.:

Create folder "Phillip"
Copy index.php TO "Phillip"

Thanks :)

There are a couple of ways of doing this. The first option that I would look into if you have a linux server is creating a symbolic link. This is a lot like a shortcut for windows. I would keep my primary file in another directory probably named /includes/profiles/basic/index.php. This will allow you to create other profiles as well, for instance: if you ended up wanting to provide advanced features or something like that then you would have /includes/profiles/advanced/index.php.

Now, lets say that you are executing a script in your root directory. You want to create the directory "member" and then run the following php function:

exec("ln -s ./includes/profiles/basic ./member/phillip");

This way you are not replicating the file a thousand times and if you have to make a change, you just change the file in your includes directory. There are other ways of doing this through php includes and such so if this is not an option, let me know.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.