2004-11-03, 04:54 AM
:/ got me, I just know that how you fix it
Edit: Google search:
Edit: Google search:
Quote:You might notice that when you create a new directory using this code:hence the code I gave you:
mkdir($dir, 0777);
The created folder actually has permissions of 0755, instead of the specified
0777. Why is this you ask? Because of umask()
The usual default value of umask, is 18. Which is 22 octal, or 0022. This means that when you use mkdir() to CHMOD the created folder to 0777, PHP takes 0777 and substracts the current value of umask, in our case 0022, so the result is 0755 - which is not what you wanted, probably.
The "fix" for this is simple, include this line:
$old_umask = umask(0);
Right before creating a folder with mkdir() to have the actual value you put be used as the CHMOD. If you would like to return umask to its original value when you're done, use this:
umask($old_umask);
$old_umask = umask(0);
mkdir("./members/$_POST[username1]", 0777);
umask($old_umask);