how to make dir on new registration?

01-06-06, 03:54 PM
|
|
Newbie Coder
|
|
Join Date: Dec 2004
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
|
how to make dir on new registration?
I am trying to modify a script I have so when a new user signs up it creates a folder for them.
The script is located at http://www.mysite.com/folder1
I want their folder to be created at http://www.mysite.com/folder2/username
so in relation to the script it would need to be ../folder2/NEWFOLDER (based on their username).
The user does not need to know that this folder has been created or anything, as it is for admin use only.
Any help would be appreciated.
Regards
Simon
|

01-06-06, 04:00 PM
|
 |
Community VIP
|
|
Join Date: Mar 2005
Location: ProgrammingTalk
Posts: 2,449
Thanks: 0
Thanked 6 Times in 5 Posts
|
|
I think that you have to use mkdir.
|

01-06-06, 04:11 PM
|
|
Newbie Coder
|
|
Join Date: Dec 2004
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thanks for the link.
So in theory, all I would have to add to make a new folder called "newfolder" is;
Is that correct (I would want the folder to be set as 777).
The next step will be finding out what is used to make the username, add underscores to it if there are any spaces and add that in instead of "newfolder".
Anyone know how to do part 2?
Please bear in mind that I'm a complete noob and I'm not trying to become an expert in php or anything, just trying to do what needs to be done!
Thanks
Last edited by recedo; 01-06-06 at 04:20 PM.
|

01-06-06, 04:34 PM
|
 |
Community VIP
|
|
Join Date: Mar 2005
Location: ProgrammingTalk
Posts: 2,449
Thanks: 0
Thanked 6 Times in 5 Posts
|
|
With out your complete registration script, I will only be able to guess.
Change $_POST['username'] to whatever is telling you script what the folder name is. Yes you want it be 777.
|

01-06-06, 07:48 PM
|
 |
Wannabe Coder
|
|
Join Date: Sep 2005
Location: Oxford, UK
Posts: 239
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Quote:
|
Originally Posted by recedo
The next step will be finding out what is used to make the username, add underscores to it if there are any spaces and add that in instead of "newfolder".
|
PHP: str_replace - Manual
|

01-06-06, 08:27 PM
|
 |
Community VIP
|
|
Join Date: Mar 2005
Location: ProgrammingTalk
Posts: 2,449
Thanks: 0
Thanked 6 Times in 5 Posts
|
|
Quote:
|
Originally Posted by Richard
|
I didn't catch that, thanks.
this is the new code:
|

01-06-06, 09:34 PM
|
|
Newbie Coder
|
|
Join Date: Dec 2004
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thanks guys, I appreciate the help.
I have not even looked at the code myself yet so I'm not sure what the username variable would be called, but I'm sure I can figure that out.
Can you think of any issues that may be caused with this script? For example anything that may cause that code to fail and cause an error.
The script will not be ran by members of the public, only our staff, as we create the accounts 'manually' for our members.
Also, just looking at the code again, you put "/folder2/". Would I not need to use "../folder2/" as folder2 is on the same level as folder1 eg;
http://www.site.com/folder1
http://www.site.com/folder2
http://www.site.com/folder2/username
http://www.site.com/folder2/username2
etc
Also, would it be best to add this code to the end of the rest or at the beginning? I would guess the end.
Thanks again (and thanks for the links to the manual too)
Simon
Last edited by recedo; 01-06-06 at 09:37 PM.
Reason: additional question
|

01-06-06, 09:49 PM
|
 |
Community VIP
|
|
Join Date: Mar 2005
Location: ProgrammingTalk
Posts: 2,449
Thanks: 0
Thanked 6 Times in 5 Posts
|
|
Quote:
|
Originally Posted by recedo
Also, just looking at the code again, you put "/folder2/". Would I not need to use "../folder2/" as folder2 is on the same level as folder1 eg;
|
I think that the code should work, you should try it.
Quote:
|
Originally Posted by recedo
Also, would it be best to add this code to the end of the rest or at the beginning? I would guess the end.
|
Do you mean at the end of the registration script? If yes, then you schould place it where you add the infomation to your database(if you using one).
|

01-06-06, 09:54 PM
|
|
Newbie Coder
|
|
Join Date: Dec 2004
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Quote:
|
Originally Posted by dead-poetic
Do you mean at the end of the registration script? If yes, then you schould place it where you add the infomation to your database(if you using one).
|
Yes, thats what I mean, so it should be at the end of the code that adds the details to the database.
I will try this out when I get the time, hopefully tomorrow morning.
Thanks again
Simon
|

01-06-06, 09:59 PM
|
 |
Community VIP
|
|
Join Date: Mar 2005
Location: ProgrammingTalk
Posts: 2,449
Thanks: 0
Thanked 6 Times in 5 Posts
|
|
Quote:
|
Originally Posted by recedo
Yes, thats what I mean, so it should be at the end of the code that adds the details to the database.
|
Yes, thats what I would do. Your Welcome. 
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|