MyBB Community Forums

Full Version: D-Frame.co.uk
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
:/ got me, I just know that how you fix it

Edit: Google search:
Quote:You might notice that when you create a new directory using this code:

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);
hence the code I gave you:
$old_umask = umask(0);
mkdir("./members/$_POST[username1]", 0777);
umask($old_umask);
Ohhhh.... right.... ok kewl... thanks Wink
ok, Dale, I have re-done my post but on your forum now (http://www.d-frame.co.uk/forums/). The list is there in the appropriate places. It's seems better than posting here Smile
ok Thanks k776 Smile
Pages: 1 2 3