crazy8 Posted November 22, 2007 Share Posted November 22, 2007 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? Quote Link to comment Share on other sites More sharing options...
Orio Posted November 22, 2007 Share Posted November 22, 2007 mkdir() ... Orio. Quote Link to comment Share on other sites More sharing options...
phpSensei Posted November 22, 2007 Share Posted November 22, 2007 <?php $dir_name = "Your new folder name"; mkdir("path/to/folder/".$dir_name, 0700); // The mode is 0777 by default, which means the widest possible access. For more information on modes, read the details on the chmod() page. ?> http://ca3.php.net/function.mkdir Quote Link to comment Share on other sites More sharing options...
crazy8 Posted November 22, 2007 Author Share Posted November 22, 2007 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 Quote Link to comment Share on other sites More sharing options...
phpSensei Posted November 22, 2007 Share Posted November 22, 2007 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()); } ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.