Jump to content

create dir


crazy8

Recommended Posts

Im wondering if anyone knows of or has a script that would do this. I need a script that will create a directory (which will be named whatever is entered into a text box) and once a directory is created, it needs to have the ability to copy some folders/files into that directory.

Any ideas?

Link to comment
Share on other sites

So lets say I have a drop down menu in a form, and I will have a folder already made for each of the possible selections in the drop down menu. How could I set this up to have the persons account go into a folder that they chose from the drop down?

Ok to explain this more clear. I have an account system I am setting up, which consist of 3 forms. The first form has a drop down whos options are "clubs", "bars", "resturants", and "coffee_shops". So lets say someone is setting up an account for a resturant of theirs. So they pic "resturant" from the drop down. How can i set this up so that a personalized folder form them will go into the resturant folder?

 

Thank you guys for the help

Link to comment
Share on other sites

So lets say I have a drop down menu in a form, and I will have a folder already made for each of the possible selections in the drop down menu. How could I set this up to have the persons account go into a folder that they chose from the drop down?

Ok to explain this more clear. I have an account system I am setting up, which consist of 3 forms. The first form has a drop down whos options are "clubs", "bars", "resturants", and "coffee_shops". So lets say someone is setting up an account for a resturant of theirs. So they pic "resturant" from the drop down. How can i set this up so that a personalized folder form them will go into the resturant folder?

 

Thank you guys for the help

 

<?php
// Lets start
include("you connection to your database");
// Get the name of the folder the user has chose
$account_dir = $_POST['drop_down_menu'];

// Now the name of the user
$username = $_POST['username'];

if($account_dir == "clubs"){ // Check if the user has selected clubs

mkdir($account_dir."/".$username,0700); // create the directory in the clubs section, and add his username

mysql_query("INSERT INTO user_accounts (username,dir) VALUES ('$username','$account_dir')") or die(mysql_error()); // if you want to identify the user later on, you need to know his directory he registered under

}
elseif($account_dir == "coffee_shop"){

mkdir($account_dir."/".$username,0700); 

mysql_query("INSERT INTO user_accounts (username,dir) VALUES ('$username','$account_dir')")  or die(mysql_error());

}
elseif($account_dir == "resturants"){

mkdir($account_dir."/".$username,0700); 

mysql_query("INSERT INTO user_accounts (username,dir) VALUES ('$username','$account_dir')")  or die(mysql_error());

}

?>



Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.