0

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 :)

3
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by OS_dev
0

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

0

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.

Edited by OS_dev: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.