PDA

View Full Version : mkdir function



Ini
21-05-2007, 12:41 PM
ive finally worked out how to use the mkdir function with a username variable so when a user signs up it creates a dir with there username.

Now, i want to create 3 dirs inside that one automatically..

anyone no how i can do this?

+rep for help

Thanks

Chris

Luckyrare
21-05-2007, 03:10 PM
Use the same function afterwards to create the dirs inside.

I would highly recommend you use htaccess to do this, look in my thread about SEO in the tutorial section for some help.

Ini
21-05-2007, 03:31 PM
My code is:



$username= $_POST[username]
$name = $_SERVER['DOCUMENT_ROOT'] . "/test/" . $username;
if (!is_dir($username))
{
mkdir($name, 0777);
}



I try adding that again but with the others and it gives me errors ;l

Invent
21-05-2007, 03:37 PM
$username= $_POST[username]
$name = $_SERVER['DOCUMENT_ROOT'] . "/test/" . $username;
if (!is_dir($username))
{
mkdir($name, 0777);
mkdir(". $name ."/folder1, 0777);
mkdir(". $name ."/folder2, 0777);
mkdir(". $name ."/folder3, 0777);
}


Never used the mkdir function, so I'm pretty sure it won't work, lol.

Ini
21-05-2007, 03:53 PM
$username= $_POST[username]
$name = $_SERVER['DOCUMENT_ROOT'] . "/test/" . $username;
if (!is_dir($username))
{
mkdir($name, 0777);
mkdir(". $name ."/folder1, 0777);
mkdir(". $name ."/folder2, 0777);
mkdir(". $name ."/folder3, 0777);
}
Never used the mkdir function, so I'm pretty sure it won't work, lol.

Tried that and got:



Warning: Division by zero in /home2/****/public_html/test/register.php on line 17

Warning: mkdir() [function.mkdir (http://www.edagg.com/test/function.mkdir)]: No such file or directory in /home2/****/public_html/test/register.php on line 17

Warning: Division by zero in /home2/****/public_html/test/register.php on line 18

Warning: mkdir() [function.mkdir (http://www.edagg.com/test/function.mkdir)]: No such file or directory in /home2/****/public_html/test/register.php on line 18

Warning: Division by zero in /home2/edaggcom/public_html/test/register.php on line 19

Warning: mkdir() [function.mkdir (http://www.edagg.com/test/function.mkdir)]: No such file or directory in /home2/edaggcom/public_html/test/register.php on line 19

Ini
21-05-2007, 05:19 PM
Sorted - Closed

+rep for both

Ini
21-05-2007, 08:49 PM
Opened again becuase the files created are not chmoding to 777

JamesRouale
21-05-2007, 09:56 PM
Post your code...

Sygon..
21-05-2007, 09:59 PM
chmod($dir1); etc.

Want to hide these adverts? Register an account for free!