Ok then lets just use the following (non-tested) code as an example. Edit the following as needed.
PHP Code:
<?php
//Start Config
$homepath = "/home/mysite/public_html/members/";
$filesdir = "/home/mysite/hidden/";
//for windows systems, uncomment the following and comment above.
//$homepath = "C:/mysite/www/members/";
//$filesdir = "C:/mysite/hidden/";
/* Add the files in which you want to copy from the old to the new directory. Use the same format as below! */
$cpFiles = array("file1.txt","file2.png","file3.php","file4.dat");
// End config
reset($cpFiles);
$username = $_REQUEST["username"];
$userDir = $homepath.$username;
//create the new directory
$newDir = mkdir($userDir, 0777);
if (!$newDir) {
//If directory not created, end script and display error message
exit("The user directry was not created. Please try again or contact an Administrator.");
}
else {
//Begin copying files listed in the cpFiles array to the new directory.
foreach($cpFiles as $theFile) {
copy($filesdir.$theFile,$userDir.$theFile);
} //end foreach
} //end else
?>
Please note, that the directory that the ones will be created in must be chmod to 777 or all writeable. Let me know if you need any further help.
Bookmarks